public SetBasedPOSFilter(ConfigurationParams params) { try { this.relevantItems = new HashSet<CanonicalPosTag>(); for (String relevantPOS : params.getStringArray(Configuration.RELEVANT_POS_LIST)) this.relevantItems.add(CanonicalPosTag.valueOf(relevantPOS)); } catch (ConfigurationException e) { this.relevantItems = null; } }
@Override public void fromKey(String key) throws UndefinedKeyException { String[] toks = key.split(DELIMITER); if (toks.length != 2) throw new UndefinedKeyException("Cannot decode key " + key + " to a LemmaPos object, since it contains one or more serialization delimiters"); this.lemma = toks[0]; this.pos = CanonicalPosTag.valueOf(toks[1]); }