Intent suggestions
Early user intent detection using n-gram models
The 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.
The 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)
This recursive approach allows to also take into account frequency counts from smaller n-grams in case there is no match for the parent model.
Usage
from model import IntentSuggester
model = IntentSuggester()
items = ["one two three four", "five six seven eight"]
labels = ["intent_1", "intent_2"]
model.fit(items, labels)
print(model.predict("zero two three four"))
Output:
{'intent_1': 0.9902, 'intent_2': 0.0098}
Notation
According to the common notation, an n-gram language model uses n-1 words to predict the next word.
Given 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.
References
The approach was insipred by this work
Metadata
Release files for intent-suggestions 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| intent_suggestions-0.1.0.tar.gz | 4.6 kB | Without provenance | Details for intent_suggestions-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| intent_suggestions-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for intent_suggestions-0.1.0-py3-none-any.whl |
Total release size: 10.2 kB
Release files / intent_suggestions-0.1.0.tar.gz
| Download URL | intent_suggestions-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e538cc08b4d835ab9366485dccdbfeac6b6c40bde21fb44c8a1ed38649f68bb
|
|
BLAKE2b-256 checksum How to use checksums |
e15711f79fb1c0be967ab303e63906971b469b76a3f6734c47b2d7939d068ec9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Release files / intent_suggestions-0.1.0-py3-none-any.whl
| Download URL | intent_suggestions-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccacc173aaeaeb10470a85029976442ece2cf37f0fdfda317cd546d282b2ff54
|
|
BLAKE2b-256 checksum How to use checksums |
f845d519f317fd1588f639236c0cfd8b46809a941ec771e858bd9beb71647ae9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.7
|
Security for intent-suggestions 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.