Augmented Criticism Lab Toolkit and Connectors
This set of tools is designed for interfacing with the Augmented Criticism Lab's API, https://acriticismlab.org. The toolkit can be installed with pip:
pip install Augmented-Criticism-Lab-Toolkit
Using the Connectors
Connectors are used to pull data from the database over the API. Here are some examples:
from connectors.poem import Poem
# To get a list of all poems:
all_poems = Poem().all()
# To get a specific poem by database id:
single_poem = Poem().by_id(1)
from connectors.book import Book
# To get a list of all books:
all_books = Book().all()
# To get a specific book by database id:
single_book = Book().by_id(1)
The included connectors are book, poem, and section. Each connector works on the same principle.
Using the Tools
API based tools:
from tools.api import Tools
# Lemmatize text:
lemmas = Tools().lemmatize("text to lemmatize")
# Part of speech tags:
tags = Tools().pos_tag("text to tag")
# Frequency distribution:
freqdist = Tools().frequency_distribution("text to get distribution for")
# Topic model:
model = Tools().topic_model("text to model")
Note: Topic models take about a minute to run.
Python based tools:
Rhyme Scheme Analyzer:
from tools.rhyme import Rhyme
from tools.rhyme import classify_sonnet
# Initialize a Rhyme object with the text you want to analyze.
# The text must be separated into lines, you can define a delimiter
# the default is '\\n'. This returns a list of rhyme pairs:
# ['A','B','B','A','C','D','D','C','E','F','E','F','G,'G']
rhyme = Rhyme("text\n broken\n into lines", delimiter='\n').find_rhyme_scheme()
# To classify the rhyme scheme (only works for sonnets) run:
# Returns a tuple such that (each number represents a probability
# the sonnet of the type listed):
#(Petrarchan 1, Petrarchan 2, Petrarchan 3, Shakespearean, Spenserian)
sonnet_type = classify_sonnet(rhyme)
Syllable Counter:
from tools.syllable import SyllableCounter
# Initialize a counter:
syllable_counter = SyllableCounter()
# Run a line of poetry through the counter:
syllable_count_for_line = syllable_counter.count_syllables_by_line("line of text")
It is also possible to run the syllable counter on a poem from the ACL database directly:
from tools.syllable import SyllableCounter
from connectors.poem import Poem
# Initialize a counter:
syllable_counter = SyllableCounter()
# Get a poem:
poem = Poem().by_id(1)
# Get counts for the poem:
counts = syllable_counter.count_syllables_poem(poem)
Extend the OUTLIERS: (i.e. words that don't give correct syllable counts)
Create a csv file formatted as:
WORD, NUMBER_OF_SYLLABES
# Example
apple, 2
orange, 2
You then load the csv file:
from tools.syllable import SyllableCounter
# Initialize a SyllableCounter.
syllable_counter = SyllableCounter()
# Load the custom outliers file into the counter.
syllable_counter.load_custom_outliers('PATH_TO_FILE')
Metadata
Release files for Augmented-Criticism-Lab-Toolkit 1.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Augmented Criticism Lab Toolkit-1.1.9.tar.gz | 14.1 kB | Without provenance | Details for Augmented Criticism Lab Toolkit-1.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Augmented_Criticism_Lab_Toolkit-1.1.9-py3-none-any.whl | Python 3 | none | any | Details for Augmented_Criticism_Lab_Toolkit-1.1.9-py3-none-any.whl |
Total release size: 33.1 kB
Release files / Augmented Criticism Lab Toolkit-1.1.9.tar.gz
| Download URL | Augmented Criticism Lab Toolkit-1.1.9.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c04736e208f3b93ced312d29ff9eca742d6c6884886c67bb7a33b8909dbd0c9c
|
|
BLAKE2b-256 checksum How to use checksums |
c688cf60bff228af052b35d1dee4aad69757c822c3186cee93a31c0b59ca08ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
|
Release files / Augmented_Criticism_Lab_Toolkit-1.1.9-py3-none-any.whl
| Download URL | Augmented_Criticism_Lab_Toolkit-1.1.9-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c337c7db4deeb34c44df8c3fe778ca954881384158914218180ab6bb644e757c
|
|
BLAKE2b-256 checksum How to use checksums |
9f288c808b537743bd90ef7aa73623e905471041dbb71181b4d2fe4922035161
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
|
Security for Augmented-Criticism-Lab-Toolkit 1.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.