{"id":13660769,"url":"https://github.com/kshramt/company-ngram","last_synced_at":"2026-01-22T00:04:50.591Z","repository":{"id":147540341,"uuid":"53108502","full_name":"kshramt/company-ngram","owner":"kshramt","description":null,"archived":false,"fork":false,"pushed_at":"2017-03-20T12:53:25.000Z","size":108,"stargazers_count":30,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-10T15:44:12.562Z","etag":null,"topics":["completion-candidates","n-grams","natural-language-processing"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/kshramt.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":"2016-03-04T04:55:40.000Z","updated_at":"2023-12-01T17:44:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"99e32691-1ec3-48bc-8160-fe27a34787ee","html_url":"https://github.com/kshramt/company-ngram","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kshramt%2Fcompany-ngram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kshramt%2Fcompany-ngram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kshramt%2Fcompany-ngram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kshramt%2Fcompany-ngram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kshramt","download_url":"https://codeload.github.com/kshramt/company-ngram/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250727442,"owners_count":21477316,"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":["completion-candidates","n-grams","natural-language-processing"],"created_at":"2024-08-02T05:01:25.544Z","updated_at":"2026-01-22T00:04:50.585Z","avatar_url":"https://github.com/kshramt.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# company-ngram\n\nA company backend for N-gram based completion.\n\n![](screenshot.jpg)\n\nThis backend produces completion candidates that are fuzzily matching to N-gram data.\nThe N-gram data is automatically constructed from `*.txt` files placed directly under `company-ngram-data-dir` directory.\nIf you set `company-ngram-n` to `4`, three words before the cursor are used to produce completion candidates.\n\nTo mitigate the data sparsity problem, this backend uses a fuzzy-matching strategy.\nGiven the following sentence, `Dear Dr. Aki, `, this backend produces completion candidates that match at least one of following prefixes,\n\n```\nDear Dr. Aki,\n*    Dr. Aki,\nDear *   Aki,\n*    *   Aki,\nDear Dr. *\n*    Dr. *\nDear *   *\n```\n\nwhere `*` matches an arbitrary word.\nHence, even if your `*.txt` does not contain the word `Aki`, you still have chance to get completion candidates.\n\n## Configurations\n\n```elisp\n; ~/.emacs.d/init.el\n\n(with-eval-after-load 'company-ngram\n  ; ~/data/ngram/*.txt are used as data\n  (setq company-ngram-data-dir \"~/data/ngram\")\n  ; company-ngram supports python 3 or newer\n  (setq company-ngram-python \"python3\")\n  (company-ngram-init)\n  (cons 'company-ngram-backend company-backends)\n  ; or use `M-x turn-on-company-ngram' and\n  ; `M-x turn-off-company-ngram' on individual buffers\n  ;\n  ; save the cache of candidates\n  (run-with-idle-timer 7200 t\n                       (lambda ()\n                         (company-ngram-command \"save_cache\")\n                         ))\n  )\n\n(require 'company-ngram nil t)\n```\n\n[RFC](http://www.rfc-editor.org/rfc-index.html) provides handy text files for a quick trial.\n\n```bash\nwget --directory-prefix ~/data/ngram    https://www.rfc-editor.org/rfc/rfc{5661,6716,4949}.txt\n```\n\n## License\n\n[The GNU General Public License version 3](http://www.gnu.org/licenses/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkshramt%2Fcompany-ngram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkshramt%2Fcompany-ngram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkshramt%2Fcompany-ngram/lists"}