Skip to main content

Python library for natural language processing

Project description

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

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

linguistics-2022.5.8.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

linguistics-2022.5.8-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file linguistics-2022.5.8.tar.gz.

File metadata

  • Download URL: linguistics-2022.5.8.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for linguistics-2022.5.8.tar.gz
Algorithm Hash digest
SHA256 359048b65ac33a02bc18690f9fdcbf4ffc043d19513c62da123e68b7acea0389
MD5 7a812016f36e95193de4ebdbbd4c167b
BLAKE2b-256 dcd2964fbd99aef0432eb58e10e82eb8ccb78d3d3bbd571740296115f8f9fe36

See more details on using hashes here.

File details

Details for the file linguistics-2022.5.8-py3-none-any.whl.

File metadata

  • Download URL: linguistics-2022.5.8-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for linguistics-2022.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9d45f81277d46b9ae18f5cc2f97bf50d9afd3301d4f6de986b2c9ca7d3ee460c
MD5 42f15ad363ed7eddd7653131118f0d3b
BLAKE2b-256 31a0200acf4e2b6508ea0f8ea0365e43b44ae1de7a6f5ac2dfc62c37c051034f

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