No project description provided
Project description
ngram-lm
Installation
pip install ngram-lm
Usage
Given some ARPA file, a trie can be built like this:
from ngram_lm.trie import build
lm_order = 3
arpa_path = "/path/to/arpa-file"
out_path = "/the/desired/output/path/where/trie/will/be/saved"
build(lm_order, arpa_path, out_path)
Then, the trie can be loaded into memory and queried:
from ngram_lm.trie import Trie
t = Trie(out_path)
context = ["ele", "foi"]
n_predictions = 5
predictions = t.next_word_predictions(context, n_predictions)
for p in predictions:
print(p)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file ngram_lm-0.1.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: ngram_lm-0.1.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 64.3 kB
- Tags: PyPy, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | baa7452e692d6e250b6f6a54903e6cfede69e2d943884aff8657806655b1058d |
|
MD5 | a16e025b582d7b0cac301058d58a7693 |
|
BLAKE2b-256 | ea969fd4077885de823af97f6da2c50e693a37cf48795f6404943616342d3692 |
File details
Details for the file ngram_lm-0.1.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: ngram_lm-0.1.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 254.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b2fe3a79b1259756e6d34c5be4f836bb1b70c37a6f0c687eaa6c113e68c028d |
|
MD5 | 166b093bcda2802b78e4fe699a6ee3ec |
|
BLAKE2b-256 | d62c9a86cf3f01a7575310288ce529c8859136c137f2bb41a808d77dbc482777 |
File details
Details for the file ngram_lm-0.1.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: ngram_lm-0.1.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 250.0 kB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15bf91c579296111515b73e29cd9f7fd2e7968e6a1e5a978216946a4c7b1dc12 |
|
MD5 | 8b95761c3c4d3582ef0213cf557059a9 |
|
BLAKE2b-256 | 69ab972baec2e3d2f60a6257833b576a32d281bfdf5bad7edf4697a600c97518 |
File details
Details for the file ngram_lm-0.1.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: ngram_lm-0.1.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 259.9 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 772beef0857f7c620bc2e460be773d31dfa69f312b6bd2fc692b4630b5b8e12e |
|
MD5 | c22b7617397cf4c3e43bfce9189d2b32 |
|
BLAKE2b-256 | 968acde6b81d2ba6badb42fccfc2b845f1a6d35f6d7e3aaba27dc40fbaf07b0a |
File details
Details for the file ngram_lm-0.1.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: ngram_lm-0.1.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 233.3 kB
- Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88746fcb1173c11cbf34edfaa8a7a926e14a95a8ef885691ad666d7661f9d442 |
|
MD5 | 318c70aad3df56bd0d3ce5120b58150f |
|
BLAKE2b-256 | 4c2528702dc8e1df64d58831793a52482653466fdf3c64a7acbbe3e66d846a54 |
File details
Details for the file ngram_lm-0.1.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
.
File metadata
- Download URL: ngram_lm-0.1.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
- Upload date:
- Size: 231.9 kB
- Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc19a2c075a3d6c2864c04c4f615425a52ca6979f18bebf1b2c3a88af2e1a7d5 |
|
MD5 | a2a94df788af1b42cea2ba77fc0700b6 |
|
BLAKE2b-256 | fc6fa448b8a54205a10163994ae22dfc0703215cc6fe0ad74b7362c1e29dacb6 |