Beispiel #1
0
 /// <summary>
 /// Gets rules for a combination of name type, rule type and languages.
 /// <para/>
 /// since 1.9
 /// </summary>
 /// <param name="nameType">The <see cref="NameType"/> to consider.</param>
 /// <param name="rt">The <see cref="RuleType"/> to consider.</param>
 /// <param name="langs">The set of languages to consider.</param>
 /// <returns>A map containing all <see cref="Rule"/>s that apply, grouped by the first character of the rule pattern.</returns>
 public static IDictionary <string, IList <Rule> > GetInstanceMap(NameType nameType, RuleType rt,
                                                                  LanguageSet langs)
 {
     return(langs.IsSingleton ? GetInstanceMap(nameType, rt, langs.GetAny()) :
            GetInstanceMap(nameType, rt, Languages.ANY));
 }
Beispiel #2
0
        /// <summary>
        /// Guesses the language of a word.
        /// </summary>
        /// <param name="text">The word.</param>
        /// <returns>The language that the word originates from or <see cref="Languages.ANY"/> if there was no unique match.</returns>
        public virtual string GuessLanguage(string text)
        {
            LanguageSet ls = GuessLanguages(text);

            return(ls.IsSingleton ? ls.GetAny() : Languages.ANY);
        }