{"id":34063239,"url":"https://github.com/ivankunyankin/intent_suggestions","last_synced_at":"2026-04-08T17:31:03.288Z","repository":{"id":56705102,"uuid":"523351757","full_name":"ivankunyankin/intent_suggestions","owner":"ivankunyankin","description":"https://pypi.org/project/intent-suggestions/","archived":false,"fork":false,"pushed_at":"2022-09-06T17:41:18.000Z","size":86,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-16T03:19:40.039Z","etag":null,"topics":["intent-detection","n-gram-language-models","suggestions"],"latest_commit_sha":null,"homepage":"https://bit.ly/3e2iYpD","language":"Python","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/ivankunyankin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-10T13:19:29.000Z","updated_at":"2023-06-11T09:34:42.000Z","dependencies_parsed_at":"2022-08-15T23:40:31.148Z","dependency_job_id":null,"html_url":"https://github.com/ivankunyankin/intent_suggestions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ivankunyankin/intent_suggestions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivankunyankin%2Fintent_suggestions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivankunyankin%2Fintent_suggestions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivankunyankin%2Fintent_suggestions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivankunyankin%2Fintent_suggestions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivankunyankin","download_url":"https://codeload.github.com/ivankunyankin/intent_suggestions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivankunyankin%2Fintent_suggestions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31566682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["intent-detection","n-gram-language-models","suggestions"],"created_at":"2025-12-14T05:15:44.492Z","updated_at":"2026-04-08T17:31:03.268Z","avatar_url":"https://github.com/ivankunyankin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Intent suggestions\r\n\r\nPython package for early user intent detection using n-gram language models\r\n\r\n\u003cp align=\"center\"\u003e\u003cimg src=\"img.png\" width=\"50%\"\u003e\u003c/p\u003e\r\n\r\nThe idea behind intent suggestions is similar to autofill when we use words that were typed to make predictions. But instead of predicting the next word, we try to detect the user's intent.\r\n\r\nThe proposed approach uses `n` recursively initialised models. Each next model uses a smaller `n`. I.e. a model initialised with `n=3` will include three models (with `n=3`, `n=2` and `n=1`)\r\nThis recursive approach allows to also take into account frequency counts from smaller n-grams in case there is no match for the parent model.\r\n\r\n### Installation\r\n```\r\npip install intent_suggestions\r\n```\r\n### Quickstart\r\n`Fit` takes a list of items (training phrases) and a list of labels (intents) as input.\r\n```\r\nfrom intent_suggestions import IntentSuggester\r\n\r\nmodel = IntentSuggester()\r\n\r\nitems = [\"one two three four\", \"five six seven eight\"]\r\nlabels = [\"intent_1\", \"intent_2\"]\r\n\r\nmodel.fit(items, labels)\r\n\r\nprint(model.predict(\"zero two three four\"))\r\n```\r\nOutput:\r\n```\r\n{'intent_1': 0.9902, 'intent_2': 0.0098}\r\n```\r\nDuring training the model splits phrases by words. Thus, it works better when given input phrases with *complete last words*. For example, instead of making a prediction when a user typed \"five six se\", wait until they type \"five six seven\" and put a space. Now make the prediction.\r\n\r\n### Notation\r\n\r\nAccording to the common notation, an n-gram language model uses `n-1` words to predict the next word.\r\nGiven that we are trying to predict a user's intent rather the next word, we'll use a slightly different notation. `n` in our case will represent the number of words used to predict intent probabilities. So a 3-gram (or trigram) model will use three words to make predictions.\r\n\r\n### References\r\n\r\nThe approach was inspired by [this](https://habr.com/ru/post/346578/) work\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivankunyankin%2Fintent_suggestions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivankunyankin%2Fintent_suggestions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivankunyankin%2Fintent_suggestions/lists"}