org.daisy.pipeline.nlp.impl.matchrules.CompactAbbrMatchRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nlp-common Show documentation
Show all versions of nlp-common Show documentation
Common API for NLP functionality and XProc steps
The newest version!
package org.daisy.pipeline.nlp.impl.matchrules;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import org.daisy.pipeline.nlp.TextCategorizer.Category;
import org.daisy.pipeline.nlp.TextCategorizer.MatchMode;
/**
* Match compact abbreviations such as "etc.", but "e.t.c" does not match.
*/
public class CompactAbbrMatchRule extends WordListMatchRule {
public CompactAbbrMatchRule(Category category, int priority, boolean caseSensitive,
MatchMode matchMode, boolean capitalSensitive, Locale locale) {
super(category, priority, caseSensitive, matchMode, capitalSensitive, locale);
}
public void init(Collection rawAbbrs) {
List abbrs = new ArrayList();
for (String prefix : rawAbbrs) {
abbrs.add(prefix + ".");
}
super.init(abbrs);
}
}