[Asterisk-Users] Festival questions

Tzafrir Cohen tzafrir at cohens.org.il
Thu Jul 14 18:23:58 MST 2005


On Thu, Jul 14, 2005 at 03:58:12PM -0700, Chris Albertson wrote:
> 
> I was working on something like this.  There are a few
> isues:
> 
> (1) First off yes you have to have access to the tesxt of the
> e-mail.  Notice the word "test" we don't want html or
> MS word atachments.

If you really must face those, you can identify them by mime type and
apply a proper filter. 'lynx -dump' for html, antiword for ms-word, etc.

For OpenOffice docs it is quite easy to extract all the text, at the
cost of losing all the formatting:

#!/bin/sh

tmpfile=`mktemp` || exit 1

cat >$tmpfile

unzip -p $tmpfile content.xml \
|  sed -e 's|<text:p |\n\n&|g' -e 's|<[^>]*>||g' \
| sed -e 's|\&quot;|"|g'

rm $tmpfile



> 
> (2) Next look below nice al the silly junk like quotes are
> indicated by >> marks.  This has to be converted.
> The the "ascii art" in the sig line.   OK this is not hard
> just a whole bunch of Perl scripting or if you are really nuts
> like me try lex/yaac to define an "e-mail grammer"
> There is much to be done here basically we are building a
> "script" that any reader (human or machine) would be able
> to read into a telephone.  The BEST format to use a voice
> markup language not plain text.  Festival can read the
> markup language

Heer's something to get you started:

$ apt-cache show t-prot
[snip]
Depends: perl (>= 5.6.0-16), libgetopt-mixed-perl, liblocale-gettext-perl
[snip]
Description: display filter for RFC822 messages
 This program is a filter which shall improve the readability for messages
 (email and posts) by *hiding* some annoying parts, e.g. mailing list footers,
 signatures and TOFU as well as squeezing sequences of blank lines or
 punctuation.
 .
 TOFU is an acronym that stands for "Text oben, Fullquote unten" (german
 language) which means the style of sadly so many people that just leave all
 the quotes in a reply and add some own lines above. This acronym is what gave
 the script its name - TOFU Protection.
 .
 It currently offers hints how to include it within mutt, slrn or inn2. It
 should be possible to do similars with other programs that allow to have a
 message run through a filter before it's displayed. If you use such a program
 we'd be interested if you could let us know of your setup.

-- 
Tzafrir Cohen         | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il |                           | a Mutt's  
tzafrir at cohens.org.il |                           |  best
ICQ# 16849755         |                           | friend



More information about the asterisk-users mailing list