Skip to main content

Readme

Dramatist is a project for parsing plays from DraCor into a data structure which allows to access the text of the play "character" perfect, that is, character start and end positions for various parts, for example, act or scenes, can be retrieved. This also allows for functionality like getting the act and scene number for a character position.

Installation

pip install Dramatist

Usage

There are to ways to use Dramatist. The recommended way is to use Dramatist in code in other projects. The second option, from the command line, is only for illustration purposes, and rather limited.

In code

from dramatist.core.Dramatist import Dramatist

dramatist = Dramatist()

# load from local file
drama = dramatist.from_file(path_to_play_xml_file)

# load from DraCor API using corpus name and play name
drama = await dramatist.from_api_by_name('ger', 'goethe-iphigenie-auf-tauris')

# load from DraCor API using play id
drama = await dramatist.from_api_by_id(play_id)

# get the text of the drama
drama_test = drama.get_text()

# get the number of acts
act_count = drama.act_count

# get the number of total scenes for all acts
scene_count = drama.scene_count

# get the start and end position of a scene
scene_start, scene_end = drama.get_range_for_scene(act_nr, scene_nr)

Command line

The command line interface is very limited. Dramatist is meant to be used in code in other projects. If the --output-folder-path the resulting the data structure is saved to a json file. Otherwise the drama text is printed to the console.

Local file

dramatist --drama-path path-to-xml-drama-file

DraCor API with corpus name and play name

dramatist --corpus-name ger --play-name goethe-iphigenie-auf-tauris

DraCor API with play id

dramatist --play-id ger000001

Functionality (Not complete)

  • get_text()
    • Get the text of the drama.
  • get_text_with_markup()
    • Get the text of the drama a list of markups.
  • get_text_for_scene_in_blocks(act_nr, scene_nr)
    • Get a list of text blocks for the given scene in the given act. Blocks that are longer than the given maximum length (in words) are split into multiple blocks.
  • get_text_for_scene_by_speaker(act_nr, scene_nr)
    • Get a list of text blocks by speaker for the given scene in the given act. This means that for every speaker change a new text block is created. Blocks that are longer than the given maximum length (in words) are split into multiple blocks.
  • get_scene_act_for_position(char_pos)
    • Return a tuple of act and scene number for the given position.
  • get_range_for_scene(act_nr, scene_nr)
    • Return a tuple of character start and end position for the given act and scene number.
  • get_structure()
    • Get the structure of the drama, for example:
      1. Act (0:500)
      1. Scene (10:50)
      where the numbers in parentheses represent the character start and end positions.
      

Metadata

Release files for Dramatist 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Dramatist 0.0.6
File Size Uploaded
Dramatist-0.0.6.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Dramatist 0.0.6
File Interpreter ABI Platform
Dramatist-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 39.9 kB

Release files / Dramatist-0.0.6.tar.gz

Download URL Dramatist-0.0.6.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f68bc7fc83c1189ea4e20deaf91822fdea34e4b1bf77276d442b83c1f8646580
BLAKE2b-256 checksum
How to use checksums
3d1c0cb821e5cb443d3e001b316301a914c40e2c2bd2c440d71e9ed4a077f29a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / Dramatist-0.0.6-py3-none-any.whl

Download URL Dramatist-0.0.6-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fae840476fed1e932c852dd96f1bf89c1d2caf5ebe593e6a5d24a61309b4857
BLAKE2b-256 checksum
How to use checksums
9ad53412979c6d31349484f064ce0f028a508984e481c67bd8cff22e222c3a9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

0.1.0

2 release files

0.0.7

2 release files

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page