@Test public void shouldGenerateRootsForWordsEndingWithArabicAyn() { { final Lexeme lexeme = new ImmutableLexeme("cami", "cami", PrimaryPos.Noun, null, ImmutableSet.of(LexemeAttribute.EndsWithAyn)); final HashSet<ImmutableRoot> generatedRoots = generator.generate(lexeme); assertThat(generatedRoots, hasSize(2)); assertThat(generatedRoots, hasItem(new ImmutableRoot("cami", lexeme, ImmutableSet.of(FLC, LVF, LLC, LLNotVless, LVU), ImmutableSet.of(PhoneticExpectation.VowelStart)))); assertThat(generatedRoots, hasItem(new ImmutableRoot("cami", lexeme, ImmutableSet.of(FLC, LVF, LLV, LLNotVless, LVU), null))); } { final Lexeme lexeme = new ImmutableLexeme("abcde", "abcde", PrimaryPos.Noun, null, ImmutableSet.of(LexemeAttribute.EndsWithAyn, LexemeAttribute.InverseHarmony)); final HashSet<ImmutableRoot> generatedRoots = generator.generate(lexeme); assertThat(generatedRoots, hasSize(2)); assertThat(generatedRoots, hasItem(new ImmutableRoot("abcde", lexeme, ImmutableSet.of(FLV, LVF, LLC, LLNotVless, LVU), ImmutableSet.of(PhoneticExpectation.VowelStart)))); assertThat(generatedRoots, hasItem(new ImmutableRoot("abcde", lexeme, ImmutableSet.of(FLV, LVF, LLV, LLNotVless, LVU), null))); } }
public HashSet<ImmutableRoot> generate(final Lexeme lexeme) { if (CollectionUtils.containsAny(lexeme.getAttributes(), MODIFIERS_TO_WATCH)) { return this.generateModifiedRootNodes(lexeme); } else { Set<PhoneticAttribute> phoneticAttributes = phoneticsAnalyzer.calculatePhoneticAttributes(lexeme.getLemmaRoot(), lexeme.getAttributes()); final ImmutableRoot root = new ImmutableRoot(lexeme.getLemmaRoot(), lexeme, Sets.immutableEnumSet(phoneticAttributes), null); return Sets.newHashSet(root); } }
ImmutableRootGenerator { public HashSet<ImmutableRoot> generate(final Lexeme lexeme) { if (CollectionUtils.containsAny(lexeme.getAttributes(), MODIFIERS_TO_WATCH)) { return this.generateModifiedRootNodes(lexeme); } else { Set<PhoneticAttribute> phoneticAttributes = phoneticsAnalyzer.calculatePhoneticAttributes(lexeme.getLemmaRoot(), lexeme.getAttributes()); final ImmutableRoot root = new ImmutableRoot(lexeme.getLemmaRoot(), lexeme, Sets.immutableEnumSet(phoneticAttributes), null); return Sets.newHashSet(root); } } }
ImmutableRootGenerator { public HashSet<ImmutableRoot> generate(final Lexeme lexeme) { if (CollectionUtils.containsAny(lexeme.getAttributes(), MODIFIERS_TO_WATCH)) { return this.generateModifiedRootNodes(lexeme); } else { Set<PhoneticAttribute> phoneticAttributes = phoneticsAnalyzer.calculatePhoneticAttributes(lexeme.getLemmaRoot(), lexeme.getAttributes()); final ImmutableRoot root = new ImmutableRoot(lexeme.getLemmaRoot(), lexeme, Sets.immutableEnumSet(phoneticAttributes), null); return Sets.newHashSet(root); } }  }
ImmutableRootGenerator { public HashSet<ImmutableRoot> generate(final Lexeme lexeme) { if (CollectionUtils.containsAny(lexeme.getAttributes(), MODIFIERS_TO_WATCH)) { return this.generateModifiedRootNodes(lexeme); } else { Set<PhoneticAttribute> phoneticAttributes = phoneticsAnalyzer.calculatePhoneticAttributes(lexeme.getLemmaRoot(), lexeme.getAttributes()); final ImmutableRoot root = new ImmutableRoot(lexeme.getLemmaRoot(), lexeme, Sets.immutableEnumSet(phoneticAttributes), null); return Sets.newHashSet(root); } }  Collection<ImmutableRoot> generateAll(final Set<Lexeme> lexemes); HashSet<ImmutableRoot> generate(final Lexeme lexeme); }
ImmutableRootGenerator { public HashSet<ImmutableRoot> generate(final Lexeme lexeme) { if (CollectionUtils.containsAny(lexeme.getAttributes(), MODIFIERS_TO_WATCH)) { return this.generateModifiedRootNodes(lexeme); } else { Set<PhoneticAttribute> phoneticAttributes = phoneticsAnalyzer.calculatePhoneticAttributes(lexeme.getLemmaRoot(), lexeme.getAttributes()); final ImmutableRoot root = new ImmutableRoot(lexeme.getLemmaRoot(), lexeme, Sets.immutableEnumSet(phoneticAttributes), null); return Sets.newHashSet(root); } }  Collection<ImmutableRoot> generateAll(final Set<Lexeme> lexemes); HashSet<ImmutableRoot> generate(final Lexeme lexeme);  }