Package org.languagetool.remote
Class SentenceAnnotator
java.lang.Object
org.languagetool.remote.SentenceAnnotator
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static HashMap<String, List<RemoteRuleMatch>> private static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringapplyAllMatches(String line, List<RemoteRuleMatch> matches) private static StringBuildercreateCSVRow(String[] fieldValues) private static StringformatedSentence(String line, RemoteRuleMatch match) private static StringformatedSentence2(String line, PseudoMatch match) private static StringformattedCorrectedSentence(String line, RemoteRuleMatch match, int i) private static StringformattedCorrectedSentence2(String line, PseudoMatch match) private static StringgetFullId(RemoteRuleMatch match) private static List<RemoteRuleMatch> getMatches(SentenceAnnotator.AnnotatorConfig cfg, String sentence) private static StringgetMatchIdentifier(String sentence, RemoteRuleMatch match) private static StringgetRuleCategoryId(RemoteRuleMatch match) private static StringgetRuleType(RemoteRuleMatch match) private static StringlistSuggestions(RemoteRuleMatch match, String detectedErrorStr) static voidprivate static Stringmd5FromSentence(String sentence) private static StringBuilderprepareFieldForCSV(String fieldValue) private static voidprintOutputLine(SentenceAnnotator.AnnotatorConfig cfg, String sentenceHash, String sentenceID, String errorSentence, String correctedSentence, String errorType, String detectedErrorStr, String suggestion, String suggestionGolden, int suggestionPos, int suggestionsTotal, String ruleId, String ruleCategory, String ruleType) private static StringprintTimeFromStart(long start, String tag) private static StringreplaceSuggestion(String line, RemoteRuleMatch match, int i) private static voidprivate static voidstatic voidwait(int ms) private static voidprivate static void
-
Field Details
-
cachedMatches
-
timestamp
-
-
Constructor Details
-
SentenceAnnotator
public SentenceAnnotator()
-
-
Method Details
-
main
- Throws:
Exception
-
runAnnotation
private static void runAnnotation(SentenceAnnotator.AnnotatorConfig cfg) throws IOException, NoSuchAlgorithmException, InterruptedException -
runAutomaticAnnotation
- Throws:
Exception
-
prepareFieldForCSV
-
createCSVRow
-
md5FromSentence
- Throws:
NoSuchAlgorithmException
-
printOutputLine
private static void printOutputLine(SentenceAnnotator.AnnotatorConfig cfg, String sentenceHash, String sentenceID, String errorSentence, String correctedSentence, String errorType, String detectedErrorStr, String suggestion, String suggestionGolden, int suggestionPos, int suggestionsTotal, String ruleId, String ruleCategory, String ruleType) -
writeToOutputFile
- Throws:
IOException
-
getMatchIdentifier
-
getFullId
-
getRuleCategoryId
-
getRuleType
-
listSuggestions
-
formatedSentence2
-
formattedCorrectedSentence2
-
formatedSentence
-
applyAllMatches
-
formattedCorrectedSentence
-
replaceSuggestion
-
getMatches
private static List<RemoteRuleMatch> getMatches(SentenceAnnotator.AnnotatorConfig cfg, String sentence) throws InterruptedException - Throws:
InterruptedException
-
printTimeFromStart
-
writeHelp
private static void writeHelp() -
wait
public static void wait(int ms)
-