Class XmlRuleDisambiguator
java.lang.Object
org.languagetool.tagging.disambiguation.AbstractDisambiguator
org.languagetool.tagging.disambiguation.rules.XmlRuleDisambiguator
- All Implemented Interfaces:
Disambiguator
Rule-based disambiguator. Implements an idea by Agnes Souque.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXmlRuleDisambiguator(Language language) XmlRuleDisambiguator(Language language, boolean useGlobalDisambiguation) -
Method Summary
Modifier and TypeMethodDescriptiondisambiguate(AnalyzedSentence input) If possible, filters out the wrong POS tags.disambiguate(AnalyzedSentence sentence, JLanguageTool.CheckCancelledCallback checkCanceled) The same asDisambiguator.disambiguate(AnalyzedSentence), but may callcheckCanceled(if it's non-null) to allow for better interruptibility.protected List<DisambiguationPatternRule> loadPatternRules(String filename, Language language) Load disambiguation rules from an XML file.Methods inherited from class org.languagetool.tagging.disambiguation.AbstractDisambiguator
preDisambiguate
-
Field Details
-
DISAMBIGUATION_FILE
- See Also:
-
GLOBAL_DISAMBIGUATION_FILE
- See Also:
-
disambiguationRules
-
-
Constructor Details
-
XmlRuleDisambiguator
-
XmlRuleDisambiguator
-
-
Method Details
-
disambiguate
Description copied from interface:DisambiguatorIf possible, filters out the wrong POS tags.- Parameters:
input- The sentence with already tagged words. The words are expected to have multiple tags.- Returns:
- Analyzed sentence, where each word has only one (possibly the most correct) tag.
- Throws:
IOException
-
disambiguate
public AnalyzedSentence disambiguate(AnalyzedSentence sentence, @Nullable JLanguageTool.CheckCancelledCallback checkCanceled) throws IOException Description copied from interface:DisambiguatorThe same asDisambiguator.disambiguate(AnalyzedSentence), but may callcheckCanceled(if it's non-null) to allow for better interruptibility.- Throws:
IOException
-
loadPatternRules
protected List<DisambiguationPatternRule> loadPatternRules(String filename, Language language) throws ParserConfigurationException, SAXException, IOException Load disambiguation rules from an XML file. UseJLanguageTool.addRule(org.languagetool.rules.Rule)to add these rules to the checking process.- Returns:
- a List of
DisambiguationPatternRuleobjects - Throws:
ParserConfigurationExceptionSAXExceptionIOException
-