Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Re: need help in building voice file

Re: need help in building voice file

From: Jonas Häggqvist <rasher_at_rasher.dk>
Date: Mon, 17 Sep 2007 13:28:48 +0200

RaZorbacK wrote:
> hi,
>
>
> Liz Q écrivait Le 10/09/2007 01:36 :
>> Yes its regex, the s means swap , the g means global (swap item 1 with
>> item 2 in the whole string not just the first instance)
>> So $string =~ s/MPEG Layer/MP/g; means swap the words "MPEG Layer"
>> with "MP" anytime it sees it in $string.
>>
> wow it's nice it would be great if i learn this. :)
>
> so have you got the time to help me put this section in the pl script? I
> don't understand those "case" and those {} mean.

The following perl code:

switch($foo) {
    case "bar" {
    }
    case "baz" {
    }
}

This means look at the variable $foo and go through all case statements and
check if that variable is matched by the string following the case. If it
does, execute everything in the {} after that case line. So to add something
for French, you'd add the following:

case "french" {
    $string =~ s/string/replacement/g;
}

For more information on Perl, see http://perldoc.perl.org/

> later, it may be a good idea to add srings in some kind of separate
> dictionnary file that the script could use.

I don't see how this "dictionary file" would be much different from the
current perl code put into a separate file. If you're unable to deduct how
to add new sections to the current code, I don't think a "dictionary file"
(which would probably be a multidimensional list of regular expressions)
would make things any easier.

-- 
Jonas Häggqvist
rasher(at)rasher(dot)dk
Received on 2007-09-17

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy