@Test public void shouldNotAddRequiredTransitions_forProgressiveVowelDrop_whenRootStrIsNotProgressiveDropOne() throws Exception { String rootStr = "ata"; String lemmaRootStr = "ata"; String lemmaStr = "atamak"; final ImmutableSet<PhoneticAttribute> phoneticAttributes = Sets.immutableEnumSet(new PhoneticsAnalyzer().calculatePhoneticAttributes(rootStr, null)); final ImmutableSet<PhoneticExpectation> phoneticExpectations = ImmutableSet.of(PhoneticExpectation.VowelStart); final Lexeme lexeme = new ImmutableLexeme(lemmaStr, lemmaRootStr, PrimaryPos.Verb, null, ImmutableSet.of(LexemeAttribute.ProgressiveVowelDrop, LexemeAttribute.NoVoicing)); final ImmutableRoot root = new ImmutableRoot(rootStr, lexeme, phoneticAttributes, phoneticExpectations); final MorphemeContainer morphemeContainer = new MorphemeContainer(root, this.suffixGraph.getSuffixGraphState("VERB_ROOT"), "ıyorum"); final List<MorphemeContainer> retrievedList = transitionApplier.applyMandatoryTransitionsToMorphemeContainers(Arrays.asList(morphemeContainer), new TurkishSequence("atıyorum")); assertThat(retrievedList, hasSize(1)); assertThat(retrievedList.get(0), sameInstance(morphemeContainer)); }
public List<MorphemeContainer> applyMandatoryTransitionsToMorphemeContainers(final List<MorphemeContainer> morphemeContainers, final TurkishSequence input) { final List<MorphemeContainer> newMorphemeContainers = new LinkedList<MorphemeContainer>(); for (MorphemeContainer morphemeContainer : morphemeContainers) { MorphemeContainer newMorhpemeContainer = morphemeContainer; for (MandatoryTransitionRule mandatoryTransitionRule : this.mandatoryTransitionRules) { if (!mandatoryTransitionRule.getCondition().isSatisfiedBy(newMorhpemeContainer)) continue; if (!mandatoryTransitionRule.getSourceState().equals(newMorhpemeContainer.getLastState())) continue; for (MandatoryTransitionRuleStep mandatoryTransitionRuleStep : mandatoryTransitionRule.getMandatoryTransitionRuleSteps()) { newMorhpemeContainer = applyRequiredTransitionRuleStepToMorphemeContainer(newMorhpemeContainer, mandatoryTransitionRuleStep, input); if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer != null) newMorphemeContainers.add(newMorhpemeContainer); } return newMorphemeContainers; }
MandatoryTransitionApplier { public List<MorphemeContainer> applyMandatoryTransitionsToMorphemeContainers(final List<MorphemeContainer> morphemeContainers, final TurkishSequence input) { final List<MorphemeContainer> newMorphemeContainers = new LinkedList<MorphemeContainer>(); for (MorphemeContainer morphemeContainer : morphemeContainers) { MorphemeContainer newMorhpemeContainer = morphemeContainer; for (MandatoryTransitionRule mandatoryTransitionRule : this.mandatoryTransitionRules) { if (!mandatoryTransitionRule.getCondition().isSatisfiedBy(newMorhpemeContainer)) continue; if (!mandatoryTransitionRule.getSourceState().equals(newMorhpemeContainer.getLastState())) continue; for (MandatoryTransitionRuleStep mandatoryTransitionRuleStep : mandatoryTransitionRule.getMandatoryTransitionRuleSteps()) { newMorhpemeContainer = applyRequiredTransitionRuleStepToMorphemeContainer(newMorhpemeContainer, mandatoryTransitionRuleStep, input); if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer != null) newMorphemeContainers.add(newMorhpemeContainer); } return newMorphemeContainers; } }
MandatoryTransitionApplier { public List<MorphemeContainer> applyMandatoryTransitionsToMorphemeContainers(final List<MorphemeContainer> morphemeContainers, final TurkishSequence input) { final List<MorphemeContainer> newMorphemeContainers = new LinkedList<MorphemeContainer>(); for (MorphemeContainer morphemeContainer : morphemeContainers) { MorphemeContainer newMorhpemeContainer = morphemeContainer; for (MandatoryTransitionRule mandatoryTransitionRule : this.mandatoryTransitionRules) { if (!mandatoryTransitionRule.getCondition().isSatisfiedBy(newMorhpemeContainer)) continue; if (!mandatoryTransitionRule.getSourceState().equals(newMorhpemeContainer.getLastState())) continue; for (MandatoryTransitionRuleStep mandatoryTransitionRuleStep : mandatoryTransitionRule.getMandatoryTransitionRuleSteps()) { newMorhpemeContainer = applyRequiredTransitionRuleStepToMorphemeContainer(newMorhpemeContainer, mandatoryTransitionRuleStep, input); if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer != null) newMorphemeContainers.add(newMorhpemeContainer); } return newMorphemeContainers; } MandatoryTransitionApplier(final SuffixGraph suffixGraph, final SuffixApplier suffixApplier); }
MandatoryTransitionApplier { public List<MorphemeContainer> applyMandatoryTransitionsToMorphemeContainers(final List<MorphemeContainer> morphemeContainers, final TurkishSequence input) { final List<MorphemeContainer> newMorphemeContainers = new LinkedList<MorphemeContainer>(); for (MorphemeContainer morphemeContainer : morphemeContainers) { MorphemeContainer newMorhpemeContainer = morphemeContainer; for (MandatoryTransitionRule mandatoryTransitionRule : this.mandatoryTransitionRules) { if (!mandatoryTransitionRule.getCondition().isSatisfiedBy(newMorhpemeContainer)) continue; if (!mandatoryTransitionRule.getSourceState().equals(newMorhpemeContainer.getLastState())) continue; for (MandatoryTransitionRuleStep mandatoryTransitionRuleStep : mandatoryTransitionRule.getMandatoryTransitionRuleSteps()) { newMorhpemeContainer = applyRequiredTransitionRuleStepToMorphemeContainer(newMorhpemeContainer, mandatoryTransitionRuleStep, input); if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer != null) newMorphemeContainers.add(newMorhpemeContainer); } return newMorphemeContainers; } MandatoryTransitionApplier(final SuffixGraph suffixGraph, final SuffixApplier suffixApplier); List<MorphemeContainer> applyMandatoryTransitionsToMorphemeContainers(final List<MorphemeContainer> morphemeContainers, final TurkishSequence input); }
MandatoryTransitionApplier { public List<MorphemeContainer> applyMandatoryTransitionsToMorphemeContainers(final List<MorphemeContainer> morphemeContainers, final TurkishSequence input) { final List<MorphemeContainer> newMorphemeContainers = new LinkedList<MorphemeContainer>(); for (MorphemeContainer morphemeContainer : morphemeContainers) { MorphemeContainer newMorhpemeContainer = morphemeContainer; for (MandatoryTransitionRule mandatoryTransitionRule : this.mandatoryTransitionRules) { if (!mandatoryTransitionRule.getCondition().isSatisfiedBy(newMorhpemeContainer)) continue; if (!mandatoryTransitionRule.getSourceState().equals(newMorhpemeContainer.getLastState())) continue; for (MandatoryTransitionRuleStep mandatoryTransitionRuleStep : mandatoryTransitionRule.getMandatoryTransitionRuleSteps()) { newMorhpemeContainer = applyRequiredTransitionRuleStepToMorphemeContainer(newMorhpemeContainer, mandatoryTransitionRuleStep, input); if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer == null) break; } if (newMorhpemeContainer != null) newMorphemeContainers.add(newMorhpemeContainer); } return newMorphemeContainers; } MandatoryTransitionApplier(final SuffixGraph suffixGraph, final SuffixApplier suffixApplier); List<MorphemeContainer> applyMandatoryTransitionsToMorphemeContainers(final List<MorphemeContainer> morphemeContainers, final TurkishSequence input);  }