PostPOSTagger implements ProcessingEngine { private MorphologicalTag merge(MorphologicalTag a, MorphologicalTag b) { MorphologicalTag ret = a.clone(); Class aClass = a.getClazzE(); Class bClass = b.getClazzE(); if (!isVariable(aClass)) { ret = b.clone(); } else { if (aClass.equals(Class.NOUN) && bClass.equals(Class.NOUN) || aClass.equals(Class.ADJECTIVE) && bClass.equals(Class.ADJECTIVE)) { ret = b.clone(); if (Gender.FEMALE.equals(a.getGenderE()) || Gender.FEMALE.equals(b.getGenderE())) { ret.setGender(Gender.NEUTRAL); } if (Number.PLURAL.equals(a.getNumberE()) || Number.PLURAL.equals(b.getNumberE())) { ret.setNumber(Number.PLURAL); } } else if (aClass.equals(Class.ADJECTIVE) && bClass.equals(Class.NOUN)) { ret = b.clone(); ret.setClazz(Class.ADJECTIVE); if (Gender.FEMALE.equals(a.getGenderE()) || Gender.FEMALE.equals(b.getGenderE())) { ret.setGender(Gender.NEUTRAL); } if (Number.PLURAL.equals(a.getNumberE()) || Number.PLURAL.equals(b.getNumberE())) { ret.setNumber(Number.PLURAL); } } else if (aClass.equals(Class.VERB) || bClass.equals(Class.PREPOSITION)) { ret = b.clone(); ret.setGender(Gender.MALE); } else if (aClass.equals(Class.NOUN)) { ret = a; } else if (bClass.equals(Class.NOUN)) { ret = b; } if (isVariable(aClass) && isVariable(bClass)) { Gender aGender = a.getGenderE(); Gender bGender = b.getGenderE(); Number aNumber = a.getNumberE(); Number bNumber = b.getNumberE(); if (aGender != null && bGender != null) { if (!aGender.equals(bGender)) { ret.setGender(Gender.NEUTRAL); } } if (aNumber != null && bNumber != null) { if (!aNumber.equals(bNumber)) { ret.setNumber(Number.NEUTRAL); } } } } return ret; } PostPOSTagger(CogrooTagDictionary dict); void process(Sentence sentence);  }
@Test public void testMerge() { }