-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwords.lisp
33 lines (26 loc) · 1.05 KB
/
words.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
(in-package :wordnet)
;; working with words
(defun process-word (old lf ns n)
(let ((uri (resource
(if (> n 0)
(format nil "word-~a-~a" lf n)
(format nil "word-~a" lf)) ns)))
(if (or (get-triples-list :s uri) (get-triples-list :o uri))
(process-word old lf ns (1+ n))
(merge-nodes old uri))))
(defun rename-all-blank-pt-words (&key (ns "wn30pt"))
(let ((result (run-query-as-list "pt-blank-words.sparql")))
(dolist (w result)
(process-word (car w) (clean-up-word (upi->value (cadr w))) ns 0))))
(defun rename-all-blank-en-words (&key (ns "wn30en"))
(let ((result (run-query-as-list "en-blank-words.sparql")))
(dolist (w result)
(process-word (car w) (clean-up-word (upi->value (cadr w))) ns 0))))
(defun rename-all-blank-words ()
(rename-all-blank-en-words)
(rename-all-blank-pt-words))
(defun clean-orphan-words ()
(let ((result (mapcar #'car (run-query-as-list "words-orphan.sparql")))
(res nil))
(dolist (w result res)
(push (delete-triples :s w) res))))