-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.lisp
58 lines (47 loc) · 1.73 KB
/
update.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;;;; make-mod-ont-json.lisp
;;;; load into running gloss system, call (send-define-msgs) to read define-type and define-words messages from files, send them into the system, and then call (write-json)
;;;; William de Beaumont
;;;; 2019-12-16
(load "test")
(dfc:defcomponent :json :use (:util :common-lisp) :system (:depends-on (:util :lxm :om) :components nil))
(defvar *define-type-and-words-file* #!TRIPS"src;messages.kqml")
(defun send-define-msgs (msg args)
(declare (ignore msg args))
(with-open-file (f *define-type-and-words-file* :direction :input)
(loop for dm = (read f nil nil)
while dm
do (send-msg dm))))
(defcomponent-handler '(request &key :content (send-define-msgs . *)) #'send-define-msgs :subscribe t)
(in-package :cl-user)
(defun send-define-msgs ()
(comm::send 'test '(request :content (send-define-msgs))))
(defvar *out-dir* #!TRIPS"src;jsontrips;dist")
(defun write-json ()
(if (probe-file #!TRIPS"src;messages.kqml")
(progn
(format t "Sending messages")
(send-define-msgs)
(format t "sleeping for a bit")
(sleep 20)
(format t "sleeping for a bit")
(sleep 20)
(format t "sleeping for a bit")
(sleep 20)
(format t "sleeping for a bit")
(sleep 20)
(format t "sleeping for a bit")
(sleep 20)
(format t "sleeping for a bit")
(sleep 20)
))
(format t "Writing ontology\n")
(load #!TRIPS"src;jsontrips;lisp;genontology.lisp")
(om::write-all-ontology *out-dir*)
(format t "Writing lexicon\n")
(load #!TRIPS"src;jsontrips;lisp;genlexicon.lisp")
(lxm::write-all-lexicon *out-dir*)
(format t "done!\n")
)
(trips:process-run-function :json #'dfc:run-component :json)
(run)
(write-json)