Installing Compact Language Detection 2 (CLD2) on Ubuntu
Posted: April 2nd, 2014 | Author: xanda | Filed under: IT Related | Tags: cld, cld2, ubuntu | 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 http://cld2.googlecode.com/svn/trunk/ cld2 hg clone https://code.google.com/p/chromium-compact-language-detector/ |
Compile CLD2 and install the lib (for 32bit) :
cd /tmp/cld2/internal/ cat compile_libs.sh | sed 's/\ \-m64\ //g' > compile_me.sh chmod +x compile_me.sh ./compile_me.sh sudo cp *.so /usr/lib/ |
Compile CLD2 and install the lib (for 64bit) :
cd /tmp/cld2/internal/ ./compile_libs.sh sudo cp *.so /usr/lib64/ |
Compile the python binding:
cd /tmp/chromium-compact-language-detector/ python setup.py build python setup_full.py build sudo python setup.py install sudo python setup_full.py install |
Give the library a test:
python test.py |
For documentation:
python -c "import cld2; help(cld2.detect)" |
Done! Thanks
Thank you for this tutorial, it works perfectly !
question, how to interface with PHP ?
I searched the documentation, but I can not find anything with CLD2 …
Hi, thanks for your detailed instruction. I really appreciate it. Unfortunately, my installation has still been unsuccessful. Here’s the error I am getting when I start compiling the python binding:
`pkg-config –libs –cflags cld` returns in error:
Package cld was not found in the pkg-config search path.
Perhaps you should add the directory containing `cld.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘cld’ found
The `cld` C++ library is absent from this system. Please install it.
Any help/suggestion will be greatly appreciated.
Cheers!
Hi, thanks for your tutorial, but I have an error with the command :
python setup_full.py build
pycldmodule.cc:22:30: fatal error: compact_lang_det.h: Aucun fichier ou dossier de ce type
[…] http://blog.xanda.org/2014/04/02/installing-compact-language-detection-2-cld2-on-ubuntu/ I wrote a script for Ubuntu 16.04 sudo apt-get install libcld2-dev git clone […]
[…] http://blog.xanda.org/2014/04/02/installing-compact-language-detection-2-cld2-on-ubuntu/ I wrote a script for Ubuntu 16.04 sudo apt-get install libcld2-dev git clone […]