1#!/bin/sh
2#
3#	megatest.sh - master test script for CRM114
4#		output is normally compared to megatest_knowngood.log
5
6# Copyright 2009 William S. Yerazunis.
7# This file is under GPLv3, as described in COPYING.
8#
9
10./crm114 -v
11./crm114 bracktest.crm
12./crm114 escapetest.crm
13./crm114 fataltraptest.crm
14./crm114 inserttest_a.crm
15./crm114 matchtest.crm  <<-EOF
16exact: you should see this foo ZZZ
17exact: you should NOT see this FoO ZZZ
18absent: There is no "f-word" here ZZZ
19absent: but there's a foo here ZZZ
20nocase: you should see this fOo ZZZ
21nocase: and there is no "f-word" here ZZZ
22nocase absent: and there is no "f-word" here ZZZ
23nocase absent: and there is a foo here ZZZ
24multiline:  this is a multiline test of foo
25multiline-- should see both lines ZZZ
26multiline:  this is a multiline test of "f-word"
27multiline-- should see both lines ZZZ
28nomultiline:  this is a nomultiline test of foo
29nomultiline-- should NOT see both lines ZZZ
30nomultiline:  this is a nomultiline test of "f-word"
31nomultiline-- should NOT see both lines ZZZ
32fromendchar:  should see this line foo followed by bar ZZZ
33fromendchar:  should NOT see this line bar followed by foo ZZZ
34fromnext: should not see foo but should see ffoooo ZZZ
35fromnext: should not see foo but should see f-oooo ZZZ
36newend: should not see foo but should see ffooo ZZZ
37newend: should not see foo and should not see f-ooo ZZZ
38indirect go to :twist:  ZZZ
39indirect go to :shout2:  ZZZ
40self-supplied: foo123bar
41wugga
42smith 123 anderson ZZZ
43self-supplied: foo123bar
44wugga
45smith 456 anderson ZZZ
46independent-start-end: foo bar 1 2 foo bar ZZZ
47independent-start-end: foo bar foo 1 2 bar ZZZ
48independent-start-end: foo 1 foo bar 2 bar ZZZ
49independent-start-end: foo 2 bar 1 bar foo ZZZ
50EOF
51./crm114 backwardstest.crm  <<-EOF
52foo bar baz
53EOF
54./crm114 backwardstest.crm  <<-EOF
55bar foo baz
56EOF
57./crm114 overalterisolatedtest.crm
58./crm114 rewritetest.crm
59./crm114 skudtest.crm
60./crm114 statustest.crm
61./crm114 unionintersecttest.crm
62./crm114 beeptest.crm
63./crm114 defaulttest.crm
64./crm114 defaulttest.crm --blah="command override"
65./crm114 windowtest.crm  <<-EOF
66This is the test one result A this is the test two result A this is the test three result A this is the test four result A this is the test 5 result A this is the test six result A this is extra stuff and should never be seen.
67EOF
68./crm114 windowtest_fromvar.crm  <<-EOF
69This is the test one result A this is the test two result A this is the test three result A this is the test four result A this is the test 5 result A this is the test six result A this is extra stuff and should trigger exit from the loop since it doesn't have the proper delimiter.
70EOF
71./crm114 approxtest.crm  <<-EOF
72(foo) {1}
73(fou){~}
74(foo) {1}
75(fou){~0}
76(foo) {1}
77(fou){~1}
78(foo) {1}
79(fou){~2}
80(fou){~3}
81(fuu){~}
82(fuu){~0}
83(fuu){~1}
84(fuu){~2}
85(fuu){~3}
86(fou){#}
87(fou){#0}
88(fou){#1}
89(fou){#2}
90(fou){#3}
91(fou){# ~1}
92(fou){#0 ~1}
93(fou){#1 ~1}
94(fou){#2 ~1}
95(fou){#3 ~1}
96(fuu){#}
97(fuu){#0}
98(fuu){#1}
99(fuu){#2}
100(fuu){#3}
101(fuu){# ~1}
102(fuu){#0 ~1}
103(fuu){#1 ~1}
104(fuu){#2 ~1}
105(fuu){#3 ~1}
106(fuu){# ~2}
107(fuu){#0 ~2}
108(fuu){#1 ~2}
109(fuu){#2 ~2}
110(fuu){#3 ~2}
111(fuu){# ~3}
112(fuu){#0 ~3}
113(fuu){#1 ~3}
114(fuu){#2 ~3}
115(fuu){#3 ~3}
116(fuu){# ~}
117(fuu){#0 ~}
118(fuu){#1 ~}
119(fuu){#2 ~}
120(fuu){#3 ~}
121(fou){#}
122(fou){#0}
123(fou){+1 -1}
124(fou){+2 -2}
125(fou){+3 -3}
126(fou){# ~1}
127(fou){#0 ~1}
128(fou){+1 -1 ~1}
129(fou){+2 -2 ~1}
130(fou){+3 -3 ~1}
131(fou){# ~2}
132(fou){#0 ~2}
133(fou){+1 -1 ~2}
134(fou){+2 -2 ~2}
135(fou){+3 -3 ~2}
136(fou){# ~3}
137(fou){#0 ~3}
138(fou){+1 -1 ~3}
139(fou){+2 -2 ~3}
140(fou){+3 -3 ~3}
141(fou){# ~}
142(fou){#0 ~}
143(fou){+1 -1 ~}
144(fou){+2 -2 ~}
145(fou){+3 -3 ~}
146(fuu){#}
147(fuu){#0}
148(fuu){+1 -1}
149(fuu){+2 -2}
150(fuu){+3 -3}
151(fuu){# ~1}
152(fuu){#0 ~1}
153(fuu){+1 -1 ~1}
154(fuu){+2 -2 ~1}
155(fuu){+3 -3 ~1}
156(fuu){# ~2}
157(fuu){#0 ~2}
158(fuu){+1 -1 ~2}
159(fuu){+2 -2 ~2}
160(fuu){+3 -3 ~2}
161(fuu){# ~3}
162(fuu){#0 ~3}
163(fuu){+1 -1 ~3}
164(fuu){+2 -2 ~3}
165(fuu){+3 -3 ~3}
166(fuu){# ~}
167(fuu){#0 ~}
168(fuu){+1 -1 ~}
169(fuu){+2 -2 ~}
170(fuu){+3 -3 ~}
171(anaconda){~}
172(anaonda){ 1i + 1d < 1 }
173(anaonda){ 1i + 1d < 2 }
174(ananda){ 1i + 1d < 1 }
175(ananda){ 1i + 1d < 2 }
176(ananda){ 1i + 1d < 3 }
177(ana123conda){ 1i + 1d < 2 }
178(ana123conda){ 1i + 1d < 3 }
179(ana123conda){ 1i + 1d < 4 }
180(ana123cona){ 1i + 1d < 4 }
181(ana123cona){ 1i + 1d < 5 }
182(ana123coa){ 1i + 1d < 4 }
183(ana123coa){ 1i + 1d < 5 }
184(ana123coa){ 1i + 1d < 6 }
185(ana123ca){ 1i + 1d < 4 }
186(ana123a){ 1i + 1d < 4 }
187(ana123a){ 1i + 1d < 3 }
188(anukeonda){~}
189(anaconda){ 1i + 1d < 1}
190(anaconda){ 1i + 1d < 1, #1}
191(anaconda){ 1i + 1d < 1 #1 ~10 }
192(anaconda){ #1, ~1, 1i + 1d < 1 }
193(anaconda){ #1 ~1 1i + 1d < 1 }
194(anacnda){ #1 ~1 1i + 1d < 1 }
195(agentsmith){~}
196(annndersen){~}
197(anentemstn){~}
198(anacda){~}
199(anacda){ #1 ~1 1i + 1d < 1 }
200(znacnda){ #1 ~1 1i + 1d < 1 }
201(znacnda){ #1 ~2 1i + 1d < 1 }
202(znacnda){ #1 ~3 1i + 1d < 1 }
203(znacnda){ #1 ~3 1i + 1d < 2 }
204(anac){~1}(onda){~1}
205(aac){~1}(onda){~1}
206(ac){~1}(onda){~1}
207(anac){~1}(oda){~1}
208(aac){~1}(oa){~1}
209(ac){~1}(oa){~1}
210(anac){~1}(onda){~1}
211(anZac){~1}(onZda){~1}
212(anZZac){~1}(onZda){~1}
213(anZac){~1}(onZZda){~1}
214([a-n]){3,100}
215([a-n]){3,100}?
216EOF
217./crm114 mathalgtest.crm
218./crm114 mathrpntest.crm -q 1
219./crm114 eval_infiniteloop.crm
220./crm114 randomiotest.crm
221./crm114 paolo_overvars.crm
222./crm114 paolo_ov2.crm
223./crm114 paolo_ov3.crm
224./crm114 paolo_ov4.crm
225./crm114 paolo_ov5.crm
226./crm114 match_isolate_test.crm -e
227./crm114 match_isolate_reclaim.crm -e
228./crm114 call_return_test.crm
229./crm114 translate_tr.crm
230./crm114 zz_translate_test.crm
231./crm114 quine.crm
232./crm114 '-{window; isolate (:s:); syscall () (:s:) /echo one two three/; output /:*:s:/}'
233./crm114 '-{window; output / \n***** checking return and exit codes \n/}'
234./crm114 '-{window; isolate (:s:); syscall () () (:s:) /exit 123/; output / Status: :*:s: \n/}'
235./crm114 '-{window; output /\n***** check that failed syscalls will code right\n/}'
236./crm114 '-{window; isolate (:s:); syscall () () (:s:) /jibberjabber 2>&1 /; output / Status: :*:s: \n/}'
237
238./crm114 indirecttest.crm
239rm -f randtst.txt
240
241rm -f m_test.css
242rm -f a_test.css
243./crm114 '-{window; output /\n ****  Default (SBPH Markovian) classifier \n/}'
244./crm114 '-{learn (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
245./crm114 '-{learn (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
246./crm114 '-{ isolate (:s:) {classify ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
247when suddenly a White Rabbit with pink eyes ran close to her.
248EOF
249./crm114 '-{ isolate (:s:) {classify ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
250    Double, double toil and trouble;
251    Fire burn, and cauldron bubble.
252EOF
253
254rm -f m_test.css
255rm -f a_test.css
256./crm114 '-{window; output /\n**** OSB Markovian classifier \n/}'
257./crm114 '-{learn <osb> (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
258./crm114 '-{learn <osb> (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
259./crm114 '-{ isolate (:s:); {classify <osb> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
260when suddenly a White Rabbit with pink eyes ran close to her.
261EOF
262./crm114 '-{ isolate (:s:); {classify <osb> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
263    Double, double toil and trouble;
264    Fire burn, and cauldron bubble.
265EOF
266
267rm -f m_test.css
268rm -f a_test.css
269./crm114 '-{window; output /\n**** OSB Markov Unique classifier \n/}'
270./crm114 '-{learn <osb unique > (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
271./crm114 '-{learn <osb unique > (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
272./crm114 '-{ isolate (:s:); {classify <osb unique> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
273when suddenly a White Rabbit with pink eyes ran close to her.
274EOF
275./crm114 '-{ isolate (:s:); {classify <osb unique> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
276    Double, double toil and trouble;
277    Fire burn, and cauldron bubble.
278EOF
279
280rm -f m_test.css
281rm -f a_test.css
282./crm114 '-{window; output /\n**** OSB Markov Chisquared Unique classifier \n/}'
283./crm114 '-{learn <osb unique chi2> (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
284./crm114 '-{learn <osb unique chi2> (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
285./crm114 '-{ isolate (:s:); {classify <osb unique chi2 > ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
286when suddenly a White Rabbit with pink eyes ran close to her.
287EOF
288./crm114 '-{ isolate (:s:); {classify <osb unique chi2> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
289    Double, double toil and trouble;
290    Fire burn, and cauldron bubble.
291EOF
292
293rm -f m_test.css
294rm -f a_test.css
295./crm114 '-{window; output /\n**** OSBF Local Confidence (Fidelis) classifier \n/}'
296./crm114 '-{learn < osbf > (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
297./crm114 '-{learn < osbf > (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
298./crm114 '-{ isolate (:s:); {classify <osbf> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
299when suddenly a White Rabbit with pink eyes ran close to her.
300EOF
301./crm114 '-{ isolate (:s:); {classify <osbf> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
302    Double, double toil and trouble;
303    Fire burn, and cauldron bubble.
304EOF
305
306rm -f m_test.css
307rm -f a_test.css
308./crm114 '-{window; output / \n**** OSB Winnow classifier \n/}'
309./crm114 '-{learn <winnow> (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
310./crm114 '-{learn <winnow refute> (a_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
311./crm114 '-{learn <winnow> (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
312./crm114 '-{learn <winnow refute> (m_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
313./crm114 '-{ isolate (:s:); {classify <winnow> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }       '  <<-EOF
314when suddenly a White Rabbit with pink eyes ran close to her.
315EOF
316./crm114 '-{ isolate (:s:); {classify <winnow> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}      ' <<-EOF
317    Double, double toil and trouble;
318    Fire burn, and cauldron bubble.
319EOF
320./crm114 '-{ window; output /\n\n**** Now verify that winnow learns affect only the named file (m_test.css)\n/}'
321./crm114 '-{learn <winnow> (m_test.css) /[[:graph:]]+/}' < Hound_of_the_Baskervilles_first_500_lines.txt
322./crm114 '-{ isolate (:s:); {classify <winnow> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}      ' <<-EOF
323    Double, double toil and trouble;
324    Fire burn, and cauldron bubble.
325EOF
326./crm114 '-{window; output /\n\n and now refute-learn into a_test.css\n/}'
327./crm114 '-{learn <winnow refute > (a_test.css) /[[:graph:]]+/}' < The_Wind_in_the_Willows_Chap_1.txt
328./crm114 '-{ isolate (:s:); {classify <winnow> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}      ' <<-EOF
329    Double, double toil and trouble;
330    Fire burn, and cauldron bubble.
331EOF
332
333rm -f m_test.css
334rm -f a_test.css
335./crm114 '-{window; output /\n**** Unigram Bayesian classifier \n/}'
336./crm114 '-{learn <unigram> (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
337./crm114 '-{learn <unigram> (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
338./crm114 '-{ isolate (:s:); {classify <unigram> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
339when suddenly a White Rabbit with pink eyes ran close to her.
340EOF
341./crm114 '-{ isolate (:s:); {classify <unigram> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
342    Double, double toil and trouble;
343    Fire burn, and cauldron bubble.
344EOF
345
346rm -f m_test.css
347rm -f a_test.css
348./crm114 '-{window; output / \n**** unigram Winnow classifier \n/}'
349./crm114 '-{learn <winnow unigram > (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
350./crm114 '-{learn <winnow unigram refute> (a_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
351./crm114 '-{learn <winnow unigram> (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
352./crm114 '-{learn <winnow unigram refute> (m_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
353./crm114 '-{ isolate (:s:); {classify <winnow unigram> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }       '  <<-EOF
354when suddenly a White Rabbit with pink eyes ran close to her.
355EOF
356./crm114 '-{ isolate (:s:); {classify <winnow unigram> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}      ' <<-EOF
357    Double, double toil and trouble;
358    Fire burn, and cauldron bubble.
359EOF
360
361
362rm -f m_test.css
363rm -f a_test.css
364./crm114 '-{window; output /\n**** OSB Hyperspace classifier \n/}'
365./crm114 '-{learn <hyperspace unique> (a_test.css) }' < Alice_In_Wonderland_Chap_1_And_2.txt
366./crm114 '-{learn <hyperspace unique> (m_test.css) }' < Macbeth_Act_IV.txt
367./crm114 '-{ isolate (:s:); {classify <hyperspace> ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
368when suddenly a White Rabbit with pink eyes ran close to her.
369EOF
370./crm114 '-{ isolate (:s:); {classify <hyperspace> ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
371    Double, double toil and trouble;
372    Fire burn, and cauldron bubble.
373EOF
374
375rm -f m_test.css
376rm -f a_test.css
377./crm114 '-{window; output /\n**** OSB three-letter Hyperspace classifier \n/}'
378./crm114 '-{learn <hyperspace unigram> (a_test.css) /\w\w\w/}' < Alice_In_Wonderland_Chap_1_And_2.txt
379./crm114 '-{learn <hyperspace unigram> (m_test.css) /\w\w\w/}' < Macbeth_Act_IV.txt
380./crm114 '-{ isolate (:s:); {classify <hyperspace unigram> ( m_test.css | a_test.css ) (:s:) /\w\w\w/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
381when suddenly a White Rabbit with pink eyes ran close to her.
382EOF
383./crm114 '-{ isolate (:s:); {classify <hyperspace unigram> ( m_test.css | a_test.css ) (:s:) /\w\w\w/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
384    Double, double toil and trouble;
385    Fire burn, and cauldron bubble.
386EOF
387
388
389rm -f m_test.css
390rm -f a_test.css
391./crm114 '-{window; output /\n**** Unigram Hyperspace classifier \n/}'
392./crm114 '-{learn < hyperspace unique unigram> (a_test.css) }' < Alice_In_Wonderland_Chap_1_And_2.txt
393./crm114 '-{learn < hyperspace unique unigram> (m_test.css) }' < Macbeth_Act_IV.txt
394./crm114 '-{ isolate (:s:); {classify < hyperspace unigram> ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
395when suddenly a White Rabbit with pink eyes ran close to her.
396EOF
397./crm114 '-{ isolate (:s:); {classify <hyperspace unigram> ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
398    Double, double toil and trouble;
399    Fire burn, and cauldron bubble.
400EOF
401
402rm -f m_test.css
403rm -f a_test.css
404./crm114 '-{window; output /\n**** String Hyperspace classifier \n/}'
405./crm114 '-{learn < hyperspace string> (a_test.css) }' < Alice_In_Wonderland_Chap_1_And_2.txt
406./crm114 '-{learn < hyperspace string> (m_test.css) }' < Macbeth_Act_IV.txt
407./crm114 '-{ isolate (:s:); {classify < hyperspace string> ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
408when suddenly a White Rabbit with pink eyes ran close to her.
409EOF
410./crm114 '-{ isolate (:s:); {classify <hyperspace string> ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
411    Double, double toil and trouble;
412    Fire burn, and cauldron bubble.
413EOF
414
415rm -f m_test.css
416rm -f a_test.css
417./crm114 '-{window; output /\n**** String Unigram Hyperspace classifier \n/}'
418./crm114 '-{learn < hyperspace string unigram> (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
419./crm114 '-{learn < hyperspace string unigram> (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
420./crm114 '-{ isolate (:s:); {classify < hyperspace string unigram> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
421when suddenly a White Rabbit with pink eyes ran close to her.
422EOF
423./crm114 '-{ isolate (:s:); {classify <hyperspace string unigram> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
424    Double, double toil and trouble;
425    Fire burn, and cauldron bubble.
426EOF
427
428rm -f m_test.css
429rm -f a_test.css
430./crm114 '-{window; output /\n**** Vector 3-word-bag Hyperspace classifier \n/}'
431#    the "vector: blahblah" is coded by the desired length of the pipeline,
432#    then the number of iterations of the pipe, then pipelen * iters
433#    integer coefficients.  Missing coefficients are taken as zero,
434#    extra coefficients are disregarded.
435./crm114 '-{learn < hyperspace > (a_test.css) /[[:graph:]]+/ /vector: 3 1 1 1 1 / }' < Alice_In_Wonderland_Chap_1_And_2.txt
436./crm114 '-{learn < hyperspace > (m_test.css) /[[:graph:]]+/ /vector: 3 1 1 1 1/}' < Macbeth_Act_IV.txt
437./crm114 '-{ isolate (:s:); {classify < hyperspace > ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ /vector: 3 1 1 1 1  /; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
438when suddenly a White Rabbit with pink eyes ran close to her.
439EOF
440./crm114 '-{ isolate (:s:); {classify <hyperspace > ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ /vector: 3 1 1 1 1 /; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
441    Double, double toil and trouble;
442    Fire burn, and cauldron bubble.
443EOF
444
445
446rm -f m_test.css
447rm -f a_test.css
448./crm114 '-{window; output /\n**** Bit-Entropy classifier \n/}'
449./crm114 '-{learn < entropy unique crosslink> (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
450./crm114 '-{learn < entropy unique crosslink> (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
451./crm114 '-{ isolate (:s:); {classify < entropy unique crosslink> ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
452when suddenly a White Rabbit with pink eyes ran close to her.
453EOF
454./crm114 '-{ isolate (:s:); {classify <entropy unique crosslink> ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
455    Double, double toil and trouble;
456    Fire burn, and cauldron bubble.
457EOF
458
459rm -f m_test.css
460rm -f a_test.css
461./crm114 '-{window; output /\n**** Bit-Entropy Toroid classifier \n/}'
462./crm114 '-{learn < entropy > (a_test.css) /[[:graph:]]+/}' < Alice_In_Wonderland_Chap_1_And_2.txt
463./crm114 '-{learn < entropy > (m_test.css) /[[:graph:]]+/}' < Macbeth_Act_IV.txt
464./crm114 '-{ isolate (:s:); {classify < entropy > ( m_test.css | a_test.css ) (:s:)/[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
465when suddenly a White Rabbit with pink eyes ran close to her.
466EOF
467./crm114 '-{ isolate (:s:); {classify < entropy > ( m_test.css | a_test.css ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
468    Double, double toil and trouble;
469    Fire burn, and cauldron bubble.
470EOF
471
472rm -f m_test.css
473rm -f a_test.css
474./crm114 '-{window; output /\n**** Fast Substring Compression Match Classifier \n/}'
475./crm114 '-{learn < fscm > (a_test.css) }' < Alice_In_Wonderland_Chap_1_And_2.txt
476./crm114 '-{learn < fscm > (m_test.css) }' < Macbeth_Act_IV.txt
477./crm114 '-{ isolate (:s:); {classify < fscm > ( m_test.css | a_test.css ) (:s:)  ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
478when suddenly a White Rabbit with pink eyes ran close to her.
479EOF
480./crm114 '-{ isolate (:s:); {classify < fscm > ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
481    Double, double toil and trouble;
482    Fire burn, and cauldron bubble.
483EOF
484
485rm -f m_test.css
486rm -f a_test.css
487
488./crm114 '-{window; output /\n**** Neural Network Classifier \n/}'
489./crm114 '-{learn < neural append > (a_test.css) }' <<-EOF
490a
491EOF
492./crm114 '-{learn < neural append > (a_test.css) }' < Alice_In_Wonderland_Chap_1_And_2.txt
493./crm114 '-{learn < neural refute fromstart > (a_test.css) }' < Macbeth_Act_IV.txt
494./crm114 '-{learn < neural append > (m_test.css) }' <<-EOF
495b
496EOF
497./crm114 '-{learn < neural append > (m_test.css) }' < Macbeth_Act_IV.txt
498./crm114 '-{learn < neural refute fromstart > (m_test.css) }' < Alice_In_Wonderland_Chap_1_And_2.txt
499./crm114 '-{ isolate (:s:); {classify < neural > ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
500So she was considering, in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
501EOF
502./crm114 '-{ isolate (:s:); {classify < neural > ( m_test.css | a_test.css ) (:s:) ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
503    Fillet of a fenny snake,
504    In the cauldron boil and bake;
505    Eye of newt and toe of frog,
506    Wool of bat and tongue of dog,
507    Adder's fork and blind-worm's sting,
508    Lizard's leg and owlet's wing,
509    For a charm of powerful trouble,
510    Like a hell-broth boil and bubble.
511EOF
512
513rm -f m_test.css
514rm -f a_test.css
515
516./crm114 alternating_example_neural.crm
517
518rm -f m_test.css
519rm -f a_test.css
520
521./crm114 '-{window; output /\n**** Support Vector Machine (SVM) unigram classifier \n/}'
522./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < svm unigram unique > (m_test.css) /[[:graph:]]+/; liaf}' < Macbeth_Act_IV.txt
523
524
525./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < svm unigram refute unique > (m_test.css) /[[:graph:]]+/; liaf }' < Alice_In_Wonderland_Chap_1_And_2.txt
526
527./crm114 '-{ isolate (:s:); {classify < svm unigram unique > ( m_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:]   ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
528when suddenly a White Rabbit with pink eyes ran close to her.
529EOF
530
531./crm114 '-{ isolate (:s:); {classify < svm unigram unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:] ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
532    Double, double toil and trouble;
533    Fire burn, and cauldron bubble.
534EOF
535
536rm -f m_test.css
537
538./crm114 '-{window; output /\n**** Support Vector Machine (SVM) classifier \n/}'
539./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < svm unique > (m_test.css) /[[:graph:]]+/; liaf}' < Macbeth_Act_IV.txt
540./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < svm unique refute > (m_test.css) /[[:graph:]]+/; liaf }' < Alice_In_Wonderland_Chap_1_And_2.txt
541
542./crm114 '-{ isolate (:s:); {classify < svm unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:]   ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
543when suddenly a White Rabbit with pink eyes ran close to her.
544EOF
545
546./crm114 '-{ isolate (:s:); {classify < svm unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:] ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
547    Double, double toil and trouble;
548    Fire burn, and cauldron bubble.
549EOF
550
551rm -f m_test.css
552rm -f a_test.css
553rm -f m_vs_a_test.css
554
555./crm114 alternating_example_svm.crm
556
557rm -f m_test.css
558rm -f a_test.css
559
560./crm114 '-{window; output /\n**** String Kernel SVM (SKS) classifier \n/}'
561./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < sks > (m_test.css) /[[:graph:]]+/; liaf}' < Macbeth_Act_IV.txt
562./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < sks > (a_test.css) /[[:graph:]]+/; liaf }' < Alice_In_Wonderland_Chap_1_And_2.txt
563#    build the actual hyperplanes
564./crm114 '-{window; learn ( m_test.css | a_test.css | m_vs_a_test.css ) < sks > /[[:graph:]]+/ /0 0 100 0.001 1 1 4/ }'
565
566./crm114 '-{ isolate (:s:); {classify < sks > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 0.001 1 1 4/ [:_dw:]   ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
567when suddenly a White Rabbit with pink eyes ran close to her.
568EOF
569
570./crm114 '-{ isolate (:s:); {classify < sks > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 0.001 1 1 4/ [:_dw:] ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
571    Double, double toil and trouble;
572    Fire burn, and cauldron bubble.
573EOF
574rm -f m_vs_a_test.css
575rm -f m_test.css
576rm -f a_test.css
577
578./crm114 '-{window; output /\n**** String Kernel SVM (SKS) Unique classifier \n/}'
579./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; translate [:one_paragraph:] (:one_paragraph:) /.,!?@#$%^&*()/; learn [:one_paragraph:] < sks unique > (m_test.css) /[[:graph:]]+/ / 0 0 100 0.001 1 1 4/; liaf}' < Macbeth_Act_IV.txt
580./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/;  translate [:one_paragraph:] (:one_paragraph:) /.,!?@#$%^&*()/; learn [:one_paragraph:] < sks unique > (a_test.css) /[[:graph:]]+/ /0 0 100 0.001 1 1 4/ ; liaf }' < Alice_In_Wonderland_Chap_1_And_2.txt
581#    build the actual hyperplanes
582./crm114 '-{window; learn ( m_test.css | a_test.css | m_vs_a_test.css ) < sks unique > /[[:graph:]]+/ /0 0 100 0.001 1 1 4/ }'
583
584./crm114 '-{ isolate (:s:);  translate /.,!?@#$%^&*()/; {classify < sks unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 0.001 1 1 4/ [:_dw:]   ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
585when suddenly a White Rabbit with pink eyes ran close to her.
586EOF
587
588./crm114 '-{ isolate (:s:); translate /.,!?@#$%^&*()/; {classify < sks unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 0.001 1 1 4/ [:_dw:] ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
589    Double, double toil and trouble;
590    Fire burn, and cauldron bubble.
591EOF
592
593rm -f m_vs_a_test.css
594rm -f m_test.css
595rm -f a_test.css
596
597
598./crm114 '-{window ; output /\n**** Bytewise Correlation classifier \n/}'
599./crm114 '-{ isolate (:s:) {classify <correlate> ( Macbeth_Act_IV.txt | Alice_In_Wonderland_Chap_1_And_2.txt ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
600when suddenly a White Rabbit with pink eyes ran close to her.
601EOF
602./crm114 '-{ isolate (:s:) {classify <correlate> ( Macbeth_Act_IV.txt | Alice_In_Wonderland_Chap_1_And_2.txt ) (:s:) /[[:graph:]]+/ ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
603    Fillet of a fenny snake,
604    In the cauldron boil and bake;
605    Eye of newt and toe of frog,
606    Wool of bat and tongue of dog,
607    Adder's fork and blind-worm's sting,
608    Lizard's leg and owlet's wing,
609    For a charm of powerful trouble,
610    Like a hell-broth boil and bubble.
611EOF
612
613rm -f m_test.css
614rm -f a_test.css
615
616./crm114 '-{window; output /\n**** Clump \/ Pmulc Test \n/}'
617
618./crm114 '-{ match <fromend> (:one_paragraph:) /([[:graph:]]+.*?\n\n){5}/; clump <bychunk> [:one_paragraph:] (m_test.css) /[[:graph:]]+/; output /./ ; liaf}' < Macbeth_Act_IV.txt
619
620./crm114 '-{ match <fromend> (:one_paragraph:) /([[:graph:]]+.*?\n\n){5}/; clump [:one_paragraph:] <bychunk> (m_test.css) /[[:graph:]]+/; output /./; liaf }' < Alice_In_Wonderland_Chap_1_And_2.txt
621
622#    Now see where our paragraphs go to
623
624./crm114 '-{ isolate (:s:); { pmulc  ( m_test.css) (:s:) <bychunk> /[[:graph:]]+/  [:_dw:]   ; output /Likely result: \n:*:s:\n/} alius { output / Unsure result \n:*:s:\n/ } }' <<-EOF
625So she was considering, in her own mind (as well as she could, for the
626hot day made her feel very sleepy and stupid), whether the pleasure of
627making a daisy-chain would be worth the trouble of getting up and
628picking the daisies, when suddenly a White Rabbit with pink eyes ran
629close by her.
630EOF
631
632./crm114 '-{ isolate (:s:); { pmulc  ( m_test.css) (:s:) <bychunk> /[[:graph:]]+/  [:_dw:]   ; output /Likely result: \n:*:s:\n/} alius { output / Unsure result \n:*:s:\n/ } }' <<-EOF
633    Fillet of a fenny snake,
634    In the cauldron boil and bake;
635    Eye of newt and toe of frog,
636    Wool of bat and tongue of dog,
637    Adder's fork and blind-worm's sting,
638    Lizard's leg and owlet's wing,
639    For a charm of powerful trouble,
640    Like a hell-broth boil and bubble.
641EOF
642
643./crm114 '-{ isolate (:s:); { pmulc  ( m_test.css) (:s:) <bychunk> /[[:graph:]]+/  [:_dw:]   ; output /Likely result: \n:*:s:\n/} alius { output / Unsure result \n:*:s:\n/ } }' <<-EOF
644EOF
645
646rm -f m_test.css
647rm -f a_test.css
648
649./crm114 '-{window; output /\n**** Principal Component Analysis (PCA) unigram classifier \n/}'
650./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < pca unigram unique > (m_test.css) /[[:graph:]]+/; liaf}' < Macbeth_Act_IV.txt
651
652
653./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < pca unigram refute unique > (m_test.css) /[[:graph:]]+/; liaf }' < Alice_In_Wonderland_Chap_1_And_2.txt
654
655./crm114 '-{ isolate (:s:); {classify < pca unigram unique > ( m_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:]   ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
656when suddenly a White Rabbit with pink eyes ran close to her.
657EOF
658
659./crm114 '-{ isolate (:s:); {classify < pca unigram unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:] ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
660    Double, double toil and trouble;
661    Fire burn, and cauldron bubble.
662EOF
663
664rm -f m_test.css
665
666./crm114 '-{window; output /\n**** Principal Component Analysis (PCA) classifier \n/}'
667./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < pca unique > (m_test.css) /[[:graph:]]+/; liaf}' < Macbeth_Act_IV.txt
668./crm114 '-{ match <fromend> (:one_paragraph:) /[[:graph:]]+.*?\n\n/; learn [:one_paragraph:] < pca unique refute > (m_test.css) /[[:graph:]]+/; liaf }' < Alice_In_Wonderland_Chap_1_And_2.txt
669
670./crm114 '-{ isolate (:s:); {classify < pca unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:]   ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ } }' <<-EOF
671when suddenly a White Rabbit with pink eyes ran close to her.
672EOF
673
674./crm114 '-{ isolate (:s:); {classify < pca unique > ( m_test.css | a_test.css | m_vs_a_test.css ) (:s:) /[[:graph:]]+/ /0 0 100 1e-3 1 0.5 1/ [:_dw:] ; output / type M \n:*:s:\n/} alius { output / type A \n:*:s:\n/ }}' <<-EOF
675    Double, double toil and trouble;
676    Fire burn, and cauldron bubble.
677EOF
678
679rm -f m_test.css
680rm -f a_test.css
681
682./crm114 alternating_example_pca.crm
683
684rm -f m_test.css
685rm -f a_test.css