Skip to main content

idiom

Access and operations with word2vec data

To install:

pip install idiom

For more NLP work, see mood and lexis.

Overview

The idiom package provides access to word vector data and useful functions to manipulate and analyze it. It includes functionalities for finding the closest words to a given word, calculating word frequencies, and working with various word vector models.

Features

  • Closest Words: Find the closest words to a given word based on cosine similarity.
  • Word Frequencies: Access and manipulate word frequency data.
  • Word Vector Models: Work with pre-trained word vector models such as FastText.
  • IDF Calculations: Compute different types of Inverse Document Frequency (IDF) values.

Usage

Finding Closest Words

You can find the closest words to a given word using the closest_words function:

from idiom import closest_words

# Example: Find the closest words to 'mad' that start with 'l'
starts_with_L = lambda x: x.startswith('l')
print(closest_words('mad', k=10, search_words=starts_with_L))

Accessing Word Frequencies

You can access the most frequent words using the most_frequent_words function:

from idiom import most_frequent_words

# Get the top 100,000 most frequent words
frequent_words = most_frequent_words(max_n_words=100000)
print(frequent_words)

Working with Word Vectors

You can load and work with pre-trained word vectors using the WordVec class:

from idiom import WordVec

# Initialize WordVec with default word vectors
word_vec = WordVec()

# Calculate the distance between two queries
distance = word_vec.dist('france capital', 'paris')
print(distance)

IDF Calculations

You can compute different types of IDF values using the _IDF class:

from idiom import idf

# Access logarithmic IDF values
log_idf = idf.logarithmic
print(log_idf)

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue on GitHub.

License

This project is licensed under the MIT License.

Metadata

Release files for idiom 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for idiom 0.1.8
File Size Uploaded Provenance Actions
idiom-0.1.8.tar.gz 2.3 MB Without provenance Details for idiom-0.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for idiom 0.1.8
File Interpreter ABI Platform Actions
idiom-0.1.8-py3-none-any.whl Python 3 none any Details for idiom-0.1.8-py3-none-any.whl

Total release size: 4.5 MB

Release files / idiom-0.1.8.tar.gz

Download URL idiom-0.1.8.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
59cdbcebfca014ce2b17872345fb982870d9fe696f0679a718287d41a044c7f7
BLAKE2b-256 checksum
How to use checksums
0b3d2f3f0edf8cc587bb995e5f2a7fb1bb7578745d67ea5280b7a83cceced488
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / idiom-0.1.8-py3-none-any.whl

Download URL idiom-0.1.8-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0b7131ba7433bcbe77d99e6e7e4f4b1f62cc7a96cd0e8fcc50aecdeb55e72b38
BLAKE2b-256 checksum
How to use checksums
b3a1afe7d30095ac83b87d8d26a873d988b0bb80d17c6b6e17f2d7268300727f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for idiom 0.1.8

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page