iambic: Data extraction and rendering library for Shakespearean text.
Project description
iambic: Data extraction and rendering library for Shakespearean text. :scroll:
Let computers do the hard work for you! iambic
provides:
- The most accurate method for counting lines automatically.
- Automatically track which characters are speaking in any scene.
- Deterministic, repeatable results, with the ability to store your data as JSON with strictly defined schema for passing over the wire or storing locally or in a NoSQL database between runtimes.
Installation
In order to install the latest version, simply pip3 install -U iambic
.
This library requires Python 3.6 or greater.
What is it?
iambic
was originally envisioned as a tool for translating
Shakespearean text into actionable information, i.e.:
- How many lines are in this particular play?
- How many lines does a given character speak in this play?
- Which characters speak, in which scenes and acts?
As a result of the implementation, this tool can be applied to any body of text which adhere's to its parsing syntax.
How it works
In Shakespeare's work, every line of text has meaning and
communicates volumes beyond the individual words. As such,
iambic
's root object is the individual line, or node
.
Each node
is assigned a specific type
based upon simple
syntactical rules. These rules can be broken out into the
following logical groups:
1. Locales
A Locale
will be denoted by header formatting (H1-5) and
represents a logical break in the forward action of the
play. These can be thought of as the entries that may show
up in a Table of Contents, and can include:
Act
Scene
Prologue
orEpilogue
An Act
may have many nested Scene
, Prologue
, and
Epilogue
sections.
A Scene
will be always be nested under an act Act
. A
Scene
contains speeches, dialogue, and actions.
A Prologue
or Epilogue
may or may not be nested under an
Act
and may or may not have the structure of a Scene
or an Act
.
2. Actions and Directions
Actions and Directions will be denoted by an italicized paragraph of any length and represent a physical action that takes place on stage. These can include:
- Character Action (
Action
) - Stage Direction (
Direction
) - Entrance/Exit (
Entrance
orExit
)
An Action
object represents an action of a specific
character and are usually found within or just after a
speech. If these are more than one word (such as Aside),
they will either reference the character by pronoun, or
begin with To .... In order for iambic
to understand
that the given paragraph is an Action
, the paragraph
should be wrapped in brackets ([]
) in addition to
italicized. ex: [He brandishes his sword], [To
JULIET]).
A Direction
is more straightforward - it is simply a stage
direction, meaning a paragraph of text which illucidates
some on-stage action between any number of characters. A
Direction
will always be written in third-person
omniscient and reference characters by name and be denoted
simply by italics. ex: Flourish, They fight, HAMLET
stabs CLAUDIUS.
An Entrance
or Exit
will usually lead or finish with
Enter
, Exit
, or Exeunt
and be italicized.
3. Personae
The Persona
object is in its own category and is initially
denoted by a bolded line preceding a block of dialogue. ex:
HAMLET
Not so, my lord, I am too much i'th'sun.
Once a persona is created, that object is tracked throughout the rest of the play.
4. Lines
Finally, the meat of the text. Having filtered out all other
syntactical notations, whatever is remaining is considered a
line of Dialogue
. Dialogue
objects represent a single
line of spoken word and are grouped within larger Speech
objects, which are associated to the character speaking and
nested directly under the Scene
, Prologue
, or Epilogue
object in which it occurs.
The Schema
The full schema specification has been written in JSON Schema 7.0 and can be found here
Documentation
Full documentation coming soon!
How to Contribute
- Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
- Create a branch on Github for your issue or fork the repository on GitHub to start making your changes to the master branch.
- Write a test which shows that the bug was fixed or that the feature works as expected.
- Send a pull request and bug the maintainer until it gets merged and published. :)
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
Built Distribution
File details
Details for the file iambic-0.5.0.tar.gz
.
File metadata
- Download URL: iambic-0.5.0.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d46aa7dfa1557fbd82c4e248e93272ff60b56fa854467f54fc2e2c4fe885e72a |
|
MD5 | 8d2d01adfc514919e024db58820345aa |
|
BLAKE2b-256 | 4533f9ae5a8faa819cc55acd4fe1dc6ccf391aa9b330ac085eddab808b198e41 |
File details
Details for the file iambic-0.5.0-py2.py3-none-any.whl
.
File metadata
- Download URL: iambic-0.5.0-py2.py3-none-any.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d39691a77a0f18af8a108c08e54d4c91c979c71ce85d438e47f4054828b94e1 |
|
MD5 | 08b001b87d0485bbf6c8dbdd5e0b5a83 |
|
BLAKE2b-256 | dadb3eb99f4778e2a8b1f3aa00af371a49bb11414689c3e8ebac4d8778fc1cc0 |