Debian Codegraph @

src/02-LTSMake/build_lts_rules

raw
1 #!/bin/sh
2 #####################################################-*-mode:shell-script-*-
3 ## ##
4 ## ##
5 ## Language Technologies Institute ##
6 ## Carnegie Mellon University ##
7 ## Copyright (c) 1998-2004 ##
8 ## All Rights Reserved. ##
9 ## ##
10 ## Permission is hereby granted, free of charge, to use and distribute ##
11 ## this software and its documentation without restriction, including ##
12 ## without limitation the rights to use, copy, modify, merge, publish, ##
13 ## distribute, sublicense, and/or sell copies of this work, and to ##
14 ## permit persons to whom this work is furnished to do so, subject to ##
15 ## the following conditions: ##
16 ## 1. The code must retain the above copyright notice, this list of ##
17 ## conditions and the following disclaimer. ##
18 ## 2. Any modifications must be clearly marked as such. ##
19 ## 3. Original authors' names are not deleted. ##
20 ## 4. The authors' names are not used to endorse or promote products ##
21 ## derived from this software without specific prior written ##
22 ## permission. ##
23 ## ##
24 ## CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK ##
25 ## DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ##
26 ## ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ##
27 ## SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE ##
28 ## FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ##
29 ## WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ##
30 ## AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ##
31 ## ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ##
32 ## THIS SOFTWARE. ##
33 ## ##
34 ###########################################################################
35
36 LANG=C; export LANG
37
38 if [ ! -f "$WAGON" ]; then
39 if [ ! -d "$ESTDIR" ];then
40 WAGON=$(which wagon) || ( echo "Could not find wagon"; exit 1 )
41 else
42 WAGON="$ESTDIR/bin/wagon"
43 fi
44 fi
45
46
47 echo "((Relation.LTS.down.name" >ltsLTS.desc
48 awk '{print $1}' lex.feats | sort -u >> ltsLTS.desc
49 echo ') (p.p.p.p.name ' >>ltsLTS.desc
50 awk '{print $2}' lex.feats | sort -u >> ltsLTS.desc
51 echo ') (p.p.p.name ' >>ltsLTS.desc
52 awk '{print $3}' lex.feats | sort -u >> ltsLTS.desc
53 echo ') (p.p.name ' >>ltsLTS.desc
54 awk '{print $4}' lex.feats | sort -u >> ltsLTS.desc
55 echo ') (p.name ' >>ltsLTS.desc
56 awk '{print $5}' lex.feats | sort -u >> ltsLTS.desc
57 echo ') (name ' >>ltsLTS.desc
58 awk '{print $6}' lex.feats | sort -u >> ltsLTS.desc
59 echo ') (n.name ' >>ltsLTS.desc
60 awk '{print $7}' lex.feats | sort -u >> ltsLTS.desc
61 echo ') (n.n.name ' >>ltsLTS.desc
62 awk '{print $8}' lex.feats | sort -u >> ltsLTS.desc
63 echo ') (n.n.n.name ' >>ltsLTS.desc
64 awk '{print $9}' lex.feats | sort -u >> ltsLTS.desc
65 echo ') (n.n.n.n.name ' >>ltsLTS.desc
66 awk '{print $10}' lex.feats | sort -u >> ltsLTS.desc
67 echo ') (pos ignore' >>ltsLTS.desc
68 awk 'BEGIN {print "n"} {print $11}' lex.feats | sort -u >> ltsLTS.desc
69 echo '))' >>ltsLTS.desc
70
71 for i in `awk '{print $6}' lex.feats | sort -u`
72 do
73 # Stop value for wagon
74 STOP=3
75
76 # Find training set for letter $i
77 if [ -f lex.feats.train ]
78 then
79 echo letter $i STOP $STOP TRAIN SET
80 cat lex.feats.train |
81 awk '{if ($6 == "'$i'") print $0}' >ltsdataTRAIN.$i.feats
82 else
83 echo letter $i STOP $STOP ALL
84 cat lex.feats |
85 awk '{if ($6 == "'$i'") print $0}' >ltsdataTRAIN.$i.feats
86 fi
87
88 $WAGON -data ltsdataTRAIN.$i.feats -test ltsdataTRAIN.$i.feats \
89 -desc ltsLTS.desc -stop $STOP -output lts.$i.tree
90
91 done