prosodic icon indicating copy to clipboard operation
prosodic copied to clipboard

detect whether a line is keeping or breaking meter?

Open summerstay opened this issue 4 years ago • 2 comments

What command would give the sequence of weak and strong stresses for a line, so that I could compare it to a given meter and see whether or not the line has that meter or is violating it?

summerstay avatar Apr 24 '20 16:04 summerstay

Here's a colab notebook showing how to do this: https://colab.research.google.com/drive/1Z9YcbqJuLlrLBuwTwH2YsFS3OsC3b4uO?usp=sharing

The short answer is that it's on the .str_meter() method of every parse object:

import prosodic as p
p.config['print_to_screen']=0
t=p.Text("""
   The other two, slight air, and purging fire
   Are both with thee, wherever I abide;
""")
t.parse(meter='default_english')
for parse in t.bestParses(): print(parse.str_meter())

# outputs:
# wswswswswsw
# wswswswsws

I'll leave this issue up for a while so ppl can see what's up. Thanks for your quesiton

quadrismegistus avatar Dec 06 '21 11:12 quadrismegistus

Great, thanks!

summerstay avatar Dec 06 '21 14:12 summerstay