Skip to main content

Static Hash-Based Lookup for Google Ngram Frequencies

Project description

gngram-lookup

PyPI version Downloads Downloads/Month Tests Python 3.9+

Word frequency from 500 years of books. O(1) lookup. 5 million words.

Install

pip install gngram-lookup
python -m gngram_lookup.download_data

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

Attribution

Data derived from the Google Books Ngram dataset.

License

Proprietary. See LICENSE.

Project details


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.3.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gngram_lookup-0.2.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file gngram_lookup-0.2.3.tar.gz.

File metadata

  • Download URL: gngram_lookup-0.2.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Darwin/24.6.0

File hashes

Hashes for gngram_lookup-0.2.3.tar.gz
Algorithm Hash digest
SHA256 ea732a564bbef7f5891a1e1be72c3cbbc5f4191deb69030a404e9d8d76c0efbc
MD5 a264671c410fdcf63e6f025b2ed239b8
BLAKE2b-256 03dd954ca1fd3d2f305e86091d422ada6aab8932b1668a84caabc6b3a93046e8

See more details on using hashes here.

File details

Details for the file gngram_lookup-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: gngram_lookup-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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

Hashes for gngram_lookup-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 14afd29fb243e610b5fc6f1d7c13ede51962e98650b4a6739e7313b23169482a
MD5 ee6d24c7692d6d4d1affdfd7ed36cc3e
BLAKE2b-256 b3771f2d8135fabdf55203e20dab2c1342d38cd94bfbd7c965f2a7208efdb66c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page