Skip to main content

A small package using wmd to get closet doc to a chosen doc

Project description

Word Mover's Distance using Fast Word Mover's Distance

Calculates Word Mover's Distance using Fast Word Mover's Distance.

Installation

Before installing the package, check that you have already installed :

Numpy

wmd

NLTK

Spacy

en_core_web_lg

pip install numpy
pip install wmd
pip install nltk
pip install spacy
python -m spacy download en_core_web_lg

Then

pip install docwmd

Tested on Linux and macOS.

Usage

You must have the document you want to find the closest document as a string and the other documents as a list of strings.

from docwmd import docWMD

calc = docWMD("Politician speaks to the media in Illinois.", ["The president greets the press in Chicago.", "The President delivers his inaugural address."])

print(calc.get_closest())

This returns the number of the nearest document and its distance.

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

docwmd-0.0.6.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

docwmd-0.0.6-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file docwmd-0.0.6.tar.gz.

File metadata

  • Download URL: docwmd-0.0.6.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.3

File hashes

Hashes for docwmd-0.0.6.tar.gz
Algorithm Hash digest
SHA256 a033db3f02efca6d8939853ec46f0219fe46cdf04af0e5f6ab95b9c0240b8d30
MD5 e12092e6f2401447316d31f5a547352b
BLAKE2b-256 afc44adfc5dc7061dcc583b52447b0ceff0e3621756403c48d7a79d3eed43eb4

See more details on using hashes here.

File details

Details for the file docwmd-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: docwmd-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.3

File hashes

Hashes for docwmd-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9cdfbd116ec6ffa4462b6f699a5ee93920f1b085a4f2e3d70298754066d776f2
MD5 9204e0ae1b889853f841754fab012740
BLAKE2b-256 ed2593363aa070c73aeae4d64f07eb47ca67a1bca8ddd8f309f763f814414389

See more details on using hashes here.

Supported by

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