Static Hash-Based Lookup for Google Ngram Frequencies
Project description
gngram-lookup
Word frequency from 500 years of books. O(1) lookup. 5 million words.
Install
pip install gngram-lookup
python -m gngram_lookup.download_data # ~110 MB, takes a few seconds
Python
import gngram_lookup as ng
ng.exists('computer') # True
ng.exists('xyznotaword') # False
ng.frequency('computer')
# {'peak_tf': 2000, 'peak_df': 2000, 'sum_tf': 892451, 'sum_df': 312876}
ng.batch_frequency(['the', 'algorithm', 'xyznotaword'])
# {'the': {...}, 'algorithm': {...}, 'xyznotaword': None}
CLI
gngram-exists computer # True, exit 0
gngram-exists xyznotaword # False, exit 1
gngram-freq computer
# peak_tf_decade: 2000
# peak_df_decade: 2000
# sum_tf: 892451
# sum_df: 312876
Docs
See Also
- bnc-lookup - O(1) lookup for British National Corpus
- wordnet-lookup - O(1) lookup for WordNet
Attribution
Data derived from the Google Books Ngram dataset.
License
Proprietary. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gngram_lookup-0.2.5.tar.gz
(9.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gngram_lookup-0.2.5.tar.gz.
File metadata
- Download URL: gngram_lookup-0.2.5.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2292f002d713356b1e6ec681711b8e287a2ae97d361c1e44d03ab685dc737047
|
|
| MD5 |
6c9d06b6677494d965a7fdd96fc73dfd
|
|
| BLAKE2b-256 |
75b1821979aada384da7cd08fad5a39fd365e48f1119613f7843f99e1bea5565
|
File details
Details for the file gngram_lookup-0.2.5-py3-none-any.whl.
File metadata
- Download URL: gngram_lookup-0.2.5-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cabf21fcee19d121eebe127b8140d381def9d9e1d29928b0747d35263b6170fb
|
|
| MD5 |
407554b0dcc5cce3878f53336213d79f
|
|
| BLAKE2b-256 |
6ffe50a9bceac353b2f1c765f35ac3f8aa72f1323a1f544bb44ef8e559025c27
|