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
FieldsModifier and TypeFieldDescriptionprivate static final String
private final List
<DisambiguationPatternRule> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondisambiguate
(AnalyzedSentence input) If possible, filters out the wrong POS tags.protected List
<DisambiguationPatternRule> loadPatternRules
(String filename) Load disambiguation rules from an XML file.Methods inherited from class org.languagetool.tagging.disambiguation.AbstractDisambiguator
preDisambiguate
-
Field Details
-
DISAMBIGUATION_FILE
- See Also:
-
disambiguationRules
-
-
Constructor Details
-
XmlRuleDisambiguator
-
-
Method Details
-
disambiguate
Description copied from interface:Disambiguator
If 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
-
loadPatternRules
protected List<DisambiguationPatternRule> loadPatternRules(String filename) 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
DisambiguationPatternRule
objects - Throws:
ParserConfigurationException
SAXException
IOException
-