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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;;                                                                       ;;
  3. ;;;                Centre for Speech Technology Research                  ;;
  4. ;;;                     University of Edinburgh, UK                       ;;
  5. ;;;                         Copyright (c) 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. ;;;                         Author: Alan W Black
  34. ;;;                         Date:   December 1997
  35. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  36. ;;;  
  37. ;;;  An English morpho-syntax finite-state grammar
  38. ;;;  This is used for morphological decomposition of unknown words
  39. ;;;  specifically (only) words that are not found in the lexicon.
  40. ;;;  This idea is that when an unknown word is found an attempt is made
  41. ;;;  to see if it contains any well known morphological inflections or
  42. ;;;  derivations, if so a better use of LTS can be made on the root, of
  43. ;;;  none are found this
  44. ;;;
  45. ;;;
  46. ;;;  Based on "Analysis of Unknown Words through Morphological 
  47. ;;;  Decomposition", Black, van de Plassche, Willians, European ACL 91.
  48. ;;;  with the anyword matcher from a question by Lauri Karttunen after
  49. ;;;  the talk.
  50. ;;;
  51. ;;;  The suffixes and finite-state morph-syntax grammar is based 
  52. ;;;  (very roughly) on the rules in "Computational Morphology"
  53. ;;;  Ritchie et al. MIT Press 1992.
  54. ;;;
  55. ;;;  Can be compiled with
  56. ;;;   wfst_build -type rg -o engmorphsyn.wfst -detmin engmorphsyn.scm
  57. ;;;
  58. ;;;  The result can be combined with the morphographemic rules 
  59. ;;;  with
  60. ;;;       wfst_build -type compose engmorph.wfst engmorphsyn.wfst -detmin -o engstemmer.wfst
  61. ;;;
  62. ;;;  echo "# b o x e/+ s #" | wfst_run -wfst engstemmer.wfst -recog
  63. ;;;  state 0 #/# -> 1
  64. ;;;  state 1 b/b -> 3
  65. ;;;  state 3 o/o -> 17
  66. ;;;  state 17 x/x -> 14
  67. ;;;  state 14 e/+ -> 36
  68. ;;;  state 36 s/s -> 34
  69. ;;;  state 34 #/# -> 16
  70. ;;;  OK.
  71. ;;;  echo "# b o x e s #" | wfst_run -wfst engstemmer.wfst -recog
  72. ;;;  state 0 #/# -> 1
  73. ;;;  state 1 b/b -> 3
  74. ;;;  state 3 o/o -> 17
  75. ;;;  state 17 x/x -> 14
  76. ;;;  state 14 e/e -> 22
  77. ;;;  state 22 s/s -> -1
  78.  
  79. (RegularGrammar
  80.  engsuffixmorphosyntax
  81.  ;; Sets 
  82.  (
  83.  (V a e i o u y)
  84.  (C b c d f g h j k l m n p q r s t v w x y z)
  85.  )
  86.  ;; Rules
  87.  
  88.  (
  89.  ;; A word *must* have a suffix to be recognized
  90.  (Word -> # Syls Suffix )
  91.  (Word -> # Syls End )
  92.  
  93.  ;; This matches any string of characters that contains at least one vowel
  94.  (Syls -> Syl Syls )
  95.  (Syls -> Syl )
  96.  (Syl -> Cs V Cs )
  97.  (Cs -> C Cs )
  98.  (Cs -> )
  99.  
  100.  (Suffix -> VerbSuffix )
  101.  (Suffix -> NounSuffix )
  102.  (Suffix -> AdjSuffix )
  103.  (VerbSuffix -> VerbFinal End )
  104.  (VerbSuffix -> VerbtoNoun NounSuffix )
  105.  (VerbSuffix -> VerbtoNoun End )
  106.  (VerbSuffix -> VerbtoAdj  AdjSuffix )
  107.  (VerbSuffix -> VerbtoAdj End )
  108.  (NounSuffix -> NounFinal End )
  109.  (NounSuffix -> NountoNoun NounSuffix )
  110.  (NounSuffix -> NountoNoun End )
  111.  (NounSuffix -> NountoAdj AdjSuffix )
  112.  (NounSuffix -> NountoAdj End )
  113.  (NounSuffix -> NountoVerb VerbSuffix )
  114.  (NounSuffix -> NountoVerb End )
  115.  (AdjSuffix -> AdjFinal End )
  116.  (AdjSuffix -> AdjtoAdj AdjSuffix)
  117.  (AdjSuffix -> AdjtoAdj End)
  118.  (AdjSuffix -> AdjtoAdv End)  ;; isn't any Adv to anything
  119.  
  120.  (End -> # )  ;; word boundary symbol *always* present
  121.  
  122.  (VerbFinal -> + e d)
  123.  (VerbFinal -> + i n g)
  124.  (VerbFinal -> + s)
  125.  
  126.  (VerbtoNoun -> + e r)
  127.  (VerbtoNoun -> + e s s)
  128.  (VerbtoNoun -> + a t i o n)
  129.  (VerbtoNoun -> + i n g)
  130.  (VerbtoNoun -> + m e n t)
  131.  
  132.  (VerbtoAdj -> + a b l e)
  133.  
  134.  (NounFinal -> + s)
  135.  
  136.  (NountoNoun -> + i s m)
  137.  (NountoNoun -> + i s t)
  138.  (NountoNoun -> + s h i p)
  139.  
  140.  (NountoAdj -> + l i k e)
  141.  (NountoAdj -> + l e s s)
  142.  (NountoAdj -> + i s h)
  143.  (NountoAdj -> + o u s)
  144.  
  145.  (NountoVerb -> + i f y)
  146.  (NountoVerb -> + i s e)
  147.  (NountoVerb -> + i z e)
  148.  
  149.  (AdjFinal -> + e r)
  150.  (AdjFinal -> + e s t)
  151.  
  152.  (AdjtoAdj -> + i s h)
  153.  (AdjtoAdv -> + l y)
  154.  (AdjtoNoun -> + n e s s)
  155.  (AdjtoVerb -> + i s e)
  156.  (AdjtoVerb -> + i z e)
  157.  
  158. )
  159. )
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.