dictionary-model-0.2.4
توضیحات
Model for tracking context of utterance and predicting future characters.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | dictionary-model-0.2.4 |
| نام | dictionary-model |
| نسخه کتابخانه | 0.2.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Michał Kosturek |
| ایمیل نویسنده | eemkos@gmail.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/dictionary-model/ |
| مجوز | Michał Kosturek |
dictionary-model
----------------
To use, first create CharPredictor object::
>>> predictor = CharPredictor()
This may take a while as model is being downloaded and loaded.
Then, to track utterance context, you can add letter index to context::
>>> letter_index = 1 # 1 -> a, letters should be indexed in order: ' abcdefghijklmnopqrstuvwxyz' (0 -> space)
>>> predictor.add_to_context(letter_index)
or you can add letter as string of length 1 (make sure it is one of AsciiEncoder.AVAILABLE_CHARS)::
>>> letter = 'a'
>>> predictor.add_to_context(letter)
or you can add probability distribution for all AsciiEncoder.AVAILABLE_CHARS letters::
>>> import numpy as np
>>> import AsciiEncoder as AE
>>>
>>> num_chars = len(AE.AVAILABLE_CHARS)
>>> letter_distr = np.random.random((1, num_chars)) # random proba distribution
>>> predictor.add_to_context(letter_distr)
And finally - you can predict probabilities of each letter coming next after text stored in context. (Letters are indexed in order shown below)::
>>> predictor.transform()
Letters order::
' abcdefghijklmnopqrstuvwxyz' # space character comes at index 0, then alphabetical order for indices from 1 to 26
نحوه نصب
نصب پکیج whl dictionary-model-0.2.4:
pip install dictionary-model-0.2.4.whl
نصب پکیج tar.gz dictionary-model-0.2.4:
pip install dictionary-model-0.2.4.tar.gz