/** * Sets the rule type to apply. This will widen or narrow the range of phonetic encodings considered. * * @param ruleType * {@link RuleType#APPROX} or {@link RuleType#EXACT} for approximate or exact phonetic matches */ public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the type of name. Use {@link NameType#GENERIC} unless you specifically want phonetic encodings * optimized for Ashkenazi or Sephardic Jewish family names. * * @param nameType * the NameType in use */ public void setNameType(final NameType nameType) { this.engine = new PhoneticEngine(nameType, this.engine.getRuleType(), this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the number of maximum of phonemes that shall be considered by the engine. * * @param maxPhonemes * the maximum number of phonemes returned by the engine * @since 1.7 */ public void setMaxPhonemes(final int maxPhonemes) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), this.engine.isConcat(), maxPhonemes); }
/** * Sets how multiple possible phonetic encodings are combined. * * @param concat * true if multiple encodings are to be combined with a '|', false if just the first one is * to be considered */ public void setConcat(final boolean concat) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), concat, this.engine.getMaxPhonemes()); }
@Test public void test() { final PhoneticEngine engine = new PhoneticEngine(NameType.GENERIC, RuleType.APPROX, true); final String input = "Angelo"; final long startMillis = System.currentTimeMillis(); for (int i = 0; i < LOOP; i++) { engine.encode(input); } final long totalMillis = System.currentTimeMillis() - startMillis; System.out.println(String.format("Time for encoding %,d times the input '%s': %,d millis.", LOOP, input, totalMillis)); } }
final RuleType ruleType = (ruleTypeArg == null) ? RuleType.APPROX : RuleType.valueOf(ruleTypeArg); engine = new PhoneticEngine(nameType, ruleType, concat);
@Test(timeout = 10000L) public void testEncode() { final PhoneticEngine engine = new PhoneticEngine(this.nameType, this.ruleType, this.concat, this.maxPhonemes); final String phoneticActual = engine.encode(this.name); //System.err.println("expecting: " + this.phoneticExpected); //System.err.println("actual: " + phoneticActual); assertEquals("phoneme incorrect", this.phoneticExpected, phoneticActual); if (this.concat) { final String[] split = phoneticActual.split("\\|"); assertTrue(split.length <= this.maxPhonemes); } else { final String[] words = phoneticActual.split("-"); for (final String word : words) { final String[] split = word.split("\\|"); assertTrue(split.length <= this.maxPhonemes); } } } }
/** * Sets the rule type to apply. This will widen or narrow the range of phonetic encodings considered. * * @param ruleType * {@link RuleType#APPROX} or {@link RuleType#EXACT} for approximate or exact phonetic matches */ public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the rule type to apply. This will widen or narrow the range of phonetic encodings considered. * * @param ruleType * {@link RuleType#APPROX} or {@link RuleType#EXACT} for approximate or exact phonetic matches */ public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets how multiple possible phonetic encodings are combined. * * @param concat * true if multiple encodings are to be combined with a '|', false if just the first one is * to be considered */ public void setConcat(final boolean concat) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), concat, this.engine.getMaxPhonemes()); }
/** * Sets the rule type to apply. This will widen or narrow the range of phonetic encodings considered. * * @param ruleType * {@link RuleType#APPROX} or {@link RuleType#EXACT} for approximate or exact phonetic matches */ public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the type of name. Use {@link NameType#GENERIC} unless you specifically want phonetic encodings * optimized for Ashkenazi or Sephardic Jewish family names. * * @param nameType * the NameType in use */ public void setNameType(final NameType nameType) { this.engine = new PhoneticEngine(nameType, this.engine.getRuleType(), this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the rule type to apply. This will widen or narrow the range of phonetic encodings considered. * * @param ruleType * {@link RuleType#APPROX} or {@link RuleType#EXACT} for approximate or exact phonetic matches */ public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the type of name. Use {@link NameType#GENERIC} unless you specifically want phonetic encodings * optimized for Ashkenazi or Sephardic Jewish family names. * * @param nameType * the NameType in use */ public void setNameType(final NameType nameType) { this.engine = new PhoneticEngine(nameType, this.engine.getRuleType(), this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the rule type to apply. This will widen or narrow the range of phonetic encodings considered. * * @param ruleType * {@link RuleType#APPROX} or {@link RuleType#EXACT} for approximate or exact phonetic matches */ public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), this.engine.getMaxPhonemes()); }
/** * Sets the number of maximum of phonemes that shall be considered by the engine. * * @param maxPhonemes * the maximum number of phonemes returned by the engine * @since 1.7 */ public void setMaxPhonemes(final int maxPhonemes) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), this.engine.isConcat(), maxPhonemes); }
/** * Sets how multiple possible phonetic encodings are combined. * * @param concat * true if multiple encodings are to be combined with a '|', false if just the first one is * to be considered */ public void setConcat(final boolean concat) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), concat, this.engine.getMaxPhonemes()); }
/** * Sets the number of maximum of phonemes that shall be considered by the engine. * * @param maxPhonemes * the maximum number of phonemes returned by the engine * @since 1.7 */ public void setMaxPhonemes(final int maxPhonemes) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), this.engine.isConcat(), maxPhonemes); }
/** * Sets the number of maximum of phonemes that shall be considered by the engine. * * @param maxPhonemes * the maximum number of phonemes returned by the engine * @since 1.7 */ public void setMaxPhonemes(final int maxPhonemes) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), this.engine.isConcat(), maxPhonemes); }
/** * Sets the type of name. Use {@link NameType#GENERIC} unless you specifically want phonetic encodings * optimized for Ashkenazi or Sephardic Jewish family names. * * @param nameType * the NameType in use */ public void setNameType(final NameType nameType) { this.engine = new PhoneticEngine(nameType, this.engine.getRuleType(), this.engine.isConcat(), this.engine.getMaxPhonemes()); }