@Test public void testShouldRecognizeSimpleNumbersWithoutSuffixes() { { final List<Root> rootsForPartialInput = findRootsForPartialInput("", "13"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("3", "13"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("13", "13"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("13")); assertThat(rootsForPartialInput.get(0), hasCardinalDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("on üç")); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("0", "0"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("0")); assertThat(rootsForPartialInput.get(0), hasCardinalDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("sıfır")); } }
@Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = digitsToTextConverter.convert(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.DigitsCardinal, phoneticAttributes)); }
CardinalDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = digitsToTextConverter.convert(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.DigitsCardinal, phoneticAttributes)); } }
CardinalDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = digitsToTextConverter.convert(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.DigitsCardinal, phoneticAttributes)); } CardinalDigitsRootFinder(); }
CardinalDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = digitsToTextConverter.convert(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.DigitsCardinal, phoneticAttributes)); } CardinalDigitsRootFinder(); @Override boolean handles(TurkishSequence partialInput, TurkishSequence input); @Override List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input); }
CardinalDigitsRootFinder implements RootFinder { @Override public List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input) { final String partialInputUnderlyingString = partialInput.getUnderlyingString(); final String underlyingNumeralText = digitsToTextConverter.convert(partialInputUnderlyingString); final ImmutableSet<PhoneticAttribute> phoneticAttributes = ImmutableSet.copyOf(this.phoneticsAnalyzer.calculatePhoneticAttributes(underlyingNumeralText, null)); return Arrays.asList((Root) new NumeralRoot(partialInput, underlyingNumeralText, SecondaryPos.DigitsCardinal, phoneticAttributes)); } CardinalDigitsRootFinder(); @Override boolean handles(TurkishSequence partialInput, TurkishSequence input); @Override List<Root> findRootsForPartialInput(final TurkishSequence partialInput, final TurkishSequence input);  }