home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Multimed / Multimed.zip / fest-141.zip / festival / lib / email-mode.scm < prev    next >
Text File  |  1999-05-30  |  4KB  |  90 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;                                                                       ;;
  3. ;;;                Centre for Speech Technology Research                  ;;
  4. ;;;                     University of Edinburgh, UK                       ;;
  5. ;;;                       Copyright (c) 1996,1997                         ;;
  6. ;;;                        All Rights Reserved.                           ;;
  7. ;;;                                                                       ;;
  8. ;;;  Permission is hereby granted, free of charge, to use and distribute  ;;
  9. ;;;  this software and its documentation without restriction, including   ;;
  10. ;;;  without limitation the rights to use, copy, modify, merge, publish,  ;;
  11. ;;;  distribute, sublicense, and/or sell copies of this work, and to      ;;
  12. ;;;  permit persons to whom this work is furnished to do so, subject to   ;;
  13. ;;;  the following conditions:                                            ;;
  14. ;;;   1. The code must retain the above copyright notice, this list of    ;;
  15. ;;;      conditions and the following disclaimer.                         ;;
  16. ;;;   2. Any modifications must be clearly marked as such.                ;;
  17. ;;;   3. Original authors' names are not deleted.                         ;;
  18. ;;;   4. The authors' names are not used to endorse or promote products   ;;
  19. ;;;      derived from this software without specific prior written        ;;
  20. ;;;      permission.                                                      ;;
  21. ;;;                                                                       ;;
  22. ;;;  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        ;;
  23. ;;;  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ;;
  24. ;;;  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ;;
  25. ;;;  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     ;;
  26. ;;;  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ;;
  27. ;;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ;;
  28. ;;;  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ;;
  29. ;;;  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ;;
  30. ;;;  THIS SOFTWARE.                                                       ;;
  31. ;;;                                                                       ;;
  32. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  33. ;;;
  34. ;;;  An example tts text mode for reading email messages, this includes
  35. ;;;  support for extracting the interesting headers from the message
  36. ;;;  and for dealing with quoted text.  Its all very primitive and
  37. ;;;  will easily be confused but its here just as an example
  38. ;;;
  39.  
  40. (define (email_init_func)
  41.  "(email_init_func)
  42. Called on starting email text mode."
  43.  (voice_rab_diphone)
  44.  (set! email_previous_t2w_func token_to_words)
  45.  (set! english_token_to_words email_token_to_words)
  46.  (set! token_to_words english_token_to_words)
  47.  (set! email_in_quote nil))
  48.  
  49. (define (email_exit_func)
  50.  "(email_exit_func)
  51. Called on exit email text mode."
  52.  (set! english_token_to_words email_previous_t2w_func)
  53.  (set! token_to_words english_token_to_words))
  54.  
  55. (define (email_token_to_words token name)
  56.   "(email_token_to_words utt token name)
  57. Email spcific token to word rules."
  58.   (cond
  59.    ((string-matches name "<.*@.*>")
  60.      (append
  61.       (email_previous_t2w_func token
  62.        (string-after (string-before name "@") "<"))
  63.       (cons 
  64.        "at"
  65.        (email_previous_t2w_func token
  66.     (string-before (string-after name "@") ">")))))
  67.    ((and (string-matches name ">")
  68.          (string-matches (item.feat token "whitespace") 
  69.              "[ \t\n]*\n *"))
  70.     (voice_don_diphone)
  71.     nil ;; return nothing to say
  72.    )
  73.    (t  ;; for all other cases
  74.      (if (string-matches (item.feat token "whitespace") 
  75.              ".*\n[ \n]*")
  76.      (voice_rab_diphone))
  77.      (email_previous_t2w_func token name))))
  78.  
  79. (set! tts_text_modes
  80.    (cons
  81.     (list
  82.       'email   ;; mode name
  83.       (list         ;; email mode params
  84.        (list 'init_func email_init_func)
  85.        (list 'exit_func email_exit_func)
  86.        '(filter "email_filter")))
  87.     tts_text_modes))
  88.  
  89. (provide 'email-mode)
  90.