@Test public void shouldCalculatePhoneticAttributes() { assertThat(EnumSet.of(FLV, LLV, LVU, LVF, LLNotVless), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("e")))); assertThat(EnumSet.of(FLC, LLC, LVU, LVF, LLNotVless), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("kel")))); assertThat(EnumSet.of(FLV, LLC, LVU, LVF, LLVless, LLVlessStop), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("ek")))); assertThat(EnumSet.of(FLC, LLC, LVU, LVF, LLVless), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("seh")))); assertThat(EnumSet.of(FLV, LLC, LVU, LVF, LLNotVless), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("elm")))); assertThat(EnumSet.of(FLV, LLC, LVU, LVF, LLVless, LLVlessStop), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("elk")))); assertThat(EnumSet.of(FLC, LLV, LVU, LVB, LLNotVless), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("belma")))); assertThat(EnumSet.of(FLV, LLV, LVR, LVB, LLNotVless), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("elmo")))); assertThat(EnumSet.of(FLC, LLC, LVU, LVB, LLVless, LLVlessStop), equalTo(phoneticsAnalyzer.calculatePhoneticAttributesOfPlainSequence(new TurkishSequence("kapak")))); }
EnumSet<PhoneticAttribute> calculatePhoneticAttributesOfPlainSequence(final TurkishSequence surface) { final EnumSet<PhoneticAttribute> attributes = EnumSet.noneOf(PhoneticAttribute.class); final TurkishChar lastVowelChar = surface.getLastVowel(); final TurkishChar firstChar = surface.charAt(0); final TurkicLetter firstLetter = firstChar.getLetter(); final TurkishChar lastChar = surface.getLastChar(); final TurkicLetter lastLetter = lastChar.getLetter(); if (firstLetter.isVowel()) attributes.add(PhoneticAttribute.FirstLetterVowel); else attributes.add(PhoneticAttribute.FirstLetterConsonant); if (lastVowelChar != null) { final TurkicLetter lastVowelLetter = lastVowelChar.getLetter(); if (lastVowelLetter.isRounded()) attributes.add(PhoneticAttribute.LastVowelRounded); else attributes.add(PhoneticAttribute.LastVowelUnrounded); if (lastVowelLetter.isFrontal()) attributes.add(PhoneticAttribute.LastVowelFrontal); else attributes.add(PhoneticAttribute.LastVowelBack); } else { attributes.add(PhoneticAttribute.HasNoVowel); } if (lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVowel); else attributes.add(PhoneticAttribute.LastLetterConsonant); if (lastLetter.isVoiceless()) { attributes.add(PhoneticAttribute.LastLetterVoiceless); if (lastLetter.isStopConsonant() && !lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVoicelessStop); } else { attributes.add(PhoneticAttribute.LastLetterNotVoiceless); } return attributes; }
PhoneticsAnalyzer { EnumSet<PhoneticAttribute> calculatePhoneticAttributesOfPlainSequence(final TurkishSequence surface) { final EnumSet<PhoneticAttribute> attributes = EnumSet.noneOf(PhoneticAttribute.class); final TurkishChar lastVowelChar = surface.getLastVowel(); final TurkishChar firstChar = surface.charAt(0); final TurkicLetter firstLetter = firstChar.getLetter(); final TurkishChar lastChar = surface.getLastChar(); final TurkicLetter lastLetter = lastChar.getLetter(); if (firstLetter.isVowel()) attributes.add(PhoneticAttribute.FirstLetterVowel); else attributes.add(PhoneticAttribute.FirstLetterConsonant); if (lastVowelChar != null) { final TurkicLetter lastVowelLetter = lastVowelChar.getLetter(); if (lastVowelLetter.isRounded()) attributes.add(PhoneticAttribute.LastVowelRounded); else attributes.add(PhoneticAttribute.LastVowelUnrounded); if (lastVowelLetter.isFrontal()) attributes.add(PhoneticAttribute.LastVowelFrontal); else attributes.add(PhoneticAttribute.LastVowelBack); } else { attributes.add(PhoneticAttribute.HasNoVowel); } if (lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVowel); else attributes.add(PhoneticAttribute.LastLetterConsonant); if (lastLetter.isVoiceless()) { attributes.add(PhoneticAttribute.LastLetterVoiceless); if (lastLetter.isStopConsonant() && !lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVoicelessStop); } else { attributes.add(PhoneticAttribute.LastLetterNotVoiceless); } return attributes; } }
PhoneticsAnalyzer { EnumSet<PhoneticAttribute> calculatePhoneticAttributesOfPlainSequence(final TurkishSequence surface) { final EnumSet<PhoneticAttribute> attributes = EnumSet.noneOf(PhoneticAttribute.class); final TurkishChar lastVowelChar = surface.getLastVowel(); final TurkishChar firstChar = surface.charAt(0); final TurkicLetter firstLetter = firstChar.getLetter(); final TurkishChar lastChar = surface.getLastChar(); final TurkicLetter lastLetter = lastChar.getLetter(); if (firstLetter.isVowel()) attributes.add(PhoneticAttribute.FirstLetterVowel); else attributes.add(PhoneticAttribute.FirstLetterConsonant); if (lastVowelChar != null) { final TurkicLetter lastVowelLetter = lastVowelChar.getLetter(); if (lastVowelLetter.isRounded()) attributes.add(PhoneticAttribute.LastVowelRounded); else attributes.add(PhoneticAttribute.LastVowelUnrounded); if (lastVowelLetter.isFrontal()) attributes.add(PhoneticAttribute.LastVowelFrontal); else attributes.add(PhoneticAttribute.LastVowelBack); } else { attributes.add(PhoneticAttribute.HasNoVowel); } if (lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVowel); else attributes.add(PhoneticAttribute.LastLetterConsonant); if (lastLetter.isVoiceless()) { attributes.add(PhoneticAttribute.LastLetterVoiceless); if (lastLetter.isStopConsonant() && !lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVoicelessStop); } else { attributes.add(PhoneticAttribute.LastLetterNotVoiceless); } return attributes; }  }
PhoneticsAnalyzer { EnumSet<PhoneticAttribute> calculatePhoneticAttributesOfPlainSequence(final TurkishSequence surface) { final EnumSet<PhoneticAttribute> attributes = EnumSet.noneOf(PhoneticAttribute.class); final TurkishChar lastVowelChar = surface.getLastVowel(); final TurkishChar firstChar = surface.charAt(0); final TurkicLetter firstLetter = firstChar.getLetter(); final TurkishChar lastChar = surface.getLastChar(); final TurkicLetter lastLetter = lastChar.getLetter(); if (firstLetter.isVowel()) attributes.add(PhoneticAttribute.FirstLetterVowel); else attributes.add(PhoneticAttribute.FirstLetterConsonant); if (lastVowelChar != null) { final TurkicLetter lastVowelLetter = lastVowelChar.getLetter(); if (lastVowelLetter.isRounded()) attributes.add(PhoneticAttribute.LastVowelRounded); else attributes.add(PhoneticAttribute.LastVowelUnrounded); if (lastVowelLetter.isFrontal()) attributes.add(PhoneticAttribute.LastVowelFrontal); else attributes.add(PhoneticAttribute.LastVowelBack); } else { attributes.add(PhoneticAttribute.HasNoVowel); } if (lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVowel); else attributes.add(PhoneticAttribute.LastLetterConsonant); if (lastLetter.isVoiceless()) { attributes.add(PhoneticAttribute.LastLetterVoiceless); if (lastLetter.isStopConsonant() && !lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVoicelessStop); } else { attributes.add(PhoneticAttribute.LastLetterNotVoiceless); } return attributes; }  EnumSet<PhoneticAttribute> calculatePhoneticAttributes(final String surface, Collection<LexemeAttribute> lexemeAttributes); EnumSet<PhoneticAttribute> calculatePhoneticAttributes(final TurkishSequence surface, Collection<LexemeAttribute> lexemeAttributes); ImmutableSet<PhoneticAttribute> calculateNewPhoneticAttributes(Set<PhoneticAttribute> phoneticAttributes, char charToApply); ImmutableSet<PhoneticAttribute> calculateNewPhoneticAttributes(ImmutableSet<PhoneticAttribute> phoneticAttributes, String suffixForm); }
PhoneticsAnalyzer { EnumSet<PhoneticAttribute> calculatePhoneticAttributesOfPlainSequence(final TurkishSequence surface) { final EnumSet<PhoneticAttribute> attributes = EnumSet.noneOf(PhoneticAttribute.class); final TurkishChar lastVowelChar = surface.getLastVowel(); final TurkishChar firstChar = surface.charAt(0); final TurkicLetter firstLetter = firstChar.getLetter(); final TurkishChar lastChar = surface.getLastChar(); final TurkicLetter lastLetter = lastChar.getLetter(); if (firstLetter.isVowel()) attributes.add(PhoneticAttribute.FirstLetterVowel); else attributes.add(PhoneticAttribute.FirstLetterConsonant); if (lastVowelChar != null) { final TurkicLetter lastVowelLetter = lastVowelChar.getLetter(); if (lastVowelLetter.isRounded()) attributes.add(PhoneticAttribute.LastVowelRounded); else attributes.add(PhoneticAttribute.LastVowelUnrounded); if (lastVowelLetter.isFrontal()) attributes.add(PhoneticAttribute.LastVowelFrontal); else attributes.add(PhoneticAttribute.LastVowelBack); } else { attributes.add(PhoneticAttribute.HasNoVowel); } if (lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVowel); else attributes.add(PhoneticAttribute.LastLetterConsonant); if (lastLetter.isVoiceless()) { attributes.add(PhoneticAttribute.LastLetterVoiceless); if (lastLetter.isStopConsonant() && !lastLetter.isVowel()) attributes.add(PhoneticAttribute.LastLetterVoicelessStop); } else { attributes.add(PhoneticAttribute.LastLetterNotVoiceless); } return attributes; }  EnumSet<PhoneticAttribute> calculatePhoneticAttributes(final String surface, Collection<LexemeAttribute> lexemeAttributes); EnumSet<PhoneticAttribute> calculatePhoneticAttributes(final TurkishSequence surface, Collection<LexemeAttribute> lexemeAttributes); ImmutableSet<PhoneticAttribute> calculateNewPhoneticAttributes(Set<PhoneticAttribute> phoneticAttributes, char charToApply); ImmutableSet<PhoneticAttribute> calculateNewPhoneticAttributes(ImmutableSet<PhoneticAttribute> phoneticAttributes, String suffixForm);  }