source: project/release/4/jbogenturfahi/trunk/wordlists/cmavo.scm @ 22199

Last change on this file since 22199 was 22199, checked in by Alan Post, 10 years ago

jbogenturfa'i: add database creation script.

We parse the wordlists/cmavo.scm file and upload the contents into
the cmavo table in the database.

File size: 2.7 KB
Line 
1;;;;
2;;;; jbogenturfahi - lo lojbo ke pe'a jajgau ratcu ke'e genturfa'i
3;;;;               `-> A Lojban grammar parser
4;;;;
5;;;; Copyright (c) 2010 ".alyn.post." <alyn.post@lodockikumazvati.org>
6;;;;
7;;;; Permission to use, copy, modify, and/or distribute this software for any
8;;;; purpose with or without fee is hereby granted, provided that the above
9;;;; copyright notice and this permission notice appear in all copies.
10;;;;
11;;;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12;;;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13;;;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14;;;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15;;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16;;;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17;;;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18;;;;
19
20(set! gerna #<<EOS
21{(no-memoize "CRLF")}
22
23cfari       <- `((!CRLF .)* CRLF) lerpinsle* `FAhO
24
25lerpinsle   <- rafsi selmaho short long `CRLF?
26            -> {(lambda (rafsi selmaho short long) `(,rafsi ,@selmaho))}
27
28rafsi       <- [[:jbole'u:][:jboca'u:]]
29               [[:jbole'u:][:jboca'u:]]
30               [[:jbole'u:][:jboca'u:]]
31               [[:jbole'u:][:jboca'u:]]
32               [[:jbole'u:][:jboca'u:]]
33               [[:jbole'u:][:jboca'u:]]
34               [[:jbole'u:][:jboca'u:]]
35               [[:jbole'u:][:jboca'u:]]
36               [[:jbole'u:][:jboca'u:]]
37               [[:jbole'u:][:jboca'u:]]
38               [[:jboca'u:]]
39            -> {(lambda lerfu
40                  (string-trim-both
41                    (apply string (remove (curry char=? #\space) lerfu))
42                    #\.))}
43
44selmaho     <- [[:upper:]h]+
45               `#\*?
46               [[:digit:]]?
47               canlu
48            -> {(lambda (selmaho series)
49                  `(,selmaho ,(if (char? series)
50                                  (string->number (string series))
51                                  0)))}
52
53short       <- (canlu-lerfu !canlu-lerfu / (!canlu-lerfu .))+
54               canlu
55
56long        <- (!EOL .)+
57
58canlu       <- `canlu-lerfu*
59canlu-lerfu <- [[:space:]]
60
61EOL           <- CRLF
62               / &FAhO
63
64CRLF        <- CR LF / CR / LF
65CR          <- #\return
66LF          <- #\linefeed
67
68FAhO        <- !.
69EOS
70)
71
72(let* ((samselpla      (genturfahi-peg gerna))
73       (gerna          (genturfahi (eval samselpla)))
74       (cmavo          (call-with-input-file "wordlists/cmavo.txt" gerna)))
75
76  (cmavo:drop-table)
77  (cmavo:create-table)
78
79  (call-with-values
80    cmavo:gen-insert
81    (lambda (insert cleanup)
82      (map-apply insert cmavo)
83      (cleanup))))
Note: See TracBrowser for help on using the repository browser.