Linguistics
Linguistics is a Python library for natural language processing.
Installation
You can use pip to install linguistics.
pip install linguistics
Dependencies
Linguistics uses Abstract and Graphviz to visualize graphs of the document.
Similarity
Sentence
get_similar_pairs
from linguistics.similarity import Sentence
sentence_1 = Sentence('John Joseph Nicholson')
sentence_2 = Sentence('Nicholson, Jack')
print(sentence_1.get_similar_pairs(sentence_2))
produces:
[{'word_1': Nicholson,
'word_2': Nicholson,
'similarity': 1.0,
'index_1': 2,
'index_2': 0},
{'word_1': John,
'word_2': Jack,
'similarity': 0.5,
'index_1': 0,
'index_2': 1},
{'word_1': Joseph,
'word_2': None,
'similarity': 0,
'index_1': 1,
'index_2': None}]
get_unordered_similarity
print(sentence_1.get_unordered_similarity(sentence_2))
print(sentence_1.get_unordered_similarity(sentence_2, case_sensitivity=0, weights=[1, 1]))
print(sentence_1.get_unordered_similarity(sentence_2, case_sensitivity=0, weights=[2, 1]))
print(sentence_1.get_unordered_similarity(sentence_2, case_sensitivity=0, weights=[1]))
print(sentence_1.get_unordered_similarity(sentence_2, case_sensitivity=0, first_char_weight=1, weights=[1, 1]))
produces
0.5
0.75
0.8333333333333334
1.0
0.875
Document
from linguistics import Document
# create document
document = Document("He also begat and brought up five pairs of male children.")
Entity Graph
display(document.entity_graph.render())
Document Graph
display(document.graph.render())
Release files for linguistics 2022.5.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| linguistics-2022.5.8.tar.gz | 22.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| linguistics-2022.5.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.8 kB
Release files / linguistics-2022.5.8.tar.gz
| Download URL | linguistics-2022.5.8.tar.gz |
|---|---|
| Size | 22.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
359048b65ac33a02bc18690f9fdcbf4ffc043d19513c62da123e68b7acea0389
|
|
BLAKE2b-256 checksum How to use checksums |
dcd2964fbd99aef0432eb58e10e82eb8ccb78d3d3bbd571740296115f8f9fe36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
|
Release files / linguistics-2022.5.8-py3-none-any.whl
| Download URL | linguistics-2022.5.8-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d45f81277d46b9ae18f5cc2f97bf50d9afd3301d4f6de986b2c9ca7d3ee460c
|
|
BLAKE2b-256 checksum How to use checksums |
31a0200acf4e2b6508ea0f8ea0365e43b44ae1de7a6f5ac2dfc62c37c051034f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
|