Class XmlRuleDisambiguator
- java.lang.Object
-
- org.languagetool.tagging.disambiguation.AbstractDisambiguator
-
- org.languagetool.tagging.disambiguation.rules.XmlRuleDisambiguator
-
- All Implemented Interfaces:
Disambiguator
public class XmlRuleDisambiguator extends AbstractDisambiguator
Rule-based disambiguator. Implements an idea by Agnes Souque.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DISAMBIGUATION_FILE
private java.util.List<DisambiguationPatternRule>
disambiguationRules
-
Constructor Summary
Constructors Constructor Description XmlRuleDisambiguator(Language language)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnalyzedSentence
disambiguate(AnalyzedSentence input)
If possible, filters out the wrong POS tags.protected java.util.List<DisambiguationPatternRule>
loadPatternRules(java.lang.String filename)
Load disambiguation rules from an XML file.-
Methods inherited from class org.languagetool.tagging.disambiguation.AbstractDisambiguator
preDisambiguate
-
-
-
-
Field Detail
-
DISAMBIGUATION_FILE
private static final java.lang.String DISAMBIGUATION_FILE
- See Also:
- Constant Field Values
-
disambiguationRules
private final java.util.List<DisambiguationPatternRule> disambiguationRules
-
-
Constructor Detail
-
XmlRuleDisambiguator
public XmlRuleDisambiguator(Language language)
-
-
Method Detail
-
disambiguate
public AnalyzedSentence disambiguate(AnalyzedSentence input) throws java.io.IOException
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:
java.io.IOException
-
loadPatternRules
protected java.util.List<DisambiguationPatternRule> loadPatternRules(java.lang.String filename) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.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:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
-
-