@Test public void shouldParseMultiPartRanges() { { final List<Root> rootsForPartialInput = findRootsForPartialInput("1-2-3", "1-2-3"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("1-2-3")); assertThat(rootsForPartialInput.get(0), hasRangeDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("bir iki üç")); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("1-2-3-4-5", "1-2-3-4-5"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("1-2-3-4-5")); assertThat(rootsForPartialInput.get(0), hasRangeDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("bir iki üç dört beş")); } }
@Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } RangeDigitsRootFinder(); }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } RangeDigitsRootFinder(); @Override boolean handles(TurkishSequence partialInput, TurkishSequence input); @Override List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input); }
RangeDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = this.getUnderlyingNumeralTextForRange(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.Range, phoneticAttributes)); } RangeDigitsRootFinder(); @Override boolean handles(TurkishSequence partialInput, TurkishSequence input); @Override List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input);  }