@Test public void shouldInferMorphemicAttributesForVerbs() { LexemeAttribute PVD = LexemeAttribute.ProgressiveVowelDrop; LexemeAttribute PI = LexemeAttribute.Passive_In; LexemeAttribute AA = LexemeAttribute.Aorist_A; LexemeAttribute AI = LexemeAttribute.Aorist_I; LexemeAttribute VO = LexemeAttribute.Voicing; LexemeAttribute NVO = LexemeAttribute.NoVoicing; LexemeAttribute C_T = LexemeAttribute.Causative_t; LexemeAttribute C_IR = LexemeAttribute.Causative_Ir; LexemeAttribute C_IT = LexemeAttribute.Causative_It; LexemeAttribute C_AR = LexemeAttribute.Causative_Ar; LexemeAttribute C_DIR = LexemeAttribute.Causative_dIr; Set<LexemeAttribute> lexemeAttributes; lexemeAttributes = loader.inferMorphemicAttributes("git", PrimaryPos.Verb, ImmutableSet.of(VO, C_DIR)); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(VO, C_DIR, AA))); lexemeAttributes = loader.inferMorphemicAttributes("gel", PrimaryPos.Verb, ImmutableSet.of(AI, C_DIR)); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(AI, C_DIR, PI, NVO))); lexemeAttributes = loader.inferMorphemicAttributes("at", PrimaryPos.Verb, ImmutableSet.of(NVO, C_DIR)); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(NVO, C_DIR, AA))); lexemeAttributes = loader.inferMorphemicAttributes("ata", PrimaryPos.Verb, new HashSet<LexemeAttribute>()); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(PVD, PI, AI, C_T, NVO))); lexemeAttributes = loader.inferMorphemicAttributes("dola", PrimaryPos.Verb, new HashSet<LexemeAttribute>()); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(PVD, PI, AI, C_T, NVO))); lexemeAttributes = loader.inferMorphemicAttributes("tanı", PrimaryPos.Verb, ImmutableSet.of(AI)); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(AI, PVD, PI, AI, C_T, NVO))); lexemeAttributes = loader.inferMorphemicAttributes("getir", PrimaryPos.Verb, ImmutableSet.of(AI)); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(AI, AI, C_T, NVO))); lexemeAttributes = loader.inferMorphemicAttributes("ürk", PrimaryPos.Verb, ImmutableSet.of(C_IT)); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(C_IT, AA, NVO))); lexemeAttributes = loader.inferMorphemicAttributes("ağla", PrimaryPos.Verb, new HashSet<LexemeAttribute>()); assertThat(lexemeAttributes, Matchers.<Set<LexemeAttribute>>equalTo(ImmutableSet.of(PVD, PI, AI, C_T, NVO))); }
Set<LexemeAttribute> inferMorphemicAttributes(final String lemmaRoot, final PrimaryPos primaryPos, final Set<LexemeAttribute> _lexemeAttributes) { final char lastChar = lemmaRoot.charAt(lemmaRoot.length() - 1); final TurkicLetter lastLetter = TurkishAlphabet.getLetter(lastChar); final int vowelCount = this.vowelCount(lemmaRoot); final HashSet<LexemeAttribute> lexemeAttributes = new HashSet<LexemeAttribute>(_lexemeAttributes); final boolean isVerb = PrimaryPos.Verb.equals(primaryPos); final boolean isNoun = PrimaryPos.Noun.equals(primaryPos); final boolean isAdjective = PrimaryPos.Adjective.equals(primaryPos); final boolean isNounCompound = isNoun && lexemeAttributes.contains(LexemeAttribute.CompoundP3sg); if (isVerb) { inferVerbMorphemicAttributes(lastLetter, vowelCount, lexemeAttributes); } else if (isNounCompound) { inferNounCompoundMorphemicAttributes(lexemeAttributes); } else if (isNoun || isAdjective) { inferNounOrAdjectiveMorphemicAttributes(lemmaRoot, lastLetter, vowelCount, lexemeAttributes); } return lexemeAttributes; }
LexemeCreator { Set<LexemeAttribute> inferMorphemicAttributes(final String lemmaRoot, final PrimaryPos primaryPos, final Set<LexemeAttribute> _lexemeAttributes) { final char lastChar = lemmaRoot.charAt(lemmaRoot.length() - 1); final TurkicLetter lastLetter = TurkishAlphabet.getLetter(lastChar); final int vowelCount = this.vowelCount(lemmaRoot); final HashSet<LexemeAttribute> lexemeAttributes = new HashSet<LexemeAttribute>(_lexemeAttributes); final boolean isVerb = PrimaryPos.Verb.equals(primaryPos); final boolean isNoun = PrimaryPos.Noun.equals(primaryPos); final boolean isAdjective = PrimaryPos.Adjective.equals(primaryPos); final boolean isNounCompound = isNoun && lexemeAttributes.contains(LexemeAttribute.CompoundP3sg); if (isVerb) { inferVerbMorphemicAttributes(lastLetter, vowelCount, lexemeAttributes); } else if (isNounCompound) { inferNounCompoundMorphemicAttributes(lexemeAttributes); } else if (isNoun || isAdjective) { inferNounOrAdjectiveMorphemicAttributes(lemmaRoot, lastLetter, vowelCount, lexemeAttributes); } return lexemeAttributes; } }
LexemeCreator { Set<LexemeAttribute> inferMorphemicAttributes(final String lemmaRoot, final PrimaryPos primaryPos, final Set<LexemeAttribute> _lexemeAttributes) { final char lastChar = lemmaRoot.charAt(lemmaRoot.length() - 1); final TurkicLetter lastLetter = TurkishAlphabet.getLetter(lastChar); final int vowelCount = this.vowelCount(lemmaRoot); final HashSet<LexemeAttribute> lexemeAttributes = new HashSet<LexemeAttribute>(_lexemeAttributes); final boolean isVerb = PrimaryPos.Verb.equals(primaryPos); final boolean isNoun = PrimaryPos.Noun.equals(primaryPos); final boolean isAdjective = PrimaryPos.Adjective.equals(primaryPos); final boolean isNounCompound = isNoun && lexemeAttributes.contains(LexemeAttribute.CompoundP3sg); if (isVerb) { inferVerbMorphemicAttributes(lastLetter, vowelCount, lexemeAttributes); } else if (isNounCompound) { inferNounCompoundMorphemicAttributes(lexemeAttributes); } else if (isNoun || isAdjective) { inferNounOrAdjectiveMorphemicAttributes(lemmaRoot, lastLetter, vowelCount, lexemeAttributes); } return lexemeAttributes; }  }
LexemeCreator { Set<LexemeAttribute> inferMorphemicAttributes(final String lemmaRoot, final PrimaryPos primaryPos, final Set<LexemeAttribute> _lexemeAttributes) { final char lastChar = lemmaRoot.charAt(lemmaRoot.length() - 1); final TurkicLetter lastLetter = TurkishAlphabet.getLetter(lastChar); final int vowelCount = this.vowelCount(lemmaRoot); final HashSet<LexemeAttribute> lexemeAttributes = new HashSet<LexemeAttribute>(_lexemeAttributes); final boolean isVerb = PrimaryPos.Verb.equals(primaryPos); final boolean isNoun = PrimaryPos.Noun.equals(primaryPos); final boolean isAdjective = PrimaryPos.Adjective.equals(primaryPos); final boolean isNounCompound = isNoun && lexemeAttributes.contains(LexemeAttribute.CompoundP3sg); if (isVerb) { inferVerbMorphemicAttributes(lastLetter, vowelCount, lexemeAttributes); } else if (isNounCompound) { inferNounCompoundMorphemicAttributes(lexemeAttributes); } else if (isNoun || isAdjective) { inferNounOrAdjectiveMorphemicAttributes(lemmaRoot, lastLetter, vowelCount, lexemeAttributes); } return lexemeAttributes; }   }
LexemeCreator { Set<LexemeAttribute> inferMorphemicAttributes(final String lemmaRoot, final PrimaryPos primaryPos, final Set<LexemeAttribute> _lexemeAttributes) { final char lastChar = lemmaRoot.charAt(lemmaRoot.length() - 1); final TurkicLetter lastLetter = TurkishAlphabet.getLetter(lastChar); final int vowelCount = this.vowelCount(lemmaRoot); final HashSet<LexemeAttribute> lexemeAttributes = new HashSet<LexemeAttribute>(_lexemeAttributes); final boolean isVerb = PrimaryPos.Verb.equals(primaryPos); final boolean isNoun = PrimaryPos.Noun.equals(primaryPos); final boolean isAdjective = PrimaryPos.Adjective.equals(primaryPos); final boolean isNounCompound = isNoun && lexemeAttributes.contains(LexemeAttribute.CompoundP3sg); if (isVerb) { inferVerbMorphemicAttributes(lastLetter, vowelCount, lexemeAttributes); } else if (isNounCompound) { inferNounCompoundMorphemicAttributes(lexemeAttributes); } else if (isNoun || isAdjective) { inferNounOrAdjectiveMorphemicAttributes(lemmaRoot, lastLetter, vowelCount, lexemeAttributes); } return lexemeAttributes; }    }