prosodic
prosodic copied to clipboard
detect whether a line is keeping or breaking meter?
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?
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
Great, thanks!