Metric for comparing text
Project description
Text Comparer
=============
Uses cosine similarity to give a numerical evaluation of the similarity of two
texts (0 to 1).
This code has a companion blog-post here:
http://engineering.aweber.com/cosine-similarity/
Sample Usage
------------
```python
In [1]: from vectorizer import compare_texts
In [2]: compare_texts('Mary had a little shotgun.', 'Mary loves her shotgun')
Out[2]: 0.66666666666666663
In [3]: compare_texts('John loves Mary.', 'But Mary has a shotgun.')
Out[3]: 0.33333333333333331
```
The higher score in `2` implies that the first two sentences are more similar
than the second two. A classic tale of the love-linked-list.
=============
Uses cosine similarity to give a numerical evaluation of the similarity of two
texts (0 to 1).
This code has a companion blog-post here:
http://engineering.aweber.com/cosine-similarity/
Sample Usage
------------
```python
In [1]: from vectorizer import compare_texts
In [2]: compare_texts('Mary had a little shotgun.', 'Mary loves her shotgun')
Out[2]: 0.66666666666666663
In [3]: compare_texts('John loves Mary.', 'But Mary has a shotgun.')
Out[3]: 0.33333333333333331
```
The higher score in `2` implies that the first two sentences are more similar
than the second two. A classic tale of the love-linked-list.
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
text_comparer-0.0.2.tar.gz
(2.6 kB
view details)
File details
Details for the file text_comparer-0.0.2.tar.gz.
File metadata
- Download URL: text_comparer-0.0.2.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bc15c52c880b0f4d6367d226fc1005a6aefb022b723827080105ddcb0d3eb0d
|
|
| MD5 |
8e37e9ab7b701406894fb76ab651c394
|
|
| BLAKE2b-256 |
4cdc1404fda79c05f8aa2180e003a36859cdacb2c68b85465acf33abd9d97fd1
|