<p>It's not fullproof but you can try several language identification tools.</p>

<h1>Using <code>langid.py</code></h1>

<p>One of the most popular and easiest to use, being <code>langid.py</code> <a href="https://github.com/saffsd/langid.py" rel="nofollow noreferrer">https://github.com/saffsd/langid.py</a></p>

<p>To install: <code>python -m pip install -U langid</code></p>

<pre class="lang-py prettyprint-override"><code>&gt;&gt;&gt; import langid

&gt;&gt;&gt; text = "Hallo, wie gehts?"
&gt;&gt;&gt; lang, log_prob = langid.classify(text)
&gt;&gt;&gt; print(lang)
de
</code></pre>

<h1>Using <code>pyCLD2</code></h1>

<p>The <code>pycld2</code> is a wrapper around <code>chromium-compact-language-detector</code>, see <a href="https://github.com/aboSamoor/pycld2" rel="nofollow noreferrer">https://github.com/aboSamoor/pycld2</a></p>

<p>Install: <code>python -m pip install -U pycld2</code></p>

<pre><code>&gt;&gt;&gt; import pycld2 as cld2

&gt;&gt;&gt; text = "Hallo, wie gehts?"

&gt;&gt;&gt; isReliable, textBytesFound, details = cld2.detect(text)
&gt;&gt;&gt; lang = details[0][1]
&gt;&gt;&gt; print(lang)
de
</code></pre>

<h1>Using <code>cld3</code></h1>

<p>Install: <code>python -m pip install -U pycld3</code></p>

<pre><code>&gt;&gt;&gt; import cld3

&gt;&gt;&gt; text = "Hallo, wie gehts?"

&gt;&gt;&gt; prediction = cld3.get_language(text)
&gt;&gt;&gt; print(prediction.language)
de
</code></pre>

<p>Here's a pretty nice recent summary (2019) from <a href="https://arxiv.org/pdf/1910.06748.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1910.06748.pdf</a></p>
How to detect the language of a text (.csv) by its title using Python?
<p>For a research-purpose work I should:</p>

<ol>
<li>Read a .csv file</li>
<li>Detect the language of the text by the title</li>
<li>Identifying the argument of the text by some keywords
ex. lobotomy --> brain</li>
</ol>

<p>I am trying to do the 2nd and 3rd point using Python with its library NLTK,
Could you give me some tips if you ever did something like it?</p>

<p>Thank you in advance!</p>