Intro

1. Complete Summary

1 The Goal
2 The Dictionary
2.1 FOSS French Dictionary
2.2 Lexique3
2.2.1 Lexique 3.21
2.2.2 Prénoms 1.00
2.3 Perl Script For Adaption to Lisp Structure
2.3.1 Prénoms Perl Script
2.3.2 Lexique Perl Script
2.4 Database Access Functions in Main Module
2.5 Verbs from Verbiste
2.5.1 The Database
2.5.2 Transformation for Lisp
2.6 Database Access Functions for Verbs
2.7 Faster Startup Time with Memory Image
2.8 Suffix Analysis
2.9 Summary: Unknown Words
3 Pretreatment
3.1 French Word Fusions
3.2 The prepare Function
4 Parsing with Rules
4.1 The Syntax Rules
4.2 Meta Rules
4.3 The Core Parsing Algorithm
4.4 Improvements to the Parsing Algorithm
4.5 The Memoization Facilitiy
5 Statistics - How to Kill Ambiguities
5.1 The Idea
5.2 The showRank function
6 Output
6.1 The Goal
6.2 Latex Trees
6.3 System Calls and Perl Picture creation
6.4 The clisp html and http Addon
6.5 The fnal cgi File
7 Installation and Confguration
7.1 CLISP
7.2 Latex
7.3 textogif and png
7.4 Apache Webserver Confguration
7.5 Last steps
8 Improvements for Future Versions
8.1 Regular Expressions in Rules
8.2 Automated Testing
8.3 Machine Learning
9 Credits

2. Dictionaries

2.1. The Core Dictionary

2.2. Extra Names Dictionary

2.3. All French Verbs

2.4. Analysis for Noun and Adjective Endings

