sed space between captioned letters
I am using sed to feed festival TTS.
Is there a way to use sed to write a space [ ] between each letter in a CAPTIONED word of any length when all letters are captioned. USA -> U S A USA. -> U S A. USA. -> U S A (also OK to loose dots etc. because the outcome is only listened) XXXIIV -> X X X I I V Word -> Word - How to avoid space if only the first letter is captioned? |
Hi,
If I assume your example is relevant (there's not much info in your post) then this works: Code:
sed -r '/\<[A-Z]+\>/{s/./& /g;s/\.//}' infile The brown part changes individual characters to individual characters followed by a space. The blue part removes the trailing dot. Here's an example run: Code:
$ cat infile Hope this helps. |
Here is a solution in awk:
Code:
{ |
Quote:
My current "script" is in the next comment. |
Quote:
I am using Ubuntu 11.04 and sed --version GNU sed versio 4.2.1 My current "script" is: Code:
cat input.txt | sed 's/\-\{1,\}\|\–\{1,\}\|\?\{1,\}\|\!\{1,\}\|\;\{1,\}\|\:\{1,\}\|\,\{1,\}\|\.\{1,\}\|\^\{1,\}\|\"\{1,\}\|\/\{1,\}\|\«\{1,\}\|\»\{1,\}/\n\n/g' | sed 's/\§/pykälä/g' | sed 's/klo /kello /g' | iconv -f UTF-8 -t ISO8859-1 -c | text2wave -otype wav -eval '(language_finnish)' -o - | lame - output.mp3 |
Quote:
|
All times are GMT -5. The time now is 07:58 PM. |