lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: software for syllable separation


From: Daniel Johnson
Subject: Re: software for syllable separation
Date: Wed, 21 Dec 2005 12:52:28 -0800
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050713)

Eduardo Vieira wrote:

> Hello users!
>  
> Does anybody know of a program that would make a syllable separation
> (hyphenation) of text to do something
> like this:
>  
> "Are you walking alone through the shadows dim?"
>  
> would be automatically converted to:
>  
> "Are you walk-ing a-lone through the shad-ows dim?"
>  
> This would be nice in working with lyrics.
>  
>  
> Best regards,
>  
> Eduardo Vieira
>  

This python script was posted to another list to which I subscribe.  It
should hyphenate a single word (passed on the command line) according to
the usage given on dictionary.com.  You might use this as the basis for
a larger script which could return the hyphenation rules for an entire
paragraph.

import sys, urllib, re

word = sys.argv[1]

url = "http://dictionary.reference.com/search?q="; + word

f = urllib.urlopen(url)
page = f.read()
f.close()

all = re.findall(r"<[bB]>(.+?&#183;.+?)</[bB]>", page)
for t in all:
    print re.sub(r"<IMG.+?>|&#183;", "-", t).rstrip(",")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]