Installing Compact Language Detection 2 (CLD2) on Ubuntu

Posted: April 2nd, 2014 | Author: | Filed under: IT Related | Tags: , , | 5 Comments »

I’ve been using chromium-compact-language-detector before, and when they moved to v2.0, chromium-compact-language-detector has been renamed in to Compact Language Detection 2 (CLD2). I’ve read blog post on the performance review and i’m really impressed. So let give them a try.

Install the dependencies:

sudo apt-get install mercurial gcc-multilib python-dev build-essential

Download CLD2 and the python binding:

cd /tmp/
svn checkout cld2
hg clone

Compile CLD2 and install the lib (for 32bit) :

cd /tmp/cld2/internal/
cat | sed 's/\ \-m64\ //g' >
chmod +x
sudo cp *.so /usr/lib/

Compile CLD2 and install the lib (for 64bit) :

cd /tmp/cld2/internal/
sudo cp *.so /usr/lib64/

Compile the python binding:

cd /tmp/chromium-compact-language-detector/
python build
python build
sudo python install
sudo python install

Give the library a test:


For documentation:

python -c "import cld2; help(cld2.detect)"

Done! Thanks