forked from apertium/apertium-kaz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rkt
41 lines (33 loc) · 1.2 KB
/
main.rkt
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
#lang racket
; Racket interface for apertium-kaz
;
; REQUIRES: apertiumpp package.
; https://taruen.github.io/apertiumpp/apertiumpp/ gives info on how to install
; it.
(provide kaz-morph kaz-tagger kaz-tagger-deterministic kaz-disam kaz-disam-vislcg3)
(require pkg/lib
rackunit
rash
apertiumpp/streamparser)
(define (kaz-morph s)
(parameterize ([current-directory (pkg-directory "apertium-kaz")])
(rash
"echo (values s) | apertium -n -d . kaz-morph")))
(define (kaz-tagger s)
(parameterize ([current-directory (pkg-directory "apertium-kaz")])
(rash
"echo (values s) | apertium -n -d . kaz-tagger")))
(define (kaz-tagger-deterministic s)
(parameterize ([current-directory (pkg-directory "apertium-kaz")])
(regexp-replace* #rx"<@[a-z:]*>"
(rash
"echo (values s) | apertium -n -d . kaz-morph | cg-proc kaz.rlx.bin")
"")))
(define (kaz-disam s)
(parameterize ([current-directory (pkg-directory "apertium-kaz")])
(rash
"echo (values s) | apertium -n -d . kaz-disam | cg-conv -lcA")))
(define (kaz-disam-vislcg3 s)
(parameterize ([current-directory (pkg-directory "apertium-kaz")])
(rash
"echo (values s) | apertium -n -d . kaz-disam")))