meter_score: Metrical Density

Description Usage Arguments Value Note Author(s) Examples

View source: R/meter_score.R

Description

This function calculates the mertical density of given text in the form of binary stresses. It supports most common meters, but texts have to be pre-processed so that "0" represents an unstressed syllable and "1" represents a stressed syllable.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
function(x,
        meter_type=c("iambic",
                     "trochaic",
                     "spondaic",
                     "anapestic",
                     "dactylic",
                     "pyrrhic"),
        meter_length=c("dimeter",
                       "trimeter",
                       "tetrameter",
                       "pentameter",
                       "hexameter",
                       "heptameter",
                       "octameter"),
        secondary_stress=T,
        meterometer.com=F)

Arguments

x

A dataframe from the output of meter_yaml or a vector or a string of binary inputs.

meter_type

A string indicating one of the six type of stress mattern to look for

meter_length

A string indicating one of the six supported meter length

secondary_stress

A logical vector indicating whether there are encoded "2" for optional stresses.

Value

metrical_score

A single numeric value which is the percentage of matched instances

metrical_structure

A vector indicating which possible instances have exact matches.

Note

This function is in essence a pattern matching algorithm with a targeted audience of literary scholars. Ideally, this function should be combined with a program or algorithm that parses raw text data.

Author(s)

Kevin Wang

Examples

1
2
3
meter_score("0101010100010101010101", "iambic", "dimeter", F, F)

meter_score("0101020122010101010101", "iambic", "dimeter", T, F)

kevin931/MeterOMeter documentation built on Jan. 5, 2021, 12:12 p.m.