Wolfram Language

Open live version

Determine the Language of a Text

Make a function that determines the language that a text is written in.


code

X
X

how it works

Samples of texts in various languages are abundant on the web. Import French, English, German, and Spanish texts to use to train a classifier:

In[1]:=
X

This is what the beginning of the French text looks like:

In[2]:=
X
Out[2]=

Make a classifier function using the training texts:

In[3]:=
X
Out[3]=

Test the classifier on texts that were not in the training set:

In[4]:=
X
Out[4]=

Make a table of classified phrases:

In[5]:=
X
Out[5]=