1# ====================================================================
2# Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7#
8# 1. Redistributions of source code must retain the above copyright
9#    notice, this list of conditions and the following disclaimer.
10#
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in
13#    the documentation and/or other materials provided with the
14#    distribution.
15#
16# This work was supported in part by funding from the Defense Advanced
17# Research Projects Agency and the National Science Foundation of the
18# United States of America, and the CMU Sphinx Speech Consortium.
19#
20# THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
21# ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
24# NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31#
32# ====================================================================
33#
34#  Sphinx III
35#
36# ====================================================================
37
38INCLUDES = -I$(top_srcdir) \
39	-I$(top_srcdir)/src \
40	-I$(top_srcdir)/src/libs3decoder \
41       -I$(top_srcdir)/src/libs3audio \
42       -I$(top_builddir)/include
43
44LDADD = $(top_builddir)/src/libs3decoder/libs3decoder.la \
45	$(top_builddir)/src/libs3audio/libs3audio.la \
46	$(top_builddir)/src/libutil/libs3util.la \
47	-lm @ad_libs@
48
49PROGRAMDIR= ${top_builddir}/src/programs
50BMBIN= ${top_builddir}/src/tests/programs/batchmetrics
51LPBIN= $(PROGRAMDIR)/livepretend
52DECODEBIN= $(PROGRAMDIR)/sphinx3_decode
53DECANYBIN= $(PROGRAMDIR)/sphinx3_decode_anytopo
54AN4RESULTPATH= ${top_builddir}/src/tests/performance/an4/
55MODELSPATH=/lab/speech/sphinx4/data/an4/lists/
56AN4BASE="ARGS.an4_base"
57AN4LIVE="ARGS.an4_base.live"
58# Add
59# "/afs/cs.cmu.edu/user/robust/archive/third_party_packages/NIST_scoring_tools/sctk-1.2c/linux/bin"
60# to your path if you have alinux machine
61ALIGNBIN = sclite -i wsj -o sum rsum -f 0
62
63#	echo $(wordlist 2,3,$(subst _, ,$@))
64#	echo $(word 3,$(subst _, ,$@))
65
66CLEANFILES = *.results *.tmp *.match *.match.* *.sent *.ctl ARGS.*-{lp,decode,decany}
67
68SIMTASK="words spelling full"
69GRAMMAR="unigram bigram flat_unigram trigram"
70MODEAFFIX="quick"
71
72#DON'T delete, single evil suffix rules for all these targets.
73#should create a foreach loop for all the below targets
74
75#all : SLOW QUICK
76
77slow : an4_words-unigram-lp \
78	an4_spelling-unigram-lp \
79	an4_full-unigram-lp \
80	an4_words-bigram-lp \
81	an4_spelling-bigram-lp \
82	an4_full-bigram-lp \
83	an4_words-trigram-lp \
84	an4_spelling-trigram-lp \
85	an4_full-trigram-lp \
86	an4_words-flat_unigram-lp \
87	an4_spelling-flat_unigram-lp \
88	an4_full-flat_unigram-lp \
89	an4_words-unigram-decode \
90	an4_spelling-unigram-decode \
91	an4_full-unigram-decode \
92	an4_words-bigram-decode \
93	an4_spelling-bigram-decode \
94	an4_full-bigram-decode \
95	an4_words-trigram-decode \
96	an4_spelling-trigram-decode \
97	an4_full-trigram-decode \
98	an4_words-flat_unigram-decode \
99	an4_spelling-flat_unigram-decode \
100	an4_full-flat_unigram-decode \
101	an4_words-unigram-decany \
102	an4_spelling-unigram-decany \
103	an4_full-unigram-decany \
104	an4_words-bigram-decany \
105	an4_spelling-bigram-decany \
106	an4_full-bigram-decany \
107	an4_words-trigram-decany \
108	an4_spelling-trigram-decany \
109	an4_full-trigram-decany \
110	an4_words-flat_unigram-decany \
111	an4_spelling-flat_unigram-decany \
112	an4_full-flat_unigram-decany
113
114quick : an4_words_quick-unigram-lp \
115	an4_spelling_quick-unigram-lp \
116	an4_full_quick-unigram-lp \
117	an4_words_quick-bigram-lp \
118	an4_spelling_quick-bigram-lp \
119	an4_full_quick-bigram-lp \
120	an4_words_quick-trigram-lp \
121	an4_spelling_quick-trigram-lp \
122	an4_full_quick-trigram-lp \
123	an4_words_quick-flat_unigram-lp \
124	an4_spelling_quick-flat_unigram-lp \
125	an4_full_quick-flat_unigram-lp \
126	an4_words_quick-unigram-decode \
127	an4_spelling_quick-unigram-decode \
128	an4_full_quick-unigram-decode \
129	an4_words_quick-bigram-decode \
130	an4_spelling_quick-bigram-decode \
131	an4_full_quick-bigram-decode \
132	an4_words_quick-trigram-decode \
133	an4_spelling_quick-trigram-decode \
134	an4_full_quick-trigram-decode \
135	an4_words_quick-flat_unigram-decany \
136	an4_spelling_quick-flat_unigram-decany \
137	an4_full_quick-flat_unigram-decany \
138	an4_words_quick-unigram-decany \
139	an4_spelling_quick-unigram-decany \
140	an4_full_quick-unigram-decany \
141	an4_words_quick-bigram-decany \
142	an4_spelling_quick-bigram-decany \
143	an4_full_quick-bigram-decany \
144	an4_words_quick-trigram-decany \
145	an4_spelling_quick-trigram-decany \
146	an4_full_quick-trigram-decany \
147	an4_words_quick-flat_unigram-decany \
148	an4_spelling_quick-flat_unigram-decany \
149	an4_full_quick-flat_unigram-decany
150
151
152
153an4_words-unigram-lp \
154an4_spelling-unigram-lp \
155an4_full-unigram-lp \
156an4_words-bigram-lp \
157an4_spelling-bigram-lp \
158an4_full-bigram-lp \
159an4_words-trigram-lp \
160an4_spelling-trigram-lp \
161an4_full-trigram-lp \
162an4_words-flat_unigram-lp \
163an4_spelling-flat_unigram-lp \
164an4_full-flat_unigram-lp \
165an4_words_quick-unigram-lp \
166an4_spelling_quick-unigram-lp \
167an4_full_quick-unigram-lp \
168an4_words_quick-bigram-lp \
169an4_spelling_quick-bigram-lp \
170an4_full_quick-bigram-lp \
171an4_words_quick-trigram-lp \
172an4_spelling_quick-trigram-lp \
173an4_full_quick-trigram-lp \
174an4_words_quick-flat_unigram-lp \
175an4_spelling_quick-flat_unigram-lp \
176an4_full_quick-flat_unigram-lp :
177	-rm -f $@.results $@.tmp $@.match $@.sent $@.ctl
178	awk '{print $$1}' batch/$(word 1,$(subst -, ,$@)).batch | sed "s/\.raw//" > ./$@.ctl
179	cat $(AN4BASE) $(AN4LIVE) ./ARGS/ARGS.an4_$(word 2,$(subst -, ,$@)) > ARGS.$@
180	echo "-lm $(MODELSPATH)/$(subst -,.,$(subst _quick,,$(subst -lp,,$@))).lm.DMP" >> ARGS.$@
181	echo "-hyp ./$@.match" >> ARGS.$@
182	$(LPBIN) ./$@.ctl / ARGS.$@ > $@.results 2>&1
183	awk '{for(i=2;i<=NF;i++){printf("%s ",$$i)}; printf("(%s)\n",$$1)}' batch/$(word 1,$(subst -, ,$@)).batch  | sed "s/\.raw//" > $@.sent
184	$(ALIGNBIN) -r $@.sent -h $@.match
185
186an4_words-unigram-decode \
187an4_spelling-unigram-decode \
188an4_full-unigram-decode \
189an4_words-bigram-decode \
190an4_spelling-bigram-decode \
191an4_full-bigram-decode \
192an4_words-trigram-decode \
193an4_spelling-trigram-decode \
194an4_full-trigram-decode \
195an4_words-flat_unigram-decode \
196an4_spelling-flat_unigram-decode \
197an4_full-flat_unigram-decode \
198an4_words_quick-unigram-decode \
199an4_spelling_quick-unigram-decode \
200an4_full_quick-unigram-decode \
201an4_words_quick-bigram-decode \
202an4_spelling_quick-bigram-decode \
203an4_full_quick-bigram-decode \
204an4_words_quick-trigram-decode \
205an4_spelling_quick-trigram-decode \
206an4_full_quick-trigram-decode \
207an4_words_quick-flat_unigram-decode \
208an4_spelling_quick-flat_unigram-decode \
209an4_full_quick-flat_unigram-decode :
210	-rm -f $@.results $@.tmp $@.match $@.sent $@.ctl
211	awk '{print $$1}' batch/$(word 1,$(subst -, ,$@)).batch | sed -e "s/\.raw//" -e "s/an4_clstk/cepstra/" > ./$@.ctl
212	cat $(AN4BASE) ./ARGS/ARGS.an4_$(word 2,$(subst -, ,$@)) > ARGS.$@
213	echo "-lm $(MODELSPATH)/$(subst -,.,$(subst _quick,,$(subst -decode,,$@))).lm.DMP" >> ARGS.$@
214	echo "-ctl ./$@.ctl " >> ARGS.$@
215	echo "-hyp ./$@.match" >> ARGS.$@
216	$(DECODEBIN) ARGS.$@ > $@.results 2>&1
217	awk '{for(i=2;i<=NF;i++){printf("%s ",$$i)}; printf("(%s)\n",$$1)}' batch/$(word 1,$(subst -, ,$@)).batch  | sed -e "s/\.raw//" -e "s/an4_clstk/cepstra/" > $@.sent
218	$(ALIGNBIN) -r $@.sent -h $@.match
219
220
221an4_words-unigram-decany \
222an4_spelling-unigram-decany \
223an4_full-unigram-decany \
224an4_words-bigram-decany \
225an4_spelling-bigram-decany \
226an4_full-bigram-decany \
227an4_words-trigram-decany \
228an4_spelling-trigram-decany \
229an4_full-trigram-decany \
230an4_words-flat_unigram-decany \
231an4_spelling-flat_unigram-decany \
232an4_full-flat_unigram-decany \
233an4_words_quick-unigram-decany \
234an4_spelling_quick-unigram-decany \
235an4_full_quick-unigram-decany \
236an4_words_quick-bigram-decany \
237an4_spelling_quick-bigram-decany \
238an4_full_quick-bigram-decany \
239an4_words_quick-trigram-decany \
240an4_spelling_quick-trigram-decany \
241an4_full_quick-trigram-decany \
242an4_words_quick-flat_unigram-decany \
243an4_spelling_quick-flat_unigram-decany \
244an4_full_quick-flat_unigram-decany :
245	-rm -f $@.results $@.tmp $@.match $@.sent $@.ctl
246	awk '{print $$1}' batch/$(word 1,$(subst -, ,$@)).batch | sed -e "s/\.raw//" -e "s/an4_clstk/cepstra/" > ./$@.ctl
247	cat $(AN4BASE).decany ./ARGS/ARGS.an4_$(word 2,$(subst -, ,$@)).decany > ARGS.$@
248	echo "-lm $(MODELSPATH)/$(subst -,.,$(subst _quick,,$(subst -decany,,$@))).lm.DMP" >> ARGS.$@
249	echo "-ctl ./$@.ctl " >> ARGS.$@
250	echo "-hyp ./$@.match" >> ARGS.$@
251	$(DECANYBIN) ARGS.$@ > $@.results 2>&1
252	awk '{for(i=2;i<=NF;i++){printf("%s ",$$i)}; printf("(%s)\n",$$1)}' batch/$(word 1,$(subst -, ,$@)).batch  | sed -e "s/\.raw//" -e "s/an4_clstk/cepstra/" > $@.sent
253	$(ALIGNBIN) -r $@.sent -h $@.match
254
255
256#an4_words_unigram-bm \
257#an4_spelling_unigram-bm \
258#an4_full_unigram-bm \
259#an4_words_bigram-bm \
260#an4_spelling_bigram-bm \
261#an4_full_bigram-bm \
262#an4_words_trigram-bm \
263#an4_spelling_trigram-bm \
264#an4_full_trigram-bm:
265#	 -rm -f $@.results $@.tmp $@.match
266#	 cat $(AN4BASE) $(AN4LIVE) ./ARGS/ARGS.an4_$(word 3,$(subst _, ,$(subst -bm,, $@))) > ARGS.$@
267#	 echo "-lm $(MODELSPATH)/an4_$(word 2,$(subst _, ,$@)).$(word 3,$(subst _, ,$(subst -bm,,$@)).lm.DMP" >> ARGS.$@
268#	 $(BMBIN) batch/an4_$(word 2,$(subst _, ,$(subst -bm,,$@))).batch / ARGS.$@ > $@.results 2>&1
269#
270#
271##hack!, minimal to get around limited make string manipulation functionalities. Didn't know how to awk or cut like operation at this point.
272#an4_words_flat_unigram-bm \
273#an4_spelling_flat_unigram-bm \
274#an4_full_flat_unigram-bm :
275#	 -rm -f $@.results $@.tmp $@.match
276#	 cat $(AN4BASE) $(AN4LIVE) ./ARGS/ARGS.an4_flat_unigram > ARGS.$@
277#	 echo "-lm $(MODELSPATH)/an4_$(word 2,$(subst _, ,$(subst -bm,,$@))).flat_unigram.lm.DMP" >> ARGS.$@
278#	 $(BMBIN) batch/an4_$(word 2,$(subst _, ,$(subst -bm,,$@))).batch / ARGS.$@ > $@.results 2>&1
279