@Test public void shouldRangesWithSuffixes() { { final List<Root> rootsForPartialInput = findRootsForPartialInput("1-2", "1-2."); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("1-2")); assertThat(rootsForPartialInput.get(0), hasRangeDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("bir iki")); } { } { final List<Root> rootsForPartialInput = findRootsForPartialInput("1.000-10.000", "1.000-10.000."); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("1.000-10.000")); assertThat(rootsForPartialInput.get(0), hasRangeDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("bin on bin")); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("1000-100.000", "1000-100.000'de"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("1000-100.000")); assertThat(rootsForPartialInput.get(0), hasRangeDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("bin yüz bin")); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("2-3", "2-3.'de"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("2-3")); assertThat(rootsForPartialInput.get(0), hasRangeDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("iki üç")); } }
@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);  }