Commit 823e63f8 authored by javi's avatar javi
Browse files

More than one .def files can be provided separated by "," add validation

and workdir.
parent f2a5e779
Pipeline #22516 passed with stage
in 1 minute and 57 seconds
...@@ -56,7 +56,8 @@ public class App { ...@@ -56,7 +56,8 @@ public class App {
options.addOption(output); options.addOption(output);
Option listDefinitions = new Option("l", "listsURL", true, "Dictionary List definitions. " Option listDefinitions = new Option("l", "listsURL", true, "Dictionary List definitions. "
+ "A lists.def Gate-formatted file separated by tab can be provided or a zip file that contains the dictionary/gazetteer files including the lists.def "); + "A lists.def Gate-formatted file separated by tab can be provided or a zip file that contains the dictionary/gazetteer files including the lists.def. "
+ " More than one .def files can be provided separated by , (i.e: lists.def,lists2.def) this configuration will generate two steps of gazetter annotation. ");
listDefinitions.setRequired(false); listDefinitions.setRequired(false);
options.addOption(listDefinitions); options.addOption(listDefinitions);
...@@ -181,14 +182,29 @@ public class App { ...@@ -181,14 +182,29 @@ public class App {
if(listsDefinitionsPath==null) { if(listsDefinitionsPath==null) {
System.out.println("No dictionary was provided."); System.out.println("No dictionary was provided.");
}else { }else {
listsDefinitionsPath = workdirPath+listsDefinitionsPath; String[] list_defs = listsDefinitionsPath.split(",");
System.out.println("Dictionary Path " + listsDefinitionsPath); StringBuilder result = new StringBuilder();
for (String lf : list_defs) {
lf = workdirPath+lf;
System.out.println("Dictionary Path " + lf);
execution = true; execution = true;
if (!java.nio.file.Files.isRegularFile(Paths.get(listsDefinitionsPath))) { if (!java.nio.file.Files.isRegularFile(Paths.get(lf))) {
//System.out.println("Please set the list of dictionaries to annotate. You can provide the list.def file or a zip file. Please if you provided a zip file remember that it must contain a list.def file inside"); System.out.println("Please set the list of dictionaries to annotate in the correct format. You can provide the list.def file (or files , separated) or a zip file. Please if you provided a zip file remember that it must contain a list.def file inside");
//System.exit(1); System.exit(1);
//remember to validate with comma separated
} }
result.append(lf);
result.append(",");
}
listsDefinitionsPath = result.length() > 0 ? result.substring(0, result.length() - 1): "";
// listsDefinitionsPath = workdirPath+listsDefinitionsPath;
// System.out.println("Dictionary Path " + listsDefinitionsPath);
// execution = true;
// if (!java.nio.file.Files.isRegularFile(Paths.get(listsDefinitionsPath))) {
// //System.out.println("Please set the list of dictionaries to annotate. You can provide the list.def file or a zip file. Please if you provided a zip file remember that it must contain a list.def file inside");
// //System.exit(1);
// //remember to validate with comma separated
// }
if(listsDefinitionsPath.endsWith(".zip")) { if(listsDefinitionsPath.endsWith(".zip")) {
try { try {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment