public final class CommandLineTools extends Object
Modifier and Type | Method and Description |
---|---|
static int |
checkBitext(BitextReader reader,
JLanguageTool srcLt,
JLanguageTool trgLt,
List<BitextRule> bRules)
Checks the bilingual input (bitext) and displays the output (considering the target
language) in API format or in the simple text format.
|
static int |
checkText(String contents,
JLanguageTool lt) |
static int |
checkText(String contents,
JLanguageTool lt,
boolean isJsonFormat,
int lineOffset) |
static int |
checkText(String contents,
JLanguageTool lt,
boolean isJsonFormat,
int contextSize,
int lineOffset,
int prevMatches,
StringTools.ApiPrintMode apiMode,
boolean listUnknownWords,
JLanguageTool.Level level,
List<String> unknownWords,
boolean verbose)
Check the given text and print results to System.out.
|
static int |
checkText(String contents,
JLanguageTool lt,
boolean isJsonFormat,
int lineOffset,
JLanguageTool.Level level,
boolean listUnknownWords) |
static int |
checkText(String contents,
JLanguageTool lt,
boolean isJsonFormat,
int lineOffset,
JLanguageTool.Level level,
boolean listUnknownWords,
boolean verbose) |
static void |
correctBitext(BitextReader reader,
JLanguageTool sourceLt,
JLanguageTool targetLt,
List<BitextRule> bRules)
Automatically applies suggestions to the bilingual text.
|
static void |
printMatches(List<RuleMatch> ruleMatches,
int prevMatches,
String contents,
int contextSize,
Language lang,
boolean verbose)
Displays matches in a simple text format.
|
static void |
profileRulesOnText(String contents,
JLanguageTool lt)
Simple rule profiler - used to run LT on a corpus to see which
rule takes most time.
|
static void |
tagText(String contents,
JLanguageTool lt)
Tags text using the LanguageTool tagger, printing results to System.out.
|
public static void tagText(String contents, JLanguageTool lt) throws IOException
contents
- Text to tag.lt
- LanguageTool instanceIOException
public static int checkText(String contents, JLanguageTool lt) throws IOException
IOException
public static int checkText(String contents, JLanguageTool lt, boolean isJsonFormat, int lineOffset) throws IOException
IOException
public static int checkText(String contents, JLanguageTool lt, boolean isJsonFormat, int lineOffset, JLanguageTool.Level level, boolean listUnknownWords) throws IOException
IOException
public static int checkText(String contents, JLanguageTool lt, boolean isJsonFormat, int lineOffset, JLanguageTool.Level level, boolean listUnknownWords, boolean verbose) throws IOException
IOException
public static int checkText(String contents, JLanguageTool lt, boolean isJsonFormat, int contextSize, int lineOffset, int prevMatches, StringTools.ApiPrintMode apiMode, boolean listUnknownWords, JLanguageTool.Level level, List<String> unknownWords, boolean verbose) throws IOException
contents
- a text to check (may be more than one sentence)lt
- Initialized LanguageToolisJsonFormat
- whether to print the result in JSON formatcontextSize
- error text context size: -1 for defaultlineOffset
- line number offset to be added to line numbers in matchesprevMatches
- number of previously matched rulesapiMode
- mode of xml/json printout for simple xml/json outputIOException
public static void printMatches(List<RuleMatch> ruleMatches, int prevMatches, String contents, int contextSize, Language lang, boolean verbose)
ruleMatches
- Matches from rules.prevMatches
- Number of previously found matches.contents
- The text that was checked.contextSize
- The size of contents displayed.public static int checkBitext(BitextReader reader, JLanguageTool srcLt, JLanguageTool trgLt, List<BitextRule> bRules) throws IOException
reader
- Reader of bitext strings.srcLt
- Source JLanguageTool (used to analyze the text).trgLt
- Target JLanguageTool (used to analyze the text).bRules
- Bilingual rules used in addition to target standard rules.IOException
public static void profileRulesOnText(String contents, JLanguageTool lt) throws IOException
contents
- text to checklt
- instance of LanguageToolIOException
public static void correctBitext(BitextReader reader, JLanguageTool sourceLt, JLanguageTool targetLt, List<BitextRule> bRules) throws IOException
reader
- a bitext file readersourceLt
- Initialized source JLanguageTool objecttargetLt
- Initialized target JLanguageTool objectbRules
- List of all BitextRules to useIOException