Google's Compact Language Detector 2

Bindings to Google's C++ library Compact Language Detector 2 (see <> for more information). Probabilistically detects over 80 languages in plain text or HTML. For mixed-language input it returns the top three detected languages and their approximate proportion of the total classified text bytes (e.g. 80% English and 20% French out of 1000 bytes). There is also a 'cld3' package on CRAN which uses a neural network model instead.



  • detect_language() is now vectorized
  • detect_language() now returns codes by default to be compatible with 'cld3'
  • detect_language_multi() has been renamed to detect_language_mixed()


  • Initial CRAN release

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.2 by Jeroen Ooms, 3 months ago (devel) (upstream)

Browse source code at

Authors: Jeroen Ooms [aut, cre] (<>), Dirk Sites [cph] (Author of CLD2 C++ library)

Documentation:   PDF Manual  

Apache License 2.0 license

Imports Rcpp

Suggests testthat, readtext, cld3

Linking to Rcpp

Suggested by cld3, googleLanguageR.

See at CRAN