FlorestaTagInterpreter implements TagInterpreter { public MorphologicalTag parseMorphologicalTag(String tagString) { if (tagString == null) { return null; } synchronized (cache) { if (cache.containsKey(tagString)) { return ((MorphologicalTag) cache.get(tagString)).clone(); } } if(tagString.endsWith("#-")) { tagString = tagString.substring(0, tagString.length() - 2); } MorphologicalTag m = new MorphologicalTag(); String[] tags = tagString.split("[#=]"); for (String tag : tags) { if (MTAG_PARTS_ENUM.containsKey(tag)) { List<Enum<?>> tagE = MTAG_PARTS_ENUM.get(tag); for (Enum<?> t : tagE) { if (t instanceof Class) { m.setClazz((Class) t); } else if (t instanceof Gender) { m.setGender((Gender) t); } else if (t instanceof Number) { m.setNumber((Number) t); } else if (t instanceof Case) { m.setCase((Case) t); } else if (t instanceof Person) { m.setPerson((Person) t); } else if (t instanceof Tense) { m.setTense((Tense) t); } else if (t instanceof Mood) { m.setMood((Mood) t); } else if (t instanceof Punctuation) { m.setPunctuation((Punctuation) t); } } } else { if (tag.length() == 1 || "--".equals(tag) || "...".equals(tag)) { m.setClazz(Class.PUNCTUATION_MARK); if(",".equals(tag)) { m.setPunctuation(Punctuation.NSEP); } else if(".".equals(tag) || "!".equals(tag) || "?".equals(tag)) { m.setPunctuation(Punctuation.ABS); } else if("(".equals(tag) || ")".equals(tag)) { m.setPunctuation(Punctuation.BIN); } else { m.setPunctuation(Punctuation.REL); } } else if ("n:".equals(tag)) { m.setClazz(Class.NOUN); } else if ("intj".equals(tag)) { m.setClazz(Class.INTERJECTION); } else if ("pp".equals(tag)) { m.setClazz(Class.PREPOSITION); } else if ("np".equals(tag)) { m.setClazz(Class.NOUN); } else if ("vp".equals(tag)) { m.setClazz(Class.INFINITIVE_VERB); } else if (tag.contains("<") || "P.vp".equals(tag) || "GER".equals(tag)) { } else { System.out.println(tag); } } } if (m.toString() == null || m.toString().length() == 0) { LOGGER.error("Invalid MorphologicalTag: " + tagString); } synchronized (cache) { if (!cache.containsKey(tagString)) { cache.put(tagString, m.clone()); } } return m; } FlorestaTagInterpreter(); MorphologicalTag parseMorphologicalTag(String tagString); ChunkTag parseChunkTag(String tagString); SyntacticTag parseSyntacticTag(String tagString); String serialize(MorphologicalTag tag); String serialize(ChunkTag tag); String serialize(SyntacticTag tag); String serialize(SyntacticFunction tag); String serialize(ChunkFunction tag); String serialize(Class tag); String serialize(Gender tag); String serialize(Number tag); String serialize(Case tag); String serialize(Person tag); String serialize(Tense tag); String serialize(Mood tag); String serialize(Punctuation tag);  }
@Test public void testParseMorphologicalTag() { for (String tag : table.keySet()) { if (table.get(tag) != null) assertEquals("Failed to parse class tag: " + tag, table.get(tag), ti .parseMorphologicalTag(tag).getClazzE()); } }