2.5. Example of Lexicon Entries

  1. (setf(gethash "soigneux" *dict*)'((ADJ "soigneux" m NIL  ((NIL )) 2.48)))
  2. (setf(gethash "soignez" *dict*)'((VER "soigner" NIL  p  ((imp pre 2p)(ind pre 2p)()) 3.54)))
  3. (setf(gethash "soigniez" *dict*)'((VER "soigner" NIL  p  ((ind imp 2p)(sub pre 2p)()) 0.12)))
  4. (setf(gethash "soignons" *dict*)'((VER "soigner" NIL  p  ((ind pre 1p)()) 0.06)))
  5. (setf(gethash "soignèrent" *dict*)'((VER "soigner" NIL  p  ((ind pas 3p)()) 0.27)))
  6. (setf(gethash "soignés" *dict*)'((ADJ "soigné" m p ((NIL )) 1.15)(VER "soigner" m p ((par pas)()) 1.47)))
  7. (setf(gethash "soi-même" *dict*)'((PRO_per "soi-même" NIL  s ((NIL )) 34.47)))
  8. (setf(gethash "soin" *dict*)'((NOM "soin" m s ((NIL )) 112.94)))
  9. (setf(gethash "soins" *dict*)'((NOM "soin" m p ((NIL )) 36.51)))
  10. (setf(gethash "soir" *dict*)'((NOM "soir" m s ((NIL )) 1082.25)))
  11. (setf(gethash "soirée" *dict*)'((NOM "soirée" f s ((NIL )) 153.61)))
  12. (setf(gethash "soirées" *dict*)'((NOM "soirée" f p ((NIL )) 25.98)))
  13. (setf(gethash "soirs" *dict*)'((NOM "soir" m p ((NIL )) 53.12)))
  14. (setf(gethash "sois" *dict*)'((AUX "être" NIL  s  ((sub pre 2s)()) 61)(VER "être" NIL  s  ((imp pre 2s)(sub pre 1s)(sub pre 2s)()) 248.05)))
  15. (setf(gethash "soissonnais" *dict*)'((ADJ "soissonnais" m NIL  ((NIL )) 0.07)(NOM "soissonnais" m NIL  ((NIL )) 0.14)))
  16. (setf(gethash "soit" *dict*)'((AUX "être" NIL  s  ((sub pre 3s)()) 182.88)(VER "être" NIL  s  ((sub pre 3s)()) 474.86)(CON "soit" NIL  NIL  ((NIL )) 98.76)(ADV "soit" NIL  NIL  ((NIL )) 18.46)))
  17. (setf(gethash "soixantaine" *dict*)'((NOM "soixantaine" f s ((NIL )) 4.95)))

3. Simple Syntactic Rules for a French Parser in Lisp

  1. #|
  2. -- Categories: --
  3. ADJ     Adjectif
  4. ADJ_dem Adjectif demonstratif: ce cette cet, sont des SDETerminant
  5. ADJ_ind Adjectif indéfini: chaque, différentes, mainte
  6. ADJ_num Adjectif numérique
  7. ADJ_pos Adjectif possessif
  8. ADV Adverbe
  9. ART_def Article défini
  10. ART_inf Article indéfini
  11. AUX Auxiliaire
  12. CON Conjonction
  13. NOM Nom commun
  14. ONO Onomatopée
  15.  
  16. PRE Préposition
  17. PRO_dem Pronom démonstratif
  18. PRO_ind Pronom indéfini
  19. PRO_int Pronom interrogatif
  20. PRO_per Pronom personnel
  21. PRO_rel Pronom relation
  22. VER Verbe
  23. |#
  24.  
  25. (defparameter *grammar*
  26.   '((DET -> ART_def)
  27.     (DET -> ART_inf)
  28.     (DET -> ADJ_dem)
  29.     (DET -> ADJ_pos)
  30.     (DET -> ADJ_ind)
  31.     (DET -> ADJ_num)
  32.     (GDET -> DET)
  33.     (GDET -> DET PRO_ind)
  34.     (SDET -> GDET)
  35.     (SDET -> PRO_ind GDET)
  36.  
  37.     (TITLE (-> title?) NOM)
  38.     (SN -> TITLE NOM)
  39.  
  40.     (GN (-> eqN? eqG?) SADJ NOM)
  41.     (GN (-> eqN? eqG?) NOM SADJ)
  42.     (GN (-> eqN? eqG?) SADJ NOM SADJ)
  43.     (GN -> NOM SP)
  44.     (GN -> NOM SP_sn)
  45.     (GN -> NOM)
  46.     (GN -> NOM PHCONJ)
  47.     (GN -> NOM PHREL)
  48.  
  49. ;   (GN (-> inf) VER) ; conflicting with: (SV_inf (-> inf) VER), perhaps this rule only with DET ?
  50.     (GN (-> inf) DET VER)
  51.  
  52.     (SN (-> eqN? eqG?) SDET GN)               
  53.     (SN -> PRO_per)
  54.     (SN -> PRO_rel)
  55.     (SN -> GN)
  56.     (SN -> ADJ_num)
  57.     (SN -> PRO_ind)
  58.     (SN -> SN virgule SN)
  59.     (SN (-> conjCoo?) SN CON SN)
  60.     (SN (-> conjCoo?) SN virgule SN CON SN)
  61.     (SN -> NOM_propre) ; added from prenom.txt
  62.  
  63.     (SADJ -> SADV ADJ)
  64.     (SADJ (-> conjCoo?) SADJ CON SADJ)
  65.     (SADJ -> ADJ)
  66.     ; for combined numbers like 'quatre mille'
  67.     (ADJ_numC -> ADJ_num ADJ_num)
  68.     (ADJ_numC -> ADJ_num ADJ_numC)
  69.     (DET -> ADJ_numC)
  70.  
  71.     (SADJ_ph -> ADJ SP)
  72.     (SADJ_ph -> ADV ADJ SP)
  73.  
  74.     (SADV (-> notNeg?) ADV)
  75.     (SADV (-> notNeg?) PRE ADV) ; depuis aujourd'hui
  76.     (SADV (-> notNeg?)  ADV SP)
  77.     (SADV (-> notNeg?) ADV PHCONJ) ; mieux 'que le dire'
  78. ;    (SADV -> PRE SV_inf) ; PRE is in SP!
  79.  
  80. ;------------------------------------
  81. ; Syntagme Prépositionel   
  82.     (GP -> PRE SN)
  83.     (GP -> PRE SV_inf) ; Il faut se coucher pour se reposer.
  84.     (GP_sv -> PRE_sv SV_inf)
  85.     (GP_sv -> PRE_sv SN)
  86.     (GP_sn -> PRE_sn SV_inf)
  87.     (GP_sn -> PRE_sn SN)
  88. ;    (SP (-> NconjCoo?) CON SN) ; pas une SP, mais PHCONJ
  89.     (SP -> ADV GP)
  90.     (SP -> GP)
  91.     (SP_sv -> ADV GP_sv)
  92.     (SP_sv -> GP_sv)
  93.     (SP_sn -> ADV GP_sn)
  94.     (SP_sn -> GP_sn)   
  95. ;------------------------------------
  96.  
  97.  
  98.     ;---------------------------
  99.     ; Syntagme Verbal
  100. ;    (SV (-> conjCoo?) SV CON SV)
  101.     (SV -> VER SN)
  102.     (SV -> VER SADV SN)
  103.     (SV -> VER SN SP)
  104.     (SV -> VER SN SP_sv) ; only here SP_sv is important, because of SN before, je donne le livre (à|de) Pierre.
  105.     (SV -> VER SADV SN SP)
  106.     (SV -> VER SADV SN SP_sv) ; only here SP_sv is important, because of SN before, je donne le livre (à|de) Pierre.
  107.     (SV -> VER SP)
  108.     (SV -> VER SP_sv); has to be here otherwise wrong solutions are more likely if together with AUX as with all other rules :/
  109.     (SV -> VER SADV SP)
  110.     (SV -> VER SADV SP_sv)
  111.     (SV -> VER SP SP)
  112.     (SV -> VER SP SP_sv)     (SV -> VER SP_sv SP)     (SV -> VER SP_sv SP_sv)
  113.  
  114.     (SV -> VER SADV SP SP)
  115.     (SV -> VER SADJ_ph)
  116.     (SV -> VER SADJ)
  117.     (SV -> VER)
  118.     (SV -> VER SV_inf) ; Ex.: Je veux aller à Sète.
  119.     (SV -> VER PHCONJ) ; veux que phrase
  120. ;- verb not directly used to compose SV:
  121.     (SV -> AUX SV)
  122.     (SV -> AUX SADV SV)
  123.     (SV (-> Pp=LeLaMeTe?) PRO_per SV)
  124.     (SV (-> conjCoo?)  SV CON SV)
  125.     ;---------------------------
  126.  
  127.     ;---------------------------
  128.     ; Syntagme Verbal with infinite verb, Ex: Je veux 'rester dans le soleil'.
  129.     (SV_inf (-> inf) VER)
  130.     (SV_inf (-> inf) VER SN)
  131.     (SV_inf (-> inf) VER SADV SN)
  132.     (SV_inf (-> inf) PRO_per SV_inf)
  133.     (SV_inf (-> inf) VER SN SP)
  134.     (SV_inf (-> inf) VER SN SP_sv)
  135.     (SV_inf (-> inf) VER SP)
  136.     (SV_inf (-> inf) VER SP_sv)
  137.     (SV_inf (-> inf) VER SP SP)
  138.     (SV_inf (-> inf) VER SP_sv SP)
  139.     (SV_inf (-> inf) VER SP SP_sv)
  140.     (SV_inf (-> inf) VER SP_sv SP_sv)
  141.     (SV_inf (-> inf) VER SADJ_ph)
  142.     (SV_inf (-> inf) VER SADJ)
  143.    ;(SV_inf (-> inf) VER SV) ;test if this rule is ok for avoir lu (INF + SV)
  144.     ;---------------------------
  145.  
  146.     ;---------------------------
  147.     ; Negation
  148.     (VER (-> ADV=neg?) ADV VER ADV)
  149.     (AUX (-> ADV=neg?) ADV AUX ADV)
  150.     (SV (-> ADV=neg?) ADV PRO_per SV ADV)
  151.     ; non negative ne
  152.     (VER (-> ADV=ne?) ADV VER)
  153.     (AUX (-> ADV=ne?) ADV AUX)
  154.     (SV (-> ADV=ne?) ADV PRO_per SV)
  155.     ;---------------------------
  156.  
  157.    ;---------------------------
  158.    ; Ex: Je veux 'que nous allons'. SN: le fait 'que il travail' SADV: mieux que le dire
  159.     (PHCONJ (-> NconjCoo?) CON PH_sub)
  160.     (PHCONJ (-> NconjCoo?) CON SN)
  161.    ;---------------------------
  162.  
  163.   ;---------------------------
  164.   ; Phrase Relative
  165.     (PHREL -> PRO_rel SV)
  166.     (PHREL -> PRO_rel SV SADV)
  167.     (PHREL (-> conjCoo?) PRO_rel SV CON SV)
  168.     (PHREL (-> conjCoo?) PRO_rel SV SADV CON SV)
  169. ;    (PHREL (-> conjCoo?) PRO_rel SV SADV CON SV)
  170.  
  171.     (PH_sub (-> eqN?) SN SV)
  172.     (PH_sub (-> eqN?) SN SV SADV)
  173.     (PH_sub (-> conjCoo?) PH_sub CON PH_sub)
  174.     (PH_sub (-> conjCoo?) PH_sub virgule PH_sub)
  175.     (PH_sub -> PRE SV_inf);après avoir lu le journal, il ...
  176.  
  177.     (PH (-> eqN?) SN SV POINT)
  178.     (PH -> SN SV SADV POINT)
  179.     (PH -> SADV SN SV POINT)
  180.     (PH (-> conjCoo?) PH_sub CON PH_sub POINT)
  181.     (PH (-> conjCoo?) PH_sub virgule PH_sub POINT)
  182.     (PH -> CON PH) ; Ex: Mais je veux aller! or add CON for each rule?
  183.     (PH_imp -> SV POINT) ; Imperative Phrases, Ex: Supprime ce dernier fichier.
  184.  
  185.     ;---------------------------
  186.     ; Questions with Inversion: Coppied from  normal SV-rules, but VER and SN changed
  187.     (SV_Q (-> conjCoo?) SV CON SV)
  188.     (SV_Q -> SN SN)
  189.     (SV_Q -> SN SADV SN)
  190.     (SV_Q -> SN SN SP)    (SV_Q -> SN SN SP_sv)
  191.     (SV_Q -> SN SP) (SV_Q -> SN SP_sv)
  192.     (SV_Q -> SN SP SP) (SV_Q -> SN SP_sv SP) (SV_Q -> SN SP SP_sv) (SV_Q -> SN SP_sv SP_sv)
  193.     (SV_Q -> SN SADJ_ph)
  194.     (SV_Q -> SN SADJ)
  195.     (SV_Q -> SN)
  196.     (SV_Q -> SN SV_inf) ; Ex.: veux-tu aller à Sète?
  197.     (SV_Q -> SN PHCONJ) ; veux que phrase
  198.     (SV_Q -> SN SV); dangerous, but needed for: A-t-il trouvé son sac?
  199.  
  200.     (PH_Q (-> eqN?) SV SV_Q PointInterrogation)
  201.     (PH_Q -> SV SV_Q SADV PointInterrogation)
  202.     (PH_Q (->eqN?) AUX SV_Q PointInterrogation)
  203.     (PH_Q (->eqN?) AUX SV_Q SADV PointInterrogation)
  204.  
  205.     (PH_Q -> SADV SV SV_Q PointInterrogation)
  206.     ;(Question (-> est-ceQue?) ADV SN SV PointInterrogation) ; for all other cases too... not needed
  207.     ;---------------------------
  208.  
  209. ;-------------------
  210. ; Indirect Speech
  211. ;------------------
  212.     (PH -> PH_sub 2points D_cit PH_sub F_cit POINT)
  213.     (PH -> PH_sub 2points  SV POINT)
  214.     ;---------------------------
  215.  
  216.     (PH -> ONO POINT) ; Ah!
  217.     ))