source:
src/compdic/compdic-fst-to-bin
@
ab65d57
Last change on this file since ab65d57 was f600a02, checked in by Tomasz Obrebski <obrebski@…>, 11 years ago | |
---|---|
|
|
File size: 1.1 KB |
Line | |
---|---|
1 | #!/bin/bash |
2 | |
3 | if [ $# -lt 2 ] |
4 | then |
5 | echo "Usage:" |
6 | echo " compdic-fst-to-bin <fstautomaton> <binautomaton>" |
7 | echo "where" |
8 | echo " <fstautomaton> - file containig automaton in openfst format" |
9 | echo " <binautomaton> - a file to which the compiled binary automaton (lem/cor/kor format) shoul be written" |
10 | exit 0 |
11 | fi |
12 | |
13 | tempdir=`mktemp -d /tmp/compdic.XXXXXX` |
14 | |
15 | alphabet=`tempfile -d $tempdir` |
16 | |
17 | cat <<EOF > $alphabet |
18 | <eps> 0 |
19 | a 1 |
20 | A 2 |
21 | ä 3 |
22 | ± 4 |
23 | ¡ 5 |
24 | b 6 |
25 | B 7 |
26 | c 8 |
27 | C 9 |
28 | æ 10 |
29 | Æ 11 |
30 | d 12 |
31 | D 13 |
32 | e 14 |
33 | E 15 |
34 | é 16 |
35 | ê 17 |
36 | Ê 18 |
37 | f 19 |
38 | F 20 |
39 | g 21 |
40 | G 22 |
41 | h 23 |
42 | H 24 |
43 | i 25 |
44 | I 26 |
45 | j 27 |
46 | J 28 |
47 | k 29 |
48 | K 30 |
49 | l 31 |
50 | L 32 |
51 | ³ 33 |
52 | £ 34 |
53 | m 35 |
54 | M 36 |
55 | n 37 |
56 | N 38 |
57 | ñ 39 |
58 | Ñ 40 |
59 | o 41 |
60 | O 42 |
61 | ö 43 |
62 | ó 44 |
63 | Ó 45 |
64 | p 46 |
65 | P 47 |
66 | q 48 |
67 | Q 49 |
68 | r 50 |
69 | R 51 |
70 | s 52 |
71 | S 53 |
72 | ¶ 54 |
73 | Š 55 |
74 | t 56 |
75 | T 57 |
76 | u 58 |
77 | U 59 |
78 | ü 60 |
79 | v 61 |
80 | V 62 |
81 | w 63 |
82 | W 64 |
83 | x 65 |
84 | X 66 |
85 | y 67 |
86 | Y 68 |
87 | z 69 |
88 | Z 70 |
89 | Œ 71 |
90 | ¬ 72 |
91 | ¿ 73 |
92 | ¯ 74 |
93 | 0 75 |
94 | 1 76 |
95 | 2 77 |
96 | 3 78 |
97 | 4 79 |
98 | 5 80 |
99 | 6 81 |
100 | 7 82 |
101 | 8 83 |
102 | 9 84 |
103 | _ 85 |
104 | - 86 |
105 | ? 87 |
106 | ! 88 |
107 | ~ 89 |
108 | ; 90 |
109 | , 91 |
110 | / 92 |
111 | * 93 |
112 | + 94 |
113 | Ö 95 |
114 | EOF |
115 | |
116 | cat $1 | fstrmepsilon | fstdeterminize | fstminimize | fstprint --acceptor --isymbols=$alphabet | fsm2aut | aut2fsa > $2 |
117 | rm -r $tempdir |
118 | |
119 | #echo generating cats file ... |
120 | |
121 | #cat $1 | cut -d ',' -f 2 | sort -u $2.cats |
Note: See TracBrowser
for help on using the repository browser.