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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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