Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import NaturalLanguage
let string1 = """
Hello world, I love machine learning and I work as a Data Scientist in India.
let string2 = " أحب العمل في التعلم الآلي"
// Initialize LanguageRecognizer
let languageRecog = NLLanguageRecognizer()
// find the dominant language
print("Dominant language is: \(languageRecog.dominantLanguage?.rawValue)")
// identify the possible languages
print("Possible languages are:\(languageRecog.languageHypotheses(withMaximum: 2))")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment