{"id":17166657,"url":"https://github.com/willf/entropic","last_synced_at":"2025-03-24T18:15:38.473Z","repository":{"id":66569777,"uuid":"117163866","full_name":"willf/entropic","owner":"willf","description":"Train and predict string entropy based on character n-grams","archived":false,"fork":false,"pushed_at":"2018-01-16T16:50:46.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T12:52:25.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/willf.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-01-11T23:00:13.000Z","updated_at":"2018-08-29T20:55:53.000Z","dependencies_parsed_at":"2023-07-09T06:00:48.357Z","dependency_job_id":null,"html_url":"https://github.com/willf/entropic","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Fentropic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Fentropic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Fentropic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willf%2Fentropic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willf","download_url":"https://codeload.github.com/willf/entropic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245325221,"owners_count":20596818,"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":[],"created_at":"2024-10-14T23:06:17.873Z","updated_at":"2025-03-24T18:15:38.466Z","avatar_url":"https://github.com/willf.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Entropic\n\nEntropic trains and predicts entropy of strings based on character n-gram models. For example:\n\n```ruby\nrequire 'entropic'\n\u003e\u003e m = Entropic::Model.read(open('https://raw.githubusercontent.com/willf/entropy/master/data/google_books_2.tsv')); true\n=\u003e true\n\u003e\u003e m.entropy(\"entropy\")\n=\u003e 10.15243685946792\n\u003e\u003e m.entropy(\"yportne\")\n=\u003e 11.048928592721346\n```\n\nThe string 'yportne' is much less likely than the string 'entropy'.\n\nYou can also train a model, using strings one per line.\n\n```ruby\n\u003e\u003e n = Entropic::Model.new(2); true\n=\u003e true\n\u003e\u003e File.open('/tmp/training.txt') {|f| n.train(f)}; true\n=\u003e true\n\u003e\u003e n.entropy('love')\n=\u003e 5.132072254636385\n```\n\nYou can also train a model, using strings and a count of the number of times it appers, tab separated.\n\n```ruby\n\u003e\u003e o = Entropic::Model.new(2); true\n=\u003e true\n\u003e\u003e File.open('/tmp/training_with_counts.txt') {|f| o.train_with_multiplier(f)}; true\n=\u003e true\n\u003e\u003e o.entropy('love')\n=\u003e 5.132072254636385\n```\n\nYou can also dump a model, to be read later.\n\n```ruby\n\u003e\u003e File.open('/tmp/save.tsv','w') {|f| o.dump(f)}; true\n=\u003e true\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'entropic'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install entropic\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` 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`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push 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/willf/entropic.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillf%2Fentropic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillf%2Fentropic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillf%2Fentropic/lists"}