"LanguageExtended" (Built-in Classifier)
Classes
Examples
open all close allBasic Examples (2)
Determine the languages of a list of examples:
Classify["LanguageExtended", {"the house is blue", "la maison est bleue", "la casa es azul", "das Haus ist blau", "號寫正嗰一部長篇小說", "المنزل باللون الأزرق", "будинок синій", "ตรชายของอั", "ܝܐ ܕܩܐܡܦ ܢ", "גלעד. אור ", "մութիւններ", "ားကို အထူး", "и пщым и у", "성적 욕망에 대한 ", "лакьысра"}]Obtain the probabilities for the most likely languages:
Classify["LanguageExtended", "منزل ", "TopProbabilities" -> 3]Obtain a ClassifierFunction for this classifier:
c = Classify["LanguageExtended"]Apply the classifier to a list of texts:
c[{"the house is blue", "la maison est bleue", "la casa es azul", "das Haus ist blau", "در زندگی زخمهای هست", "房子是蓝色的", "المنزل باللون الأزرق", "будинок синій"}]Scope (2)
Load the ClassifierFunction corresponding to the built-in classifier:
c = Classify["LanguageExtended"]Short[Information[c, "Classes"], 1]Load the ClassifierFunction corresponding to the built-in classifier:
c = Classify["LanguageExtended"]Apply the classifier to a list of text samples:
textsamples = {"the house is blue", "la maison est bleue", "la casa es azul", "das Haus ist blau", "號寫正嗰一部長篇小說", "المنزل باللون الأزرق", "будинок синій", "ตรชายของอั", "גלעד. אור ", "մութիւններ", "и пщым и у", "성적 욕망에 대한 "};
c[textsamples]Transliterate sample texts and apply the classifier to the transliterated texts:
trsamples = Transliterate[textsamples]
c[trsamples]Options (3)
ClassPriors (1)
Use a custom ClassPriors to restrict the possible outputs:
Classify["LanguageExtended", {"What is this language?", "Qué idioma es ese?", "Quelle est cette langue?"}, ClassPriors -> <|Entity["Language", "English::385w8"] -> 0.5, Entity["Language", "Spanish::77gfp"] -> 0.5|>]IndeterminateThreshold (1)
Use a custom IndeterminateThreshold:
Classify["LanguageExtended", "منزل", IndeterminateThreshold -> 0.9]UtilityFunction (1)
Obtain the utility function of the classifier:
utility = Information[Classify["LanguageExtended"], "UtilityFunction"];Modify this utility function to penalize
being misclassified as
:
utility[Entity["Language", "Persian::48q57"], Entity["Language", "Bakhtiari::tw2cx"]] = -4;Classify the text using this new utility:
Classify["LanguageExtended", "مردم", UtilityFunction -> utility]Compare to the result with the default utility:
Classify["LanguageExtended", "مردم"]Possible Issues (1)
Neat Examples (1)
Obtain different possible languages with their corresponding probabilities:
possiblelanguages = Classify["LanguageExtended", "Zu meiner Familie gehören außer mir noch drei weitere Personen", "Probabilities"];Visualize the result using WordCloud:
WordCloud[possiblelanguages]See Also
LanguageIdentify Classify TextCases TextTranslation Transliterate Language
Classifiers: Language FacebookTopic Sentiment ProgrammingLanguage
Related Guides
History
Introduced in 2020 (12.1)