Révision 2698
| tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeCorpusImagePath.java (revision 2698) | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
/** |
| 23 | 23 |
* Our sample handler extends AbstractHandler, an IHandler base class. |
| 24 |
* |
|
| 24 | 25 |
* @see org.eclipse.core.commands.IHandler |
| 25 | 26 |
* @see org.eclipse.core.commands.AbstractHandler |
| 26 | 27 |
*/ |
| 27 | 28 |
public class ComputeCorpusImagePath extends AbstractHandler {
|
| 28 |
|
|
| 29 |
@Option(name="useCorpusHTMLDefaultDirectory", usage="use Corpus HTML Default Directory as image directory", widget="Boolean", required=true, def="true")
|
|
| 29 |
|
|
| 30 |
@Option(name = "useCorpusHTMLDefaultDirectory", usage = "use Corpus HTML Default Directory as image directory", widget = "Boolean", required = true, def = "true")
|
|
| 30 | 31 |
boolean useCorpusHTMLDefaultDirectory; |
| 31 |
@Option(name="path", usage="copy dictionary name", widget="Folder", required=false, def="") |
|
| 32 |
|
|
| 33 |
@Option(name = "path", usage = "copy dictionary name", widget = "Folder", required = false, def = "") |
|
| 32 | 34 |
File path; |
| 33 | 35 |
|
| 34 | 36 |
/** |
| 35 | 37 |
* the command has been executed, so extract extract the needed information |
| 36 | 38 |
* from the application context. |
| 37 | 39 |
*/ |
| 40 |
@Override |
|
| 38 | 41 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 39 | 42 |
ISelection isel = HandlerUtil.getCurrentSelection(event); |
| 40 | 43 |
if (isel instanceof IStructuredSelection) {
|
| 41 |
IStructuredSelection selection = (IStructuredSelection)isel; |
|
| 44 |
IStructuredSelection selection = (IStructuredSelection) isel;
|
|
| 42 | 45 |
Object o = selection.getFirstElement(); |
| 43 |
|
|
| 46 |
|
|
| 44 | 47 |
if (!(o instanceof MainCorpus)) {
|
| 45 |
System.out.println(o.toString()+" is not a MainCorpus. Aborting");
|
|
| 48 |
System.out.println(o.toString() + " is not a MainCorpus. Aborting");
|
|
| 46 | 49 |
return null; |
| 47 |
} else {
|
|
| 48 |
MainCorpus corpus = (MainCorpus)o; |
|
| 50 |
} |
|
| 51 |
else {
|
|
| 52 |
MainCorpus corpus = (MainCorpus) o; |
|
| 49 | 53 |
|
| 50 | 54 |
if (ParametersDialog.open(this)) {
|
| 51 | 55 |
if (useCorpusHTMLDefaultDirectory) path = null; |
| 52 |
update(corpus, path);
|
|
| 56 |
update(corpus, path); |
|
| 53 | 57 |
} |
| 54 | 58 |
} |
| 55 | 59 |
} |
| 56 |
|
|
| 60 |
|
|
| 57 | 61 |
return null; |
| 58 | 62 |
} |
| 59 | 63 |
|
| 60 | 64 |
public boolean update(MainCorpus corpus, File path) {
|
| 61 | 65 |
try {
|
| 66 |
corpus.compute(false); |
|
| 62 | 67 |
UpdateCorpusImagePaths upip = new UpdateCorpusImagePaths(); |
| 63 | 68 |
String spath = null; |
| 64 | 69 |
if (path != null) spath = path.getAbsolutePath(); |
| 65 | 70 |
if (upip.process(corpus, spath)) {
|
| 66 | 71 |
System.out.println("Corpus HTML paths patched !");
|
| 67 |
} else {
|
|
| 72 |
} |
|
| 73 |
else {
|
|
| 68 | 74 |
System.out.println("Error: Corpus HTML paths not patched.");
|
| 69 | 75 |
return false; |
| 70 | 76 |
} |
| 71 |
} catch (Exception e) {
|
|
| 77 |
} |
|
| 78 |
catch (Exception e) {
|
|
| 72 | 79 |
e.printStackTrace(); |
| 73 | 80 |
return false; |
| 74 | 81 |
} |
| tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeAllographs.java (revision 2698) | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
/** |
| 21 | 21 |
* Our sample handler extends AbstractHandler, an IHandler base class. |
| 22 |
* |
|
| 22 | 23 |
* @see org.eclipse.core.commands.IHandler |
| 23 | 24 |
* @see org.eclipse.core.commands.AbstractHandler |
| 24 | 25 |
*/ |
| 25 | 26 |
public class ComputeAllographs extends AbstractHandler {
|
| 26 |
|
|
| 27 |
@Option(name="tsvFile",usage="TSV output file", widget="CreateFile", required=false, def="file.tsv")
|
|
| 27 |
|
|
| 28 |
@Option(name = "tsvFile", usage = "TSV output file", widget = "CreateFile", required = false, def = "file.tsv")
|
|
| 28 | 29 |
File tsvFile; |
| 29 |
|
|
| 30 |
@Option(name="query",usage="The query", widget="Query", required=true, def="<s>[]")
|
|
| 30 |
|
|
| 31 |
@Option(name = "query", usage = "The query", widget = "Query", required = true, def = "<s>[]")
|
|
| 31 | 32 |
CQLQuery query; |
| 32 |
|
|
| 33 |
@Option(name="sign",usage="The sign", widget="String", required=false, def="amaj")
|
|
| 33 |
|
|
| 34 |
@Option(name = "sign", usage = "The sign", widget = "String", required = false, def = "amaj")
|
|
| 34 | 35 |
String sign; |
| 35 |
|
|
| 36 |
@Option(name="allograph",usage="The allograph", widget="String", required=false, def="amaj")
|
|
| 36 |
|
|
| 37 |
@Option(name = "allograph", usage = "The allograph", widget = "String", required = false, def = "amaj")
|
|
| 37 | 38 |
String allograph; |
| 38 |
|
|
| 39 |
|
|
| 39 | 40 |
/** |
| 40 | 41 |
* the command has been executed, so extract extract the needed information |
| 41 | 42 |
* from the application context. |
| 42 | 43 |
*/ |
| 44 |
@Override |
|
| 43 | 45 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 44 | 46 |
ISelection isel = HandlerUtil.getCurrentSelection(event); |
| 45 | 47 |
if (isel instanceof IStructuredSelection) {
|
| 46 |
IStructuredSelection selection = (IStructuredSelection)isel; |
|
| 48 |
IStructuredSelection selection = (IStructuredSelection) isel;
|
|
| 47 | 49 |
Object o = selection.getFirstElement(); |
| 48 |
|
|
| 50 |
|
|
| 49 | 51 |
if (!(o instanceof CQPCorpus)) {
|
| 50 |
System.out.println(o.toString()+" n'est pas un corpus. Abandon");
|
|
| 52 |
System.out.println(o.toString() + " n'est pas un corpus. Abandon");
|
|
| 51 | 53 |
return null; |
| 52 |
} else {
|
|
| 54 |
} |
|
| 55 |
else {
|
|
| 53 | 56 |
if (!ParametersDialog.open(this)) return null; |
| 54 |
|
|
| 55 |
CQPCorpus corpus = (CQPCorpus)o; |
|
| 56 |
|
|
| 57 |
|
|
| 58 |
CQPCorpus corpus = (CQPCorpus) o;
|
|
| 59 |
|
|
| 57 | 60 |
try {
|
| 61 |
corpus.compute(false); |
|
| 58 | 62 |
return compute(corpus, tsvFile, sign, allograph, query); |
| 59 |
} catch (Exception e) {
|
|
| 63 |
} |
|
| 64 |
catch (Exception e) {
|
|
| 60 | 65 |
// TODO Auto-generated catch block |
| 61 | 66 |
e.printStackTrace(); |
| 62 | 67 |
} |
| 63 | 68 |
} |
| 64 | 69 |
} |
| 65 |
|
|
| 70 |
|
|
| 66 | 71 |
return null; |
| 67 | 72 |
} |
| 68 | 73 |
|
| 69 | 74 |
public boolean compute(CQPCorpus corpus, File tsvFile, String sign, String allograph, CQLQuery query) throws Exception {
|
| 70 |
Allographs a = new Allographs(corpus, tsvFile, sign , query, allograph);
|
|
| 75 |
Allographs a = new Allographs(corpus, tsvFile, sign, query, allograph); |
|
| 71 | 76 |
return a.process(); |
| 72 | 77 |
} |
| 73 | 78 |
} |
| tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeProject2XTZ.java (revision 2698) | ||
|---|---|---|
| 20 | 20 |
|
| 21 | 21 |
/** |
| 22 | 22 |
* Our sample handler extends AbstractHandler, an IHandler base class. |
| 23 |
* |
|
| 23 | 24 |
* @see org.eclipse.core.commands.IHandler |
| 24 | 25 |
* @see org.eclipse.core.commands.AbstractHandler |
| 25 | 26 |
*/ |
| 26 | 27 |
public class ComputeProject2XTZ extends AbstractHandler {
|
| 27 | 28 |
|
| 28 |
@Option(name="projectDirectory",usage="Oriflamms' project directory", widget="Folder", required=true, def="project")
|
|
| 29 |
@Option(name = "projectDirectory", usage = "Oriflamms' project directory", widget = "Folder", required = true, def = "project")
|
|
| 29 | 30 |
File projectDirectory; |
| 30 |
|
|
| 31 |
|
|
| 31 | 32 |
/** |
| 32 | 33 |
* the command has been executed, so extract extract the needed information |
| 33 | 34 |
* from the application context. |
| 34 | 35 |
*/ |
| 36 |
@Override |
|
| 35 | 37 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 36 | 38 |
|
| 37 | 39 |
if (!ParametersDialog.open(this)) return null; |
| 38 | 40 |
|
| 39 | 41 |
try {
|
| 40 | 42 |
return process(projectDirectory); |
| 41 |
} catch (Exception e) {
|
|
| 43 |
} |
|
| 44 |
catch (Exception e) {
|
|
| 42 | 45 |
e.printStackTrace(); |
| 43 | 46 |
} |
| 44 | 47 |
return null; |
| tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeAbbreviationsAndSemantics.java (revision 2698) | ||
|---|---|---|
| 18 | 18 |
|
| 19 | 19 |
/** |
| 20 | 20 |
* Our sample handler extends AbstractHandler, an IHandler base class. |
| 21 |
* |
|
| 21 | 22 |
* @see org.eclipse.core.commands.IHandler |
| 22 | 23 |
* @see org.eclipse.core.commands.AbstractHandler |
| 23 | 24 |
*/ |
| 24 | 25 |
public class ComputeAbbreviationsAndSemantics extends AbstractHandler {
|
| 25 |
|
|
| 26 |
@Option(name="tsvFile",usage="TSV output file", widget="CreateFile", required=false, def="file.tsv")
|
|
| 26 |
|
|
| 27 |
@Option(name = "tsvFile", usage = "TSV output file", widget = "CreateFile", required = false, def = "file.tsv")
|
|
| 27 | 28 |
File tsvFile; |
| 28 |
|
|
| 29 |
@Option(name="entities",usage="1 2 3", metaVar="name persName placeName orgName roleName", widget="StructuralUnits", required=false, def="persName")
|
|
| 29 |
|
|
| 30 |
@Option(name = "entities", usage = "1 2 3", metaVar = "name persName placeName orgName roleName", widget = "StructuralUnits", required = false, def = "persName")
|
|
| 30 | 31 |
String entities; |
| 31 | 32 |
|
| 32 | 33 |
/** |
| 33 | 34 |
* the command has been executed, so extract extract the needed information |
| 34 | 35 |
* from the application context. |
| 35 | 36 |
*/ |
| 37 |
@Override |
|
| 36 | 38 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 37 | 39 |
ISelection isel = HandlerUtil.getCurrentSelection(event); |
| 38 | 40 |
if (isel instanceof IStructuredSelection) {
|
| 39 |
IStructuredSelection selection = (IStructuredSelection)isel; |
|
| 41 |
IStructuredSelection selection = (IStructuredSelection) isel;
|
|
| 40 | 42 |
Object o = selection.getFirstElement(); |
| 41 |
|
|
| 43 |
|
|
| 42 | 44 |
if (!(o instanceof CQPCorpus)) {
|
| 43 |
System.out.println(o.toString()+" n'est pas un corpus. Abandon");
|
|
| 45 |
System.out.println(o.toString() + " n'est pas un corpus. Abandon");
|
|
| 44 | 46 |
return null; |
| 45 |
} else {
|
|
| 47 |
} |
|
| 48 |
else {
|
|
| 46 | 49 |
if (!ParametersDialog.open(this)) return null; |
| 47 |
|
|
| 48 |
CQPCorpus corpus = (CQPCorpus)o; |
|
| 49 |
|
|
| 50 |
|
|
| 51 |
CQPCorpus corpus = (CQPCorpus) o;
|
|
| 52 |
|
|
| 50 | 53 |
try {
|
| 54 |
corpus.compute(false); |
|
| 51 | 55 |
return compute(corpus, entities, tsvFile); |
| 52 |
} catch (Exception e) {
|
|
| 56 |
} |
|
| 57 |
catch (Exception e) {
|
|
| 53 | 58 |
// TODO Auto-generated catch block |
| 54 | 59 |
e.printStackTrace(); |
| 55 | 60 |
} |
| 56 | 61 |
} |
| 57 | 62 |
} |
| 58 |
|
|
| 63 |
|
|
| 59 | 64 |
return null; |
| 60 | 65 |
} |
| 61 | 66 |
|
| tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeAbbreviationsAndLines.java (revision 2698) | ||
|---|---|---|
| 18 | 18 |
|
| 19 | 19 |
/** |
| 20 | 20 |
* Our sample handler extends AbstractHandler, an IHandler base class. |
| 21 |
* |
|
| 21 | 22 |
* @see org.eclipse.core.commands.IHandler |
| 22 | 23 |
* @see org.eclipse.core.commands.AbstractHandler |
| 23 | 24 |
*/ |
| 24 | 25 |
public class ComputeAbbreviationsAndLines extends AbstractHandler {
|
| 25 |
|
|
| 26 |
@Option(name="tsvFile",usage="TSV output file", widget="CreateFile", required=false, def="file.tsv")
|
|
| 26 |
|
|
| 27 |
@Option(name = "tsvFile", usage = "TSV output file", widget = "CreateFile", required = false, def = "file.tsv")
|
|
| 27 | 28 |
File tsvFile; |
| 28 |
|
|
| 29 |
@Option(name="dist_start",usage="Distance depuis le début de ligne", widget="Integer", required=false, def="0")
|
|
| 29 |
|
|
| 30 |
@Option(name = "dist_start", usage = "Distance depuis le début de ligne", widget = "Integer", required = false, def = "0")
|
|
| 30 | 31 |
Integer dist_start; |
| 31 |
|
|
| 32 |
@Option(name="dist_end",usage="Distance depuis la fin de ligne", widget="Integer", required=false, def="1")
|
|
| 32 |
|
|
| 33 |
@Option(name = "dist_end", usage = "Distance depuis la fin de ligne", widget = "Integer", required = false, def = "1")
|
|
| 33 | 34 |
Integer dist_end; |
| 34 |
|
|
| 35 |
|
|
| 35 | 36 |
/** |
| 36 | 37 |
* the command has been executed, so extract extract the needed information |
| 37 | 38 |
* from the application context. |
| 38 | 39 |
*/ |
| 40 |
@Override |
|
| 39 | 41 |
public Object execute(ExecutionEvent event) throws ExecutionException {
|
| 40 | 42 |
ISelection isel = HandlerUtil.getCurrentSelection(event); |
| 41 | 43 |
if (isel instanceof IStructuredSelection) {
|
| 42 |
IStructuredSelection selection = (IStructuredSelection)isel; |
|
| 44 |
IStructuredSelection selection = (IStructuredSelection) isel;
|
|
| 43 | 45 |
Object o = selection.getFirstElement(); |
| 44 |
|
|
| 46 |
|
|
| 45 | 47 |
if (!(o instanceof CQPCorpus)) {
|
| 46 |
System.out.println(o.toString()+" n'est pas un corpus. Abandon");
|
|
| 48 |
System.out.println(o.toString() + " n'est pas un corpus. Abandon");
|
|
| 47 | 49 |
return null; |
| 48 |
} else {
|
|
| 50 |
} |
|
| 51 |
else {
|
|
| 49 | 52 |
if (!ParametersDialog.open(this)) return null; |
| 50 |
|
|
| 51 |
CQPCorpus corpus = (CQPCorpus)o; |
|
| 53 |
|
|
| 54 |
CQPCorpus corpus = (CQPCorpus) o;
|
|
| 52 | 55 |
dist_start = Math.abs(dist_start); |
| 53 | 56 |
dist_end = Math.abs(dist_end); |
| 54 | 57 |
|
| 55 | 58 |
try {
|
| 59 |
corpus.compute(false); |
|
| 56 | 60 |
return compute(corpus, dist_start, dist_end, tsvFile); |
| 57 |
} catch (Exception e) {
|
|
| 61 |
} |
|
| 62 |
catch (Exception e) {
|
|
| 58 | 63 |
// TODO Auto-generated catch block |
| 59 | 64 |
e.printStackTrace(); |
| 60 | 65 |
} |
| 61 | 66 |
} |
| 62 | 67 |
} |
| 63 |
|
|
| 68 |
|
|
| 64 | 69 |
return null; |
| 65 | 70 |
} |
| 66 | 71 |
|
| 67 | 72 |
public boolean compute(CQPCorpus corpus, int dist_start, int dist_end, File tsvFile) throws Exception {
|
| 68 |
AbbreviationsAndLines aal = new AbbreviationsAndLines(corpus, tsvFile,dist_start, dist_end); |
|
| 73 |
AbbreviationsAndLines aal = new AbbreviationsAndLines(corpus, tsvFile, dist_start, dist_end);
|
|
| 69 | 74 |
return aal.process(); |
| 70 | 75 |
} |
| 71 | 76 |
} |
Formats disponibles : Unified diff