poetrytools

The goal of poetrytools is to ...

Installation

Requirements

Install with python setup.py install

You can install poetrytools from github with:

# install.packages("devtools")
# devtools::install_github("MHenderson/poetrytools")
install.packages("poetrytools", repos = c('https://mhenderson.r-universe.dev', 'https://cloud.r-project.org'))

Example

This is a basic example which shows you how to solve a common problem:

library(poetrytools)
rhymes('show', 'hello')
#> [1] TRUE
haiku <- "savannah dust trails
 whistling thorn hovers above
 hungry giraffe grows"

poem <- tokenize(haiku) # need to tokenize the poem first
scanscion(poem)
#> [[1]]
#> [1] "010" "1"   "1"  
#> 
#> [[2]]
#> [1] "10" "1"  "10" "01"
#> 
#> [[3]]
#> [1] "10" "01" "1"
guess_form(poem)
#> [1] "haiku"
limerick <- "The limerick packs laughs anatomical
 Into space that is quite economical.
 But the good ones I've seen
 So seldom are clean
And the clean ones so seldom are comical."

poem <- tokenize(limerick)
guess_form(poem, verbose = TRUE)
#> [1] "limerick"

Notes