-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-smedict
120 lines (101 loc) · 2.78 KB
/
make-smedict
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# -*- mode: Makefile -*-
# Makefile to make smedict.fst
# the fst just recognises all lemmas in the smenob dictionary
# it does __not__ translate them.
# usage.
# make -f make-smedict smedict.fst
# make -f make-smedict vddict.fst
# make -f make-smedict nonvddict.fst
# pseudocode:
# read all lexicon files
# pick the lemmas
# save as *lemmalist.txt
# open xfst
# run command "read text < *lemmalist.txt"
# save result as *dict.fst
# the resulting fst to be used to test dict content
XFST = xfst
JV = java
MF = -Xmx2048m
EF = -it:main
XSL = net.sf.saxon.Transform
SRC = src
BIN = bin
SCRIPTS = ../scripts
DICT = get-lemma.xsl
VDDICT = get-vd-lemma.xsl
NONVDDICT = get-nonvd-lemma.xsl
BEGIN = @echo "*** Generating $@-file ***"
END = @echo "Done."
CLEAN = @echo "Cleaning files."
smedict_a_tolerant.fst: bin/smedict_a_tolerant.fst
bin/smedict_a_tolerant.fst: bin/smedict.fst
@echo
@echo "*** Building smedict_a_tolerant.fst ***"
@echo
@printf "read regex [ @\"$<\" .o. \
[ á (<-) a , Á (<-) A ]] ; \n\
save stack $@ \n\
quit \n" > ../tmp/smedict-tolerant-script
@echo "*** Done script, at least. ***"
$(XFST) < ../tmp/smedict-tolerant-script
@rm -f ../tmp/smedict-tolerant-script
smedict.fst: bin/smedict.fst
bin/smedict.fst: bin/smelemmalist.txt
@echo
@echo "*** Building smedict.fst ***"
@echo
@printf "read text $< \n\
save stack $@ \n\
quit \n" > ../tmp/smedict-fst-script
$(XFST) < ../tmp/smedict-fst-script
@rm -f ../tmp/smedict-fst-script
smelemmalist.txt: bin/smelemmalist.txt
bin/smelemmalist.txt: $(SRC) \
$(SCRIPTS)/$(DICT)
@echo
$(BEGIN)
$(JV) $(MF) $(XSL) $(EF) $(SCRIPTS)/$(DICT) dir=../smenob/$< > ../smenob/$@
@echo
$(END)
@echo
vddict.fst: bin/vddict.fst
bin/vddict.fst: bin/vdlemmalist.txt
@echo
@echo "*** Building vddict.fst ***"
@echo
@printf "read text $< \n\
save stack $@ \n\
quit \n" > ../tmp/vddict-fst-script
$(XFST) < ../tmp/vddict-fst-script
@rm -f ../tmp/vddict-fst-script
vdlemmalist.txt: bin/vdlemmalist.txt
bin/vdlemmalist.txt: $(SRC) \
$(SCRIPTS)/$(VDDICT)
@echo
$(BEGIN)
$(JV) $(MF) $(XSL) $(EF) $(SCRIPTS)/$(VDDICT) dir=../smenob/$< > ../smenob/$@
@echo
$(END)
@echo
nonvddict.fst: bin/nonvddict.fst
bin/nonvddict.fst: bin/nonvdlemmalist.txt
@echo
@echo "*** Building nonvddict.fst ***"
@echo
@printf "read text $< \n\
save stack $@ \n\
quit \n" > ../tmp/nonvddict-fst-script
$(XFST) < ../tmp/nonvddict-fst-script
@rm -f ../tmp/nonvddict-fst-script
nonvdlemmalist.txt: bin/nonvdlemmalist.txt
bin/nonvdlemmalist.txt: $(SRC) \
$(SCRIPTS)/$(NONVDDICT)
@echo
$(BEGIN)
$(JV) $(MF) $(XSL) $(EF) $(SCRIPTS)/$(NONVDDICT) dir=../smenob/$< > ../smenob/$@
@echo
$(END)
@echo
clean:
@rm -f bin/*.txt bin/*.fst