Ejemplo n.º 1
0
 /// <summary>
 /// Sets the number of maximum of phonemes that shall be considered by the engine.
 /// <para/>
 /// since 1.7
 /// </summary>
 /// <param name="maxPhonemes">the maximum number of phonemes returned by the engine</param>
 public virtual void SetMaxPhonemes(int maxPhonemes)
 {
     this.engine = new PhoneticEngine(this.engine.NameType,
                                      this.engine.RuleType,
                                      this.engine.IsConcat,
                                      maxPhonemes);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new <see cref="BeiderMorseFilter"/>
 /// </summary>
 /// <param name="input"><see cref="TokenStream"/> to filter</param>
 /// <param name="engine">Configured <see cref="PhoneticEngine"/> with BM settings.</param>
 /// <param name="languages">Optional Set of original languages. Can be <c>null</c> (which means it will be guessed).</param>
 public BeiderMorseFilter(TokenStream input, PhoneticEngine engine, LanguageSet languages)
     : base(input)
 {
     this.engine    = engine;
     this.languages = languages;
     this.termAtt   = AddAttribute <ICharTermAttribute>();
     this.posIncAtt = AddAttribute <IPositionIncrementAttribute>();
 }
Ejemplo n.º 3
0
        /// <summary>Creates a new <see cref="BeiderMorseFilterFactory"/></summary>
        public BeiderMorseFilterFactory(IDictionary<string, string> args)
                  : base(args)
        {
            // PhoneticEngine = NameType + RuleType + concat
            // we use common-codec's defaults: GENERIC + APPROX + true
            NameType nameType = (NameType)Enum.Parse(typeof(NameType), Get(args, "nameType", NameType.GENERIC.ToString()), true);
            RuleType ruleType = (RuleType)Enum.Parse(typeof(RuleType), Get(args, "ruleType", RuleType.APPROX.ToString()), true);

            bool concat = GetBoolean(args, "concat", true);
            engine = new PhoneticEngine(nameType, ruleType, concat);

            // LanguageSet: defaults to automagic, otherwise a comma-separated list.
            ISet<string> langs = GetSet(args, "languageSet");
            languageSet = (null == langs || (1 == langs.Count && langs.Contains("auto"))) ? null : LanguageSet.From(langs);
            if (!(args.Count == 0))
            {
                throw new ArgumentException("Unknown parameters: " + args);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Calls <see cref="BeiderMorseFilter(TokenStream, PhoneticEngine, LanguageSet)"/>
 /// </summary>
 /// <param name="input"><see cref="TokenStream"/> to filter</param>
 /// <param name="engine">Configured <see cref="PhoneticEngine"/> with BM settings.</param>
 public BeiderMorseFilter(TokenStream input, PhoneticEngine engine)
     : this(input, engine, null)
 {
 }