@Test public void testShouldRecognizeNumbersWithSignWithoutSuffixes() { { final List<Root> rootsForPartialInput = findRootsForPartialInput("-", "-1"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("-1", "-1"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("-1")); assertThat(rootsForPartialInput.get(0), hasCardinalDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("eksi bir")); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("+", "+3"); assertThat(rootsForPartialInput, hasSize(0)); } { final List<Root> rootsForPartialInput = findRootsForPartialInput("+3", "+3"); assertThat(rootsForPartialInput, hasSize(1)); assertThat(rootsForPartialInput.get(0), hasRootStr("+3")); assertThat(rootsForPartialInput.get(0), hasCardinalDigitLexeme()); assertThat(rootsForPartialInput.get(0), hasUnderlyingNumeralText("üç")); } }
@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);  }