{"id":35062785,"url":"https://github.com/ropensci/cld2","last_synced_at":"2026-03-17T11:13:43.303Z","repository":{"id":55884470,"uuid":"93206736","full_name":"ropensci/cld2","owner":"ropensci","description":"R Wrapper for Google's Compact Language Detector 2","archived":false,"fork":false,"pushed_at":"2025-04-06T20:31:51.000Z","size":30570,"stargazers_count":38,"open_issues_count":7,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T21:29:24.954Z","etag":null,"topics":["cld","cld2","language-detection","language-detector","r","r-package","rstats"],"latest_commit_sha":null,"homepage":"https://docs.ropensci.org/cld2","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-02T21:56:32.000Z","updated_at":"2025-04-06T20:31:54.000Z","dependencies_parsed_at":"2025-03-22T20:33:31.884Z","dependency_job_id":null,"html_url":"https://github.com/ropensci/cld2","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ropensci/cld2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fcld2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fcld2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fcld2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fcld2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/cld2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2Fcld2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30622482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T08:10:05.930Z","status":"ssl_error","status_checked_at":"2026-03-17T08:10:04.972Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cld","cld2","language-detection","language-detector","r","r-package","rstats"],"created_at":"2025-12-27T10:55:48.438Z","updated_at":"2026-03-17T11:13:43.297Z","avatar_url":"https://github.com/ropensci.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cld2\n\n##### *R Wrapper for Google's Compact Language Detector 2*\n\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n[![Build Status](https://app.travis-ci.com/ropensci/cld2.svg?branch=master)](https://app.travis-ci.com/ropensci/cld2)\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/ropensci/cld2?branch=master\u0026svg=true)](https://ci.appveyor.com/project/jeroen/cld2)\n[![Coverage Status](https://codecov.io/github/ropensci/cld2/coverage.svg?branch=master)](https://app.codecov.io/github/ropensci/cld2?branch=master)\n[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/cld2)](https://cran.r-project.org/package=cld2)\n[![CRAN RStudio mirror downloads](http://cranlogs.r-pkg.org/badges/cld2)](https://cran.r-project.org/package=cld2)\n[![Github Stars](https://img.shields.io/github/stars/ropensci/cld2.svg?style=social\u0026label=Github)](https://github.com/ropensci/cld2)\n\n\u003e CLD2 probabilistically detects over 80 languages in Unicode UTF-8 text, either \n  plain text or HTML/XML. For mixed-language input, CLD2 returns the top three languages found\n  and their approximate percentages of the total text bytes (e.g. 80% English and 20% French \n  out of 1000 bytes)\n\n## Installation\n\nThis package includes a bundled version of libcld2:\n\n```r\ndevtools::install_github(\"ropensci/cld2\")\n```\n\n## Guess a Language\n\nThe function `detect_language()` returns the best guess or NA if the language could not reliablity be determined. \n\n```r\ncld2::detect_language(\"To be or not to be\")\n# [1] \"ENGLISH\"\n\ncld2::detect_language(\"Ce n'est pas grave.\")\n# [1] \"FRENCH\"\n\ncld2::detect_language(\"Nou breekt mijn klomp!\")\n# [1] \"DUTCH\"\n```\n\nSet `plain_text = FALSE` if your input contains HTML:\n\n```r\ncld2::detect_language(url('http://www.un.org/ar/universal-declaration-human-rights/'), plain_text = FALSE)\n# [1] \"ARABIC\"\n\ncld2::detect_language(url('http://www.un.org/zh/universal-declaration-human-rights/'), plain_text = FALSE)\n# [1] \"CHINESE\"\n```\n\nUse `detect_language_multi()` to get detailed classification output.\n\n```r\ndetect_language_multi(url('http://www.un.org/fr/universal-declaration-human-rights/'), plain_text = FALSE)\n# $classification\n#   language code latin proportion\n# 1   FRENCH   fr  TRUE       0.96\n# 2  ENGLISH   en  TRUE       0.03\n# 3   ARABIC   ar FALSE       0.00\n# \n# $bytes\n# [1] 17008\n# \n# $reliabale\n# [1] TRUE\n```\nThis shows the top 3 language guesses and the proportion of text that was classified as this language.\nThe `bytes` attribute shows the total number of text bytes that was classified, and `reliable` is a \ncomplex calculation on if the #1 language is some amount more probable then the second-best Language.\n \n[![](https://ropensci.org//public_images/github_footer.png)](https://ropensci.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fcld2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Fcld2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fcld2/lists"}