[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SpeechIO-12] speechd v0.39
The "d/l" thing can be solved with something like:
$text =~ s/([a-zA-Z_0-9/]+)/$wordsub{$1} || $1/eg;
I'm really rough on my regexese, so I dunno if that syntax is right.
BTW, I was incorrect, substitutions currently will work on alphanumeric
strings, not just alphabetic strings.
The issue is, which characters would we want between the []'s.
On Mon, 9 Aug 1999, Kyle Burton wrote:
> This is another alternate, would it solve the 'd/l'?
>
> while(($k,$v)=each %subs) { s/\b$k\b/$v/g; }
Thats a really neat way to do a brute force, pretty close to doing a
foreach $key in %hash. Although if we were to go with that, I think it'd
be better to just do:
while(($k,$v)=each %subs) { s/$k/$v/g; }
> Hmm...maybe not, what if we build a search/replace string out of the keys?
>
> something like this:
>
> $search = join('|',keys(%subs));
> $text =~ s/$search/$wordsub{$1}/eg;
Now that one's got serious potential. Didn't know you could do that.
Looked it up. I'm getting warm fuzzies.
> "Perl combines all of the worst aspects of BASIC, C and line noise."
That is cute :)
Oh... noise.
/me flips through the camel book.
There it is, page 75, at the bottom:
tr [\200-\377]
[\000-\177]; # delete 8th bit
Gotta do that. Or should we strip all characters over 7 bits ?
(for those not familiar w/ this stuff, anything over 7 bits is generally
binary data, not text)
That doesn't look right... shouldn't it be...
tr [\128-\255]
[\000-\127];
?
__________________________________________________________________
PGP fingerprint = 03 5B 9B A0 16 33 91 2F A5 77 BC EE 43 71 98 D4
darxus@op.net / http://www.op.net/~darxus
Far Beyond Reason