Xanda's Blog !~!

Installing Compact Language Detection 2 (CLD2) on Ubuntu

Apr
02

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

5 Responses to Installing Compact Language Detection 2 (CLD2) on Ubuntu

  1. 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 …

  2. 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!

  3. 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

  4. Pingback: Install CLD2 on Ubuntu 16.04 for apertium-apy – vee: ดิจิทัล

  5. Pingback: Installing CLD2 on Ubuntu 16.04 for apertium-apy – vee: ดิจิทัล

Leave a Reply

Your email address will not be published. Required fields are marked *