{"id":19866605,"url":"https://github.com/deradon/that_language","last_synced_at":"2025-10-15T22:06:42.236Z","repository":{"id":62558871,"uuid":"47547719","full_name":"Deradon/that_language","owner":"Deradon","description":"Detect language of given text","archived":false,"fork":false,"pushed_at":"2016-08-02T23:02:11.000Z","size":5162,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T23:13:19.400Z","etag":null,"topics":["language","ruby","ruby-gem","rubygem","that-language"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Deradon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-07T11:19:46.000Z","updated_at":"2016-07-04T23:57:49.000Z","dependencies_parsed_at":"2022-11-03T11:15:42.113Z","dependency_job_id":null,"html_url":"https://github.com/Deradon/that_language","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deradon%2Fthat_language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deradon%2Fthat_language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deradon%2Fthat_language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deradon%2Fthat_language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deradon","download_url":"https://codeload.github.com/Deradon/that_language/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251998081,"owners_count":21677920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["language","ruby","ruby-gem","rubygem","that-language"],"created_at":"2024-11-12T15:26:34.100Z","updated_at":"2025-10-15T22:06:37.169Z","avatar_url":"https://github.com/Deradon.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/Deradon/that_language.svg?branch=master)](https://travis-ci.org/Deradon/that_language)\n\n# ThatLanguage\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'that_language'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install that_language\n\n## Examples\n\n```ruby\ntext = \"This is just a random english sentence.\"\n\n## == Language\n\n  ThatLanguage.language(text)\n  # =\u003e :English\n\n\n## == LanguageCode\n\n  ThatLanguage.language_code(text)\n  # =\u003e \"en\"\n\n\n## == Detect\n\n  detect = ThatLanguage.detect(text)\n  # =\u003e #\u003cThatLanguage::Result:...\n\n  detect.language\n  # =\u003e :English\n\n  detect.language_code\n  # =\u003e \"en\"\n\n  detect.confidence\n  # =\u003e 0.5631093821386951\n\n  detect.to_h\n  # =\u003e\n  # {\n  #   language: :English,\n  #   language_code: \"en\",\n  #   confidence: 0.5631093821386951,\n  #   value: 3.9417656749708656,\n  #   hit_ratio: 0.8571428571428571,\n  #   hit_count: 6,\n  #   words_count: 7\n  # }\n\n\n## == Details\n\n  details = ThatLanguage.details(text)\n  # =\u003e #\u003cThatLanguage::ResultSet:...\n\n  winner = details.winner\n  # =\u003e #\u003cThatLanguage::Result:...\n\n  results = details.results\n  # =\u003e [#\u003cThatLanguage::Result, #\u003cThatLanguage::Result, ...]\n\n  details.to_h\n  # =\u003e\n  # {\n  #   \"results\" =\u003e [\n  #     {\n  #       language: :English,\n  #       language_code: \"en\",\n  #       confidence: 0.5631093821386951,\n  #       value: 3.9417656749708656,\n  #       hit_ratio: 0.8571428571428571,\n  #       hit_count: 6,\n  #       words_count: 7\n  #     },\n  #     {\n  #       language: :Hungarian,\n  #       language_code: \"hu\",\n  #       confidence: 0.21380816083786156,\n  #       value: 1.496657125865031,\n  #       hit_ratio: 0.42857142857142855,\n  #       hit_count: 3,\n  #       words_count: 7\n  #     },\n  #     # ...\n  #   ]\n  # }\n```\n\n## Supported locales\n\n```ruby\nrequire 'pp'\n\npp ThatLanguage.available\n\n{\n  ak: :Akan,\n  am: :Amharic,\n  ar: :Arabic,\n  as: :Assamese,\n  az: :Azerbaijani,\n  be: :Belarusian,\n  bn: :Bengali,\n  cs: :Czech,\n  da: :Danish,\n  de: :German,\n  el: :Greek,\n  en: :English,\n  es: :Spanish,\n  fa: :Persian,\n  ff: :Fula,\n  fi: :Finnish,\n  fr: :French,\n  gu: :Gujarati,\n  ha: :Hausa,\n  he: :Hebrew,\n  hi: :Hindi,\n  ht: :Haitian,\n  hu: :Hungarian,\n  it: :Italian,\n  ja: :Japanese,\n  jv: :Javanese,\n  kk: :Kazakh,\n  km: :Khmer,\n  kn: :Kannada,\n  ko: :Korean,\n  ku: :Kurdish,\n  mg: :Malagasy,\n  mr: :Marathi,\n  ms: :Malay,\n  my: :Burmese,\n  ne: :Nepali,\n  nl: :Dutch,\n  nn: :\"Norwegian Nynorsk\",\n  no: :Norwegian,\n  ny: :Chichewa,\n  om: :Oromo,\n  or: :Oriya,\n  pa: :Panjabi,\n  pl: :Polish,\n  ps: :Pashto,\n  pt: :Portuguese,\n  qu: :Quechua,\n  rn: :Kirundi,\n  ro: :Romanian,\n  ru: :Russian,\n  rw: :Kinyarwanda,\n  sd: :Sindhi,\n  si: :Sinhala,\n  sn: :Shona,\n  so: :Somali,\n  su: :Sundanese,\n  sv: :Swedish,\n  ta: :Tamil,\n  te: :Telugu,\n  th: :Thai,\n  tk: :Turkmen,\n  tl: :Tagalog,\n  tr: :Turkish,\n  ug: :Uyghur,\n  uk: :Ukrainian,\n  ur: :Urdu,\n  uz: :Uzbek,\n  vi: :Vietnamese,\n  xh: :Xhosa,\n  yo: :Yoruba,\n  zh: :Chinese,\n  zu: :Zulu\n}\n\n```\n\n## Configure\n\nTo use a custom directory that contains all the wordlists:\n\n```ruby\nThatLanguage.configure do |config|\n  config.wordlist_path = File.join(\"wordlists\", \"100k\")\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies.\nThen, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\nTo release a new version, update the version number in `version.rb`,\nand then run `bundle exec rake release`, which will create a git tag for the version,\npush git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Deradon/that_language.\nThis project is intended to be a safe, welcoming space for collaboration,\nand contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderadon%2Fthat_language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderadon%2Fthat_language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderadon%2Fthat_language/lists"}