diff --git a/src/main/groovy/ua/net/nlp/tools/TextUtils.groovy b/src/main/groovy/ua/net/nlp/tools/TextUtils.groovy index d5c3035..075b86a 100644 --- a/src/main/groovy/ua/net/nlp/tools/TextUtils.groovy +++ b/src/main/groovy/ua/net/nlp/tools/TextUtils.groovy @@ -349,7 +349,7 @@ public class TextUtils { @Option(names = ["-o", "--output"], arity="1", description = ["Output file"]) String output @Option(names = ["-q", "--quiet"], description = ["Less output"]) - boolean quiet + public boolean quiet @Option(names= ["-h", "--help"], usageHelp= true, description= "Show this help message and exit.") boolean helpRequested @Option(names = ["-n", "--outputFormat"], arity="1", description = "Output format: {xml (default), json, txt}", defaultValue = "xml") diff --git a/src/main/groovy/ua/net/nlp/tools/tag/TagTextCore.groovy b/src/main/groovy/ua/net/nlp/tools/tag/TagTextCore.groovy index c78d312..54e671f 100644 --- a/src/main/groovy/ua/net/nlp/tools/tag/TagTextCore.groovy +++ b/src/main/groovy/ua/net/nlp/tools/tag/TagTextCore.groovy @@ -36,8 +36,8 @@ import picocli.CommandLine.ParameterException class TagTextCore { - - public static final Pattern PUNCT_PATTERN = Pattern.compile(/[,.:;!?\/()\[\]{}«»„“"'…\u2013\u2014\u201D\u201C•■♦-]+/) + + public static final Pattern PUNCT_PATTERN = Pattern.compile(/[,.:;!?\/()\[\]{}«»„“"'…\u2013\u2014\u201D\u201C•■♦-]+/) // " public static final Pattern SYMBOL_PATTERN = Pattern.compile(/[%&@$*+=<>\u00A0-\u00BF\u2000-\u20CF\u2100-\u218F\u2200-\u22FF]+/) static final Pattern UNKNOWN_PATTERN = Pattern.compile(/(.*-)?[а-яіїєґА-ЯІЇЄҐ][а-яіїєґА-ЯІЇЄҐ'\u02BC\u2019]+(-.*)?/) static final Pattern NON_UK_PATTERN = Pattern.compile(/^[\#№u2013-]|[\u2013-]$|[ыэъё]|[а-яіїєґ][a-z]|[a-z][а-яіїєґ]/, Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE) @@ -62,9 +62,9 @@ class TagTextCore { super(str); this.stats = stats } - } - - TagStats stats = new TagStats() + } + + TagStats stats = new TagStats() DisambigStats disambigStats = new DisambigStats() SemTags semTags = new SemTags() ModZheleh modZheleh = new ModZheleh(langTool) @@ -179,10 +179,14 @@ class TagTextCore { ? langTool.analyzeSentences( text.split("\n") as List ) : langTool.analyzeText(text) } - + @CompileStatic - List> tagTextCore(List analyzedSentences, TagStats stats) { + public List> tagTextCore(List analyzedSentences) { + tagTextCore(analyzedSentences, null); + } + @CompileStatic + List> tagTextCore(List analyzedSentences, TagStats stats) { List> taggedSentences = analyzedSentences.parallelStream().map { AnalyzedSentence analyzedSentence -> @@ -665,6 +669,13 @@ class TagTextCore { return } + if( ! options.quiet ) { + println("LT version: ${JLanguageTool.VERSION}") + def dictUkVersionRes = Ukrainian.class.getClassLoader().getResourceAsStream('org/languagetool/resource/uk/VERSION') + def dictUkversion = dictUkVersionRes ? dictUkVersionRes.text : "" + println("dict_uk version: ${dictUkversion}") + } + // TODO: quick hack to support multiple files if( options.inputFiles && options.inputFiles != ["-"] ) {