-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-smadict
79 lines (68 loc) · 1.91 KB
/
make-smadict
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
# -*- mode: Makefile -*-
# Makefile to make smadict.fst
# the fst just recognises all lemmas in the smanob dictionary
# it does __not__ translate them.
# usage.
# make -f make-smadict
# pseudocode:
# read all lexicon files
# pick the lemmas
# save as smalemmalist.txt
# open xfst
# run command "read text < smalemmalist.txt"
# save result as smadict.fst
# the resulting fst to be used to test dict content
XFST = xfst
LEX = src/a_smanob.xml \
src/adv_smanob.xml \
src/cc_smanob.xml \
src/cs_smanob.xml \
src/i_smanob.xml \
src/misc_stat_smanob.xml \
src/multiword_smanob.xml \
src/propPl_smanob.xml \
src/n_smanob.xml \
src/num_smanob.xml \
src/pcle_smanob.xml \
src/pronDem_stat_smanob.xml \
src/pronIndef_smanob.xml \
src/pronPers_stat_smanob.xml \
src/pronRec_stat_smanob.xml \
src/pronRefl_stat_smanob.xml \
src/pronRel_stat_smanob.xml \
src/prop_smanob.xml \
src/pr_smanob.xml \
src/po_smanob.xml \
src/vCop_stat_smanob.xml \
src/vNeg_stat_smanob.xml \
src/v_smanob.xml
smadict.fst: bin/smadict.fst
bin/smadict.fst: bin/smadict.save
@echo
@echo "*** Building smadict.fst ***"
@echo
@printf "read regex [ @\"$<\" .o. \
[ ï (<-) i , ö (<-) ø , æ (<-) ä , Ï (<-) I , Ö (<-) Ø , Æ (<-) Ä ]] ; \n\
save stack $@ \n\
quit \n" > ../tmp/smadict-fst-script
@echo "*** Done script, at least. ***"
$(XFST) < ../tmp/smadict-fst-script
@rm -f ../tmp/smadict-fst-script
smadict.save: bin/smadict.save
bin/smadict.save: bin/smalemmalist.txt
@echo
@echo "*** Building smadict.save ***"
@echo
@printf "read text $< \n\
save stack $@ \n\
quit \n" > ../tmp/smadict-save-script
$(XFST) < ../tmp/smadict-save-script
@rm -f ../tmp/smadict-save-script
smalemmalist.txt: bin/smalemmalist.txt
bin/smalemmalist.txt: $(LEX)
@cat $(LEX) | \
egrep '<l(sub| )' | \
cut -d">" -f2 | \
cut -d"<" -f1 > bin/smalemmalist.txt
clean:
@rm -f bin/smalemmalist.txt bin/smadict.fst