lilypond-user
[Top][All Lists]
Advanced

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

Re: software for syllable separation


From: Bertalan Fodor
Subject: Re: software for syllable separation
Date: Wed, 21 Dec 2005 23:38:44 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

LilyPondTool for jEdit provides this, using OpenOffice dictionaries. However, the macro for it included is buggy, so you should use the attached BeanShell macro (it is very simple to use, just copy into the jEdit/macros directory, select the text to hyphenate and start from Macros>Hyphenate). Due to another bug you must restart jEdit after changing the OpenOffice dictionary setting (I have the dictionaries at C:\Program Files\OpenOffice.org 2.0\share\dict\ooo).

So, if you succed with install (it is easy!) it would hyphenate like this:

Are you walk -- ing alone through the shad -- ows dim?

So you must do manual hyphenation as well, because hyphenation is not for singing but for typesetting flow text. (That's why it doesn't make one-character syllables.) But it is still much better than nothing. In a future version, I think we could handle this one-letter-syllable issue.

You can get bad result with e.g. German, if you use the German hyphenation dict., but will get better, if you use the English dictionary for the German text:
German:
Es ist nun nichts Ver -- damm -- li -- ches an denen, die in Christo Jesu sind, die nicht
nach dem Fleische wandeln, son -- dern nach dem Geist
English:
Es ist nun nichts Ver -- damm -- lich -- es an de -- nen, die in Chris -- to Je -- su sind, die nicht
nach dem Fleis -- che wan -- deln, son -- dern nach dem Geist

*Still not perfect. But only one fault (or two, I dunno).
*
Bert

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 is a temporary macro. First, check over the
// commands to make sure this is what you intended.
// Then, to run this macro, switch to the buffer
// where you would like to execute it and press C+m C+p.

import mt.org.linux.textcheck.HyphEngine;

import lilytool.lyrics.HyphenUtils;

import lilytool.macrohelp.InputDialog;
import lilytool.LilyToolPlugin;
import lilytool.console.LilyPondShell;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

dlg=new InputDialog("Hyphenation", view);
language=jEdit.getProperty(LilyToolPlugin.OPTION_PREFIX + "lyrics.language");
locales=HyphenUtils.getAvailableLocales();
s=new ArrayList();
for (locale : locales) s.add(locale.getDisplayName());
Collections.sort(s);    
dlg.addInput("Language:", "language", language, s.toArray(), false);    
dlg.show();

vars=dlg.getContext();
if (!vars.get("cancelled")) {
        language=vars.get("language");
        
        jEdit.setProperty(LilyToolPlugin.OPTION_PREFIX + "lyrics.language", 
language);  
        for (l : locales) {
                if (l.getDisplayName().equals(language)) {
                        locale=l; break;
                }
        }
        
        text=textArea.getSelectedText();
        if (text!=null) {       
                hText=HyphenUtils.hyphenate(text, locale);
                // {{{ Hungarian double consonants
                if (language.equals("magyar")) {
                        hText = hText.replaceAll("ccs", "cs-cs");
                        hText = hText.replaceAll("ddz", "dz-dz");
                        hText = hText.replaceAll("ddzs", "dzs-dzs");
                        hText = hText.replaceAll("ggy", "gy-gy");
                        hText = hText.replaceAll("lly", "ly-ly");
                        hText = hText.replaceAll("nny", "ny-ny");
                        hText = hText.replaceAll("tty", "ty-ty");
                        hText = hText.replaceAll("ssz", "sz-sz");
                        hText = hText.replaceAll("zzs", "zs-zs");
                }
                // }}}
                hText = hText.replace(HyphEngine.SOFT_HYPHEN, '-');
                hText = hText.replaceAll("-", " -- ");
                textArea.setSelectedText(hText);                
        }
}

reply via email to

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