;;;-*- Mode: Lisp; Package: CL-USER -*-
(in-package "CL-USER")
#+ignore
(eval-when (:execute :compile-toplevel :load-toplevel)
(um:use-module :text-utlis "projects:utilities;text-utils"))
(mk :sql)
(use-package :sql)
(initialize-database-type)
(enable-sql-reader-syntax)
(connect "Oslotagger" :user-id "paulm" :password "gvprckvnis" :if-exists :warn-old)
#+test
(do-query ((line)
[select [conc [oppslag] ":" [paradigme-id] ":" [boy-nummer] ":" [grammatikk]]
:from [taggeadm-nn v-tagger-tag]
:where [apply 'or
(loop for tag
in '("<" "" "" "" ""
"" "" "" ""
"" "" "<.trans11/med>" ""
"" "" "" "" ""
"" "/opp>" "" "<>" ""
"" "" "" "
" ""
"" "" ""
"" "" "" ""
"veg>" "" "" "" ""
"" "" "" "" ""
"" "refl4>" "" "" "" ""
"*verb" "" "" "v+v" "perf-part." "nøut" "eint/fl"
"subst+v+subst" "susbt" "refl")
collect [like [grammatikk] (u:concat "% " tag " %")]
collect [like [grammatikk] (u:concat tag " %")]
collect [like [grammatikk] (u:concat "% " tag)]
collect [like [grammatikk] ?tag])]] )
(print line))
(select [table-name] :from [all-tables] :where [= [owner] "TAGGEADM_NN"] :flatp t)
(select [conc [oppslag] ":" [grammatikk]]
:from [taggeadm-nn v-tagger-fullform]
:where [like [grammatikk] "%eint/fl%"] :flatp t)
(let ((count 0))
(with-open-file (stream "projects:cgp;nets;fullforms+tags-nn.txt"
:direction :output :if-exists :supersede :if-does-not-exist :create)
(do-query ((line)
[select [conc [oppslag] ":" [grammatikk]]
:from [taggeadm-nn v-tagger-fullform]])
(when (zerop (mod (incf count) 1000)) (print count))
(write-line line stream))))
(let ((count 0))
(with-open-file (stream "projects:cgp;multitagger;fullforms+tags.txt"
:direction :output :if-exists :supersede :if-does-not-exist :create)
(do-query ((line)
[select [conc [oppslag] ":" [grammatikk]]
:from [tagger v-tagger-fullform]])
(when (zerop (mod (incf count) 1000)) (print count))
(write-line line stream))))
(let ((count 0))
(with-open-file (stream "projects:cgp;multitagger;nn-lexicon.txt"
:direction :output :if-exists :supersede :if-does-not-exist :create)
(do-query ((line)
[select [conc [oppslag] ":" [paradigme-id] ":" [boy-nummer] ":" [grammatikk]]
:from [tagger v-tagger-tag]])
(when (zerop (mod (incf count) 1000)) (print count))
(write-line line stream))))
(let ((count 0))
(with-open-file (stream "projects:cgp;nets;tags-nn.txt"
:direction :output :if-exists :supersede :if-does-not-exist :create)
(do-query ((line)
[select [conc [oppslag] ":" [paradigme-id] ":" [boy-nummer] ":" [grammatikk]]
:from [taggeadm-nn v-tagger-tag]])
(when (zerop (mod (incf count) 1000)) (print count))
(write-line line stream))))
(block test
(let ((count 0))
(with-open-file (stream "projects:cgp;bm-lexicon.txt"
:direction :output :if-exists :supersede :if-does-not-exist :create)
(u::with-file-lines (line "projects:cgp;tags.txt")
(format stream "~a~%" line)
#+ignore
(when (= (incf count) 100)
(return-from test))))))