Package: py-shakespeare
py_shakespearepy_shakespeareis a Python package to obtain Shakespeare script and monologue.Installation$pipinstallpy_shakespeareUsageClassesshake_playshake_play(min_num_character=20, play_complexity, play_length)Base class to obtain the list of Shakespeare play based on minimum number of character, length of the play, and complexity of the play. This class will obtain data from DraCor API and merge the data to genre of Shakespeare play that was obtained by scraping "www.opensourceshakespeare.org" website.shake_monologueshake_monologue(gender='ALL', min_line=30, include_all=True, play_list)Base class to obtain a list of monologues from Shakespeare plays based on gender of the monologues speaker, minimum line of monologue, and list of plays which monologues want to be obtained. This class will obtain data from both DraCor and The Folger Shakespeare API to help user choose monologue based on several inputs.How to useImport all classes>>>frompy_shakespeareimportpy_shakespeareshake_playInitialize shake play based on minimum number of character, play complexity (optional), and play length (optional)>>>pl=py_shakespeare.shake_play(min_num_character=30,play_complexity="Medium",play_length="Medium")Get the summarized table.>>>pl.get_summary()This function returned a table with following variables:
* title: title of the play
* popularity: relative popularity (from the number of Wikipedia links referring to this play) to other plays with similar minimum number of character
* genre: genre of the play (based on Open Source Shakespeare website)
* num_character: number of character/cast in this play
* play_length: relative length of the play to other plays with similar minimum number of character. Obtained by using number of words variable divided by rate of speech in a drama (170 words per minute)
* play_complexity: relative complexity of the play to other plays with similar minimum number of character. Obtained by using average degree of dialogue between each character in the playGet detailed table>>>pl.get_complete()This function returned a table with same variables of summary table plus below variables:
* num_male_character: number of male character/cast in this play
* num_female_character: number of female character/cast in this play
* num_unknown_character: number of unknown gender character/cast in this play
* num_scene: number of scene/segment in this play
* play_length_hr: length of the play in hours. Obtained by using number of words variable divided by rate of speech in a drama (170 words per minute)Download selected script in xml format. The file will be downloaded to the device.>>>pl.get_script(row=2)shake_monologueInitialize a table of monologues from Shakespeare plays based on gender of character, minimum line, and list of plays.WARNING: if chooseinclude_all = Truethe run time for the function will be quite long>>>ml=py_shakespeare.shake_monologue(gender="ALL",min_line=40,include_all=False,play_list=["Rom","Ham"])Get the summarized table>>>ml.get_summary()This function returned a table with following variables:
* play: title of the play
* name: name of the character
* gender: gender of the character
* degree: how many other characters this character interacted with
* monologue_link: Link to the monologue
* line_num: number of lines of the monologueGet the complexity score of the monologue. Complexity score is calculated usingFlesch Kincaid Grade readibility score.>>>ml.get_complexity()This function returned a summary table with 2 additional variables:
* complexity_score: Flesch Kincaid Grade readibility score
* complexity_category: Complexity category based on the readibility scoreDownload selected monologue script in txt format. The file will be downloaded to the device.>>>ml.get_script(row=2)Folger ID as input ofplay_list. Ifinclude_all = False, an array ofplay_listshould be passed in the function parameter. Below is the list of Folger ID:Folger IDPlayAWWAll’s Well That Ends WellAntAntony and CleopatraAYLAs You Like ItErrThe Comedy of ErrorsCorCoriolanusCymCymbelineHamHamlet1H4Henry IV, Part 12H4Henry IV, Part 2H5Henry V1H6Henry VI, Part 12H6Henry VI, Part 23H6Henry VI, Part 3H8Henry VIIIJCJulius CaesarJnKing JohnLrKing LearLLLLove’s Labor’s LostMacMacbethMMMeasure for MeasureMVThe Merchant of VeniceWivThe Merry Wives of WindsorMNDA Midsummer Night’s DreamAdoMuch Ado About NothingOthOthelloPerPericlesR2Richard IIR3Richard IIIRomRomeo and JulietShrThe Taming of the ShrewTmpThe TempestTimTimon of AthensTitTitus AndronicusTroTroilus and CressidaTNTwelfth NightTGVTwo Gentlemen of VeronaTNKTwo Noble KinsmenWTThe Winter’s TaleContributingInterested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.Licensepy_shakespearewas created by Hamidah Alatas. It is licensed under the terms of the MIT license.Creditspy_shakespearewas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.py_shakespeareused DraCor API. Fischer, Frank, et al. (2019). Programmable Corpora: Introducing DraCor, an Infrastructure for the Research on European Drama. In Proceedings of DH2019: "Complexities", Utrecht University, doi:10.5281/zenodo.4284002.py_shakespeareused The Folger Shakespeare API. Folger Shakespeare Library. (n.d.) Shakespeare’s Plays, Sonnets and Poems from The Folger Shakespeare API. Retrieved fromhttps://shakespeare.folger.edu