@Override public String getBaseForm(Set<String> baseSet, String form, String pos) { return matchesOriginalPOS(pos) ? getBaseForm(baseSet, form) : null; }
@Override public String getBaseForm(Map<String,Set<String>> baseMap, String form, String pos) { if (!matchesOriginalPOS(pos)) return null; String base; for (AbstractAffixReplacer replacer : l_replacers) { base = replacer.getBaseForm(baseMap, form); if (base != null) return base; } return null; }
public AbstractAffixMatcher createAffixMatcher(Element eAffix) { String type = XMLUtils.getTrimmedAttribute(eAffix, ATTR_TYPE); String form = XMLUtils.getTrimmedAttribute(eAffix, ATTR_FORM); String pos = XMLUtils.getTrimmedAttribute(eAffix, ATTR_POS); String orgPOS = XMLUtils.getTrimmedAttribute(eAffix, ATTR_ORG_POS); Pattern oPOS = orgPOS.equals(StringConst.EMPTY) ? null : Pattern.compile("^("+orgPOS+")$"); boolean bSuffix = type.equals(VAL_SUFFIX); AbstractAffixMatcher matcher; if (bSuffix) matcher = new EnglishSuffixMatcher(form, pos, oPOS); else throw new IllegalArgumentException("Invalid affix type: "+type); NodeList list = eAffix.getElementsByTagName(ELEM_RULE); AbstractAffixReplacer replacer; int i, size = list.getLength(); for (i=0; i<size; i++) { replacer = getAffixReplacer(bSuffix, (Element)list.item(i)); if (replacer != null) matcher.addReplacer(replacer); } return matcher; }
@Override public String getBaseForm(Map<String,Set<String>> baseMap, String form, String pos) { if (!matchesOriginalPOS(pos)) return null; String base; for (AbstractAffixReplacer replacer : l_replacers) { base = replacer.getBaseForm(baseMap, form); if (base != null) return base; } return null; }
public AbstractAffixMatcher createAffixMatcher(Element eAffix) { String type = XMLUtils.getTrimmedAttribute(eAffix, ATTR_TYPE); String form = XMLUtils.getTrimmedAttribute(eAffix, ATTR_FORM); String pos = XMLUtils.getTrimmedAttribute(eAffix, ATTR_POS); String orgPOS = XMLUtils.getTrimmedAttribute(eAffix, ATTR_ORG_POS); Pattern oPOS = orgPOS.equals(StringConst.EMPTY) ? null : Pattern.compile("^("+orgPOS+")$"); boolean bSuffix = type.equals(VAL_SUFFIX); AbstractAffixMatcher matcher; if (bSuffix) matcher = new EnglishSuffixMatcher(form, pos, oPOS); else throw new IllegalArgumentException("Invalid affix type: "+type); NodeList list = eAffix.getElementsByTagName(ELEM_RULE); AbstractAffixReplacer replacer; int i, size = list.getLength(); for (i=0; i<size; i++) { replacer = getAffixReplacer(bSuffix, (Element)list.item(i)); if (replacer != null) matcher.addReplacer(replacer); } return matcher; }
@Override public String getBaseForm(Set<String> baseSet, String form, String pos) { return matchesOriginalPOS(pos) ? getBaseForm(baseSet, form) : null; }