Blame SOURCES/festival-1.96-speechtools-1.2.96-beta+awb.patch

7b3626
diff -ur festival/speech_tools.old/grammar/ngram/EST_Ngrammar.cc festival/speech_tools/grammar/ngram/EST_Ngrammar.cc
7b3626
--- festival/speech_tools.old/grammar/ngram/EST_Ngrammar.cc	2004-09-30 08:53:36.000000000 -0400
7b3626
+++ festival/speech_tools/grammar/ngram/EST_Ngrammar.cc	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -306,7 +306,7 @@
7b3626
     // not right - just print out, then recurse through children
7b3626
     // change to use 'backoff_traverse'
7b3626
     
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
     for (k=p_pdf.item_start();
7b3626
@@ -373,7 +373,7 @@
7b3626
 {
7b3626
 
7b3626
     // recursively delete this state and all its children
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
     for (k=p_pdf.item_start();
7b3626
@@ -456,7 +456,8 @@
7b3626
 
7b3626
 void EST_BackoffNgrammarState::frequency_of_frequencies(EST_DVector &ff)
7b3626
 {
7b3626
-    int k,max=ff.n();
7b3626
+    int max=ff.n();
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
     for (k=p_pdf.item_start();
7b3626
@@ -1585,7 +1586,7 @@
7b3626
     // remove any branches with zero frequency count
7b3626
     
7b3626
     // find children of this state with zero freq and zap them
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
     for (k=start_state->pdf_const().item_start();
7b3626
@@ -2324,7 +2325,8 @@
7b3626
 	backoff_representation->print_freqs(os,p_order);
7b3626
     else
7b3626
     {
7b3626
-	int i,j,k;
7b3626
+	int i,j;
7b3626
+        EST_Litem *k;
7b3626
 	EST_IVector window(p_order-1);
7b3626
 	
7b3626
 	for (i=0; i < p_num_states; i++)
7b3626
@@ -2665,7 +2667,7 @@
7b3626
     function(start_state,params);
7b3626
     
7b3626
     // and recurse down the tree
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
     for (k=start_state->pdf_const().item_start();
7b3626
@@ -2696,7 +2698,7 @@
7b3626
     {
7b3626
 	// and recurse down the tree if we haven't
7b3626
 	// reached the level yet
7b3626
-	int k;
7b3626
+	EST_Litem *k;
7b3626
 	double freq;
7b3626
 	EST_String name;
7b3626
 	
7b3626
diff -ur festival/speech_tools.old/grammar/ngram/EST_PST.cc festival/speech_tools/grammar/ngram/EST_PST.cc
7b3626
--- festival/speech_tools.old/grammar/ngram/EST_PST.cc	2004-09-30 08:53:36.000000000 -0400
7b3626
+++ festival/speech_tools/grammar/ngram/EST_PST.cc	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -71,7 +71,8 @@
7b3626
 	// Base -- print from pd 
7b3626
 	EST_String s;
7b3626
 	double freq;
7b3626
-	for (int i = pd.item_start(); 
7b3626
+        EST_Litem *i;
7b3626
+	for (i = pd.item_start(); 
7b3626
 	     !pd.item_end(i); 
7b3626
 	     i=pd.item_next(i))
7b3626
 	{
7b3626
@@ -98,7 +99,7 @@
7b3626
 	EST_String s;
7b3626
 	double prob;
7b3626
 	os << get_path() << " :";
7b3626
-	for (int i = pd.item_start(); !pd.item_end(i) ; i=pd.item_next(i))
7b3626
+	for (EST_Litem *i = pd.item_start(); !pd.item_end(i) ; i=pd.item_next(i))
7b3626
 	{
7b3626
 	    pd.item_prob(i,s,prob);
7b3626
 	    os << " " << s << " " << prob;
7b3626
diff -ur festival/speech_tools.old/grammar/ngram/freqsmooth.cc festival/speech_tools/grammar/ngram/freqsmooth.cc
7b3626
--- festival/speech_tools.old/grammar/ngram/freqsmooth.cc	2004-09-30 08:53:36.000000000 -0400
7b3626
+++ festival/speech_tools/grammar/ngram/freqsmooth.cc	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -74,7 +74,8 @@
7b3626
 				 EST_Ngrammar &ngram)
7b3626
 {
7b3626
     // Build all the backoff grammars back to uni-grams
7b3626
-    int i,j,k,l;
7b3626
+    int i,j,l;
7b3626
+    EST_Litem *k;
7b3626
 
7b3626
     for (i=0; i < ngram.order()-1; i++)
7b3626
 	backoff_ngrams[i].init(i+1,EST_Ngrammar::dense,
7b3626
@@ -110,7 +111,8 @@
7b3626
 {
7b3626
     // For all ngrams which are too infrequent, adjust their
7b3626
     // frequencies based on their backoff probabilities
7b3626
-    int i,j;
7b3626
+    int i;
7b3626
+    EST_Litem *j;
7b3626
     double occurs;
7b3626
     double backoff_prob;
7b3626
 
7b3626
diff -ur festival/speech_tools.old/grammar/ngram/ngrammar_aux.cc festival/speech_tools/grammar/ngram/ngrammar_aux.cc
7b3626
--- festival/speech_tools.old/grammar/ngram/ngrammar_aux.cc	2004-09-30 08:53:36.000000000 -0400
7b3626
+++ festival/speech_tools/grammar/ngram/ngrammar_aux.cc	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -117,7 +117,7 @@
7b3626
 
7b3626
 void make_f_of_f(EST_BackoffNgrammarState *s,void *params)
7b3626
 {
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
 
7b3626
@@ -138,7 +138,7 @@
7b3626
 
7b3626
 void get_max_f(EST_BackoffNgrammarState *s,void *params)
7b3626
 {
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
 
7b3626
@@ -158,7 +158,7 @@
7b3626
 
7b3626
 void map_f_of_f(EST_BackoffNgrammarState *s,void *params)
7b3626
 {
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
 
7b3626
@@ -184,7 +184,7 @@
7b3626
 
7b3626
 void zero_small_f(EST_BackoffNgrammarState *s,void *params)
7b3626
 {
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     double freq;
7b3626
     EST_String name;
7b3626
 
7b3626
@@ -204,7 +204,8 @@
7b3626
 
7b3626
 void frequency_of_frequencies(EST_DVector &ff, EST_Ngrammar &n,int this_order)
7b3626
 {
7b3626
-  int i,k,size;
7b3626
+  int i,size;
7b3626
+  EST_Litem *k;
7b3626
   double max=0.0;
7b3626
 
7b3626
   // if ff has zero size, do complete frequency of frequencies
7b3626
@@ -302,8 +303,8 @@
7b3626
 
7b3626
 void map_frequencies(EST_Ngrammar &n, const EST_DVector &map, const int this_order)
7b3626
 {
7b3626
-  int i,k;
7b3626
-
7b3626
+    int i;
7b3626
+    EST_Litem *k;
7b3626
 
7b3626
   switch(n.representation())
7b3626
     {
7b3626
diff -ur festival/speech_tools.old/grammar/ngram/ngrammar_io.cc festival/speech_tools/grammar/ngram/ngrammar_io.cc
7b3626
--- festival/speech_tools.old/grammar/ngram/ngrammar_io.cc	2004-09-30 08:53:36.000000000 -0400
7b3626
+++ festival/speech_tools/grammar/ngram/ngrammar_io.cc	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -281,7 +281,8 @@
7b3626
 load_ngram_cstr_bin(const EST_String filename, EST_Ngrammar &n)
7b3626
 {
7b3626
     EST_TokenStream ts;
7b3626
-    int i,j,k,order;
7b3626
+    int i,j,order;
7b3626
+    EST_Litem *k;
7b3626
     int num_entries;
7b3626
     double approx_num_samples = 0.0;
7b3626
     long freq_data_start, freq_data_end;
7b3626
@@ -407,7 +408,7 @@
7b3626
 save_ngram_htk_ascii_sub(const EST_String &word, ostream *ost, 
7b3626
 			 EST_Ngrammar &n, double floor)
7b3626
 {
7b3626
-    int k;
7b3626
+    EST_Litem *k;
7b3626
     EST_String name;
7b3626
     double freq;
7b3626
     EST_StrVector this_ngram(2); // assumes bigram
7b3626
@@ -734,7 +735,8 @@
7b3626
     // awb's format
7b3626
     (void)trace;
7b3626
     ostream *ost;
7b3626
-    int i,k;
7b3626
+    int i;
7b3626
+    EST_Litem *k;
7b3626
     
7b3626
     if (filename == "-")
7b3626
 	ost = &cou;;
7b3626
@@ -831,7 +833,8 @@
7b3626
     if (n.representation() == EST_Ngrammar::sparse)
7b3626
 	return misc_write_error;
7b3626
     
7b3626
-    int i,k;
7b3626
+    int i;
7b3626
+    EST_Litem *k;
7b3626
     FILE *ofd;
7b3626
     double lfreq = -1;
7b3626
     double count = -1;
7b3626
diff -ur festival/speech_tools.old/grammar/wfst/wfst_train.cc festival/speech_tools/grammar/wfst/wfst_train.cc
7b3626
--- festival/speech_tools.old/grammar/wfst/wfst_train.cc	2005-07-26 18:37:36.000000000 -0400
7b3626
+++ festival/speech_tools/grammar/wfst/wfst_train.cc	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -315,7 +315,8 @@
7b3626
     LISP *ssplits;
7b3626
     gc_protect(&splits);
7b3626
     EST_String sname;
7b3626
-    int b,best_b,i;
7b3626
+    int b,best_b;
7b3626
+    EST_Litem *i;
7b3626
     int num_pdfs;
7b3626
     double best_score, score, sfreq;
7b3626
 
7b3626
@@ -390,7 +391,7 @@
7b3626
     // Find score of (a+b) vs (all-(a+b))
7b3626
     EST_DiscreteProbDistribution ab(a);
7b3626
     EST_DiscreteProbDistribution all_but_ab(all);
7b3626
-    int i;
7b3626
+    EST_Litem *i;
7b3626
     EST_String sname;
7b3626
     double sfreq, score;
7b3626
     for (i=b.item_start(); !b.item_end(i);
7b3626
@@ -522,7 +523,7 @@
7b3626
     EST_DiscreteProbDistribution pdf_split(&wfst.in_symbols());
7b3626
     EST_DiscreteProbDistribution pdf_remain(&wfst.in_symbols());
7b3626
     int in, tostate, id;
7b3626
-    int i;
7b3626
+    EST_Litem *i;
7b3626
     double sfreq;
7b3626
     EST_String sname;
7b3626
 
7b3626
diff -ur festival/speech_tools.old/include/EST_simplestats.h festival/speech_tools/include/EST_simplestats.h
7b3626
--- festival/speech_tools.old/include/EST_simplestats.h	2004-04-30 12:56:49.000000000 -0400
7b3626
+++ festival/speech_tools/include/EST_simplestats.h	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -47,6 +47,8 @@
7b3626
 #include "EST_TKVL.h"
7b3626
 #include "EST_types.h"
7b3626
 
7b3626
+typedef size_t int_iter; 
7b3626
+
7b3626
 /** A class for managing mapping string names to integers and back again,
7b3626
     mainly used for representing alphabets in n-grams and grammars etc.
7b3626
 
7b3626
@@ -249,7 +251,8 @@
7b3626
     /// Add this observation, may specify number of occurrences
7b3626
     void cumulate(const EST_String &s,double count=1);
7b3626
     /// Add this observation, i must be with in EST\_Discrete range
7b3626
-    void cumulate(const int i,double count=1);
7b3626
+    void cumulate(EST_Litem *i,double count=1);
7b3626
+    void cumulate(int i,double count=1);
7b3626
     /// Return the most probable member of the distribution
7b3626
     const EST_String &most_probable(double *prob = NULL) const;
7b3626
     /** Return the entropy of the distribution
7b3626
@@ -265,17 +268,18 @@
7b3626
     /// 
7b3626
     double frequency(const int i) const; 
7b3626
     /// Used for iterating through members of the distribution
7b3626
-    int item_start() const;
7b3626
+    EST_Litem *item_start() const;
7b3626
     /// Used for iterating through members of the distribution
7b3626
-    int item_next(int idx) const;
7b3626
+    EST_Litem *item_next(EST_Litem *idx) const;
7b3626
     /// Used for iterating through members of the distribution
7b3626
-    int item_end(int idx) const;
7b3626
+    int item_end(EST_Litem *idx) const;
7b3626
+
7b3626
     /// During iteration returns name given index 
7b3626
-    const EST_String &item_name(int idx) const;
7b3626
+    const EST_String &item_name(EST_Litem *idx) const;
7b3626
     /// During iteration returns name and frequency given index  
7b3626
-    void item_freq(int idx,EST_String &s,double &freq) const;
7b3626
+    void item_freq(EST_Litem *idx,EST_String &s,double &freq) const;
7b3626
     /// During iteration returns name and probability given index
7b3626
-    void item_prob(int idx,EST_String &s,double &prob) const;
7b3626
+    void item_prob(EST_Litem *idx,EST_String &s,double &prob) const;
7b3626
 
7b3626
     /// Returns discrete vocabulary of distribution
7b3626
     inline const EST_Discrete *const get_discrete() const { return discrete; };
7b3626
@@ -288,11 +292,13 @@
7b3626
         accordingly.  This is used when smoothing frequencies.
7b3626
     */
7b3626
     void set_frequency(int i,double c); 
7b3626
+    void set_frequency(EST_Litem *i,double c); 
7b3626
     
7b3626
     /// Sets the frequency of named item, without modifying {\tt num\_samples}.
7b3626
     void override_frequency(const EST_String &s,double c);
7b3626
     /// Sets the frequency of named item, without modifying {\tt num\_samples}.
7b3626
     void override_frequency(int i,double c); 
7b3626
+    void override_frequency(EST_Litem *i,double c); 
7b3626
     
7b3626
     /** Sets the number of samples.  Care should be taken on setting this
7b3626
         as it will affect how probabilities are calculated.
7b3626
diff -ur festival/speech_tools.old/include/EST_Track.h festival/speech_tools/include/EST_Track.h
7b3626
--- festival/speech_tools.old/include/EST_Track.h	2004-05-29 14:34:40.000000000 -0400
7b3626
+++ festival/speech_tools/include/EST_Track.h	2007-02-13 00:12:53.000000000 -0500
7b3626
@@ -61,6 +61,7 @@
7b3626
   tff_htk,
7b3626
   tff_htk_fbank,
7b3626
   tff_htk_mfcc,
7b3626
+  tff_htk_mfcc_e,
7b3626
   tff_htk_user,
7b3626
   tff_htk_discrete,
7b3626
   tff_xmg,
7b3626
diff -ur festival/speech_tools.old/include/EST_TSimpleVector.h festival/speech_tools/include/EST_TSimpleVector.h
7b3626
--- festival/speech_tools.old/include/EST_TSimpleVector.h	2006-07-06 08:57:24.000000000 -0400
7b3626
+++ festival/speech_tools/include/EST_TSimpleVector.h	2006-09-27 09:19:35.000000000 -0400
7b3626
@@ -60,6 +60,9 @@
7b3626
     EST_TSimpleVector(const EST_TSimpleVector<T> &v);
7b3626
     /// "size" constructor
7b3626
     EST_TSimpleVector(int n): EST_TVector<T>(n) {}; 
7b3626
+    /// memory constructor
7b3626
+    EST_TSimpleVector(int n, T* memory, int offset=0, 
7b3626
+		      int free_when_destroyed=0): EST_TVector<T>(n,memory) {}; 
7b3626
 
7b3626
     /// resize vector
7b3626
     void resize(int n, int set=1); 
7b3626
diff -ur festival/speech_tools.old/include/EST_Wagon.h festival/speech_tools/include/EST_Wagon.h
7b3626
--- festival/speech_tools.old/include/EST_Wagon.h	2006-08-11 18:39:02.000000000 -0400
7b3626
+++ festival/speech_tools/include/EST_Wagon.h	2006-12-02 11:44:48.000000000 -0500
7b3626
@@ -239,8 +239,7 @@
7b3626
 extern EST_FMatrix wgn_DistMatrix;
7b3626
 extern EST_Track wgn_VertexTrack;
7b3626
 extern EST_Track wgn_UnitTrack;
7b3626
-extern int wgn_VertexTrack_start;
7b3626
-extern int wgn_VertexTrack_end;
7b3626
+extern EST_Track wgn_VertexFeats;
7b3626
 
7b3626
 void wgn_load_datadescription(EST_String fname,LISP ignores);
7b3626
 void wgn_load_dataset(WDataSet &ds,EST_String fname);
7b3626
diff -ur festival/speech_tools.old/lib/siod/siod.scm festival/speech_tools/lib/siod/siod.scm
7b3626
--- festival/speech_tools.old/lib/siod/siod.scm	2003-03-31 09:28:24.000000000 -0500
7b3626
+++ festival/speech_tools/lib/siod/siod.scm	2006-12-11 17:36:10.000000000 -0500
7b3626
@@ -209,7 +209,13 @@
7b3626
 (defun append2 (a b)
7b3626
   (if (null a)
7b3626
       b
7b3626
-    (cons (car a) (append2 (cdr a) b))))
7b3626
+      (begin
7b3626
+        (let ((x (reverse a))
7b3626
+              (y b))
7b3626
+          (while x
7b3626
+            (set! y (cons (car x) y))
7b3626
+            (set! x (cdr x)))
7b3626
+          y))))
7b3626
 
7b3626
 (defun rplacd (a b)
7b3626
 "(replacd A B)
7b3626
diff -ur festival/speech_tools.old/main/wagon_main.cc festival/speech_tools/main/wagon_main.cc
7b3626
--- festival/speech_tools.old/main/wagon_main.cc	2006-09-10 17:33:18.000000000 -0400
7b3626
+++ festival/speech_tools/main/wagon_main.cc	2006-12-02 14:46:44.000000000 -0500
7b3626
@@ -2,7 +2,7 @@
7b3626
 /*                                                                       */
7b3626
 /*                Centre for Speech Technology Research                  */
7b3626
 /*                     University of Edinburgh, UK                       */
7b3626
-/*                     Copyright (c) 1996-2005                           */
7b3626
+/*                     Copyright (c) 1996-2006                           */
7b3626
 /*                        All Rights Reserved.                           */
7b3626
 /*                                                                       */
7b3626
 /*  Permission is hereby granted, free of charge, to use and distribute  */
7b3626
@@ -39,6 +39,8 @@
7b3626
 /*                                                                       */
7b3626
 /*  Added decision list support, Feb 1997                                */
7b3626
 /*                                                                       */
7b3626
+/*  Added vector support for Clustergen 2005/2006                        */
7b3626
+/*                                                                       */
7b3626
 /*=======================================================================*/
7b3626
 #include <cstdlib>
7b3626
 #include <iostream>
7b3626
@@ -111,6 +113,54 @@
7b3626
     return 0;
7b3626
 }
7b3626
 
7b3626
+static int set_Vertex_Feats(EST_Track &wgn_VertexFeats,
7b3626
+                            EST_String &wagon_track_features)
7b3626
+{
7b3626
+    int i,s=0,e;
7b3626
+    EST_TokenStream ts;
7b3626
+
7b3626
+    for (i=0; i
7b3626
+        wgn_VertexFeats.a(0,i) = 0.0;
7b3626
+
7b3626
+    ts.open_string(wagon_track_features);
7b3626
+    ts.set_WhiteSpaceChars(",- ");
7b3626
+    ts.set_PunctuationSymbols("");
7b3626
+    ts.set_PrePunctuationSymbols("");
7b3626
+    ts.set_SingleCharSymbols("");
7b3626
+
7b3626
+    while (!ts.eof())
7b3626
+    {
7b3626
+        EST_Token &token = ts.get();
7b3626
+        const EST_String ws = (const char *)token.whitespace();
7b3626
+        if (token == "all")
7b3626
+        {
7b3626
+            for (i=0; i
7b3626
+                wgn_VertexFeats.a(0,i) = 1.0;
7b3626
+            break;
7b3626
+        } else if ((ws == ",") || (ws == ""))
7b3626
+        {
7b3626
+            s = atoi(token.string());
7b3626
+            wgn_VertexFeats.a(0,s) = 1.0;
7b3626
+        } else if (ws == "-")
7b3626
+        {
7b3626
+            if (token == "")
7b3626
+                e = wgn_VertexFeats.num_channels()-1;
7b3626
+            else
7b3626
+                e = atoi(token.string());
7b3626
+            for (i=s; i<=e && i
7b3626
+                wgn_VertexFeats.a(0,i) = 1.0;
7b3626
+        } else
7b3626
+        {
7b3626
+            printf("wagon: track_feats invalid: %s at position %d\n",
7b3626
+                   (const char *)wagon_track_features,
7b3626
+                   ts.filepos());
7b3626
+            exit(-1);
7b3626
+        }
7b3626
+    }
7b3626
+
7b3626
+    return 0;
7b3626
+}
7b3626
+
7b3626
 static int wagon_main(int argc, char **argv)
7b3626
 {
7b3626
     // Top level function sets up data and creates a tree
7b3626
@@ -119,6 +169,8 @@
7b3626
     EST_String wgn_oname;
7b3626
     ostream *wgn_coutput = 0;
7b3626
     float stepwise_limit = 0;
7b3626
+    int feats_start=0, feats_end=0;
7b3626
+    int i;
7b3626
 
7b3626
     parse_command_line
7b3626
 	(argc, argv,
7b3626
@@ -142,6 +194,9 @@
7b3626
          "                  start channel vertex indices\n"+
7b3626
 	 "-track_end <int>\n"+
7b3626
          "                  end (inclusive) channel for vertex indices\n"+
7b3626
+	 "-track_feats <string>\n"+
7b3626
+         "                  Track features to use, comma separated list\n"+
7b3626
+         "                  with feature numbers and/or ranges, 0 start\n"+
7b3626
 	 "-unittrack <ifile>\n"+
7b3626
          "                  track for unit start and length in vertex track\n"+
7b3626
 	 "-quiet            No questions printed during building\n"+
7b3626
@@ -256,36 +311,53 @@
7b3626
     else if (al.present("-track"))
7b3626
     {
7b3626
         wgn_VertexTrack.load(al.val("-track"));
7b3626
-        wgn_VertexTrack_start = 0;
7b3626
-        wgn_VertexTrack_end = wgn_VertexTrack.num_channels()-1;
7b3626
+        wgn_VertexFeats.resize(1,wgn_VertexTrack.num_channels());
7b3626
+        for (i=0; i
7b3626
+            wgn_VertexFeats.a(0,i) = 1.0;
7b3626
     }
7b3626
 
7b3626
     if (al.present("-track_start"))
7b3626
     {
7b3626
-        wgn_VertexTrack_start = al.ival("-track_start");
7b3626
-        if ((wgn_VertexTrack_start < 0) ||
7b3626
-            (wgn_VertexTrack_start > wgn_VertexTrack.num_channels()))
7b3626
+        feats_start = al.ival("-track_start");
7b3626
+        if ((feats_start < 0) ||
7b3626
+            (feats_start > wgn_VertexTrack.num_channels()))
7b3626
         {
7b3626
             printf("wagon: track_start invalid: %d out of %d channels\n",
7b3626
-                   wgn_VertexTrack_start,
7b3626
+                   feats_start,
7b3626
                    wgn_VertexTrack.num_channels());
7b3626
             exit(-1);
7b3626
         }
7b3626
+        for (i=0; i
7b3626
+            wgn_VertexFeats.a(0,i) = 0.0; /* don't do feats up to start */
7b3626
+            
7b3626
     }
7b3626
 
7b3626
     if (al.present("-track_end"))
7b3626
     {
7b3626
-        wgn_VertexTrack_end = al.ival("-track_end");
7b3626
-        if ((wgn_VertexTrack_end < wgn_VertexTrack_start) ||
7b3626
-            (wgn_VertexTrack_end > wgn_VertexTrack.num_channels()))
7b3626
+        feats_end = al.ival("-track_end");
7b3626
+        if ((feats_end < feats_start) ||
7b3626
+            (feats_end > wgn_VertexTrack.num_channels()))
7b3626
         {
7b3626
             printf("wagon: track_end invalid: %d between start %d out of %d channels\n",
7b3626
-                   wgn_VertexTrack_end,
7b3626
-                   wgn_VertexTrack_start,
7b3626
+                   feats_end,
7b3626
+                   feats_start,
7b3626
                    wgn_VertexTrack.num_channels());
7b3626
             exit(-1);
7b3626
         }
7b3626
+        for (i=feats_end+1; i
7b3626
+            wgn_VertexFeats.a(0,i) = 0.0; /* don't do feats after end */
7b3626
     }
7b3626
+    if (al.present("-track_feats"))
7b3626
+    {   /* overrides start and end numbers */
7b3626
+        EST_String wagon_track_features = al.val("-track_feats");
7b3626
+        set_Vertex_Feats(wgn_VertexFeats,wagon_track_features);
7b3626
+    }
7b3626
+
7b3626
+    //    printf("Track feats\n");
7b3626
+    //    for (i=0; i
7b3626
+    //        if (wgn_VertexFeats.a(0,i) > 0.0)
7b3626
+    //            printf("%d ",i);
7b3626
+    //    printf("\n");
7b3626
 
7b3626
     if (al.present("-unittrack"))
7b3626
     {   /* contains two features, a start and length.  start indexes */
7b3626
diff -ur festival/speech_tools.old/siod/slib_str.cc festival/speech_tools/siod/slib_str.cc
7b3626
--- festival/speech_tools.old/siod/slib_str.cc	2004-09-30 08:53:36.000000000 -0400
7b3626
+++ festival/speech_tools/siod/slib_str.cc	2006-09-27 11:54:29.000000000 -0400
7b3626
@@ -268,7 +268,7 @@
7b3626
 LISP l_matches(LISP atom, LISP regex)
7b3626
 {
7b3626
     // t if printname of atom matches regex, nil otherwise
7b3626
-    EST_String pname = get_c_string(atom);
7b3626
+    const EST_String pname = get_c_string(atom);
7b3626
 
7b3626
     if (pname.matches(make_regex(get_c_string(regex))) == TRUE)
7b3626
 	return truth;
7b3626
diff -ur festival/speech_tools.old/speech_class/EST_TrackFile.cc festival/speech_tools/speech_class/EST_TrackFile.cc
7b3626
--- festival/speech_tools.old/speech_class/EST_TrackFile.cc	2006-09-10 16:32:14.000000000 -0400
7b3626
+++ festival/speech_tools/speech_class/EST_TrackFile.cc	2007-02-13 00:12:53.000000000 -0500
7b3626
@@ -522,7 +522,6 @@
7b3626
 // 	}
7b3626
 
7b3626
 	if( ascii ){
7b3626
-
7b3626
 	  for (j = 0; j < num_channels; ++j){
7b3626
 	    tr.a(i, j) = ts.get().Float(ok);
7b3626
 	    if (!ok)
7b3626
@@ -1254,6 +1253,11 @@
7b3626
     return save_htk_as(filename, tmp, HTK_MFCC);
7b3626
 }
7b3626
 
7b3626
+EST_write_status EST_TrackFile::save_htk_mfcc_e(const EST_String filename, EST_Track tmp)
7b3626
+{
7b3626
+    return save_htk_as(filename, tmp, HTK_MFCC | HTK_ENERGY);
7b3626
+}
7b3626
+
7b3626
 EST_write_status EST_TrackFile::save_htk_user(const EST_String filename, EST_Track tmp)
7b3626
 {
7b3626
     return save_htk_as(filename, tmp, HTK_USER);
7b3626
@@ -2097,14 +2101,14 @@
7b3626
 
7b3626
 EST_String EST_TrackFile::options_supported(void)
7b3626
 {
7b3626
-    EST_String s("Available track file formats:\n");
7b3626
+    EST_String s("AvailablE track file formats:\n");
7b3626
     
7b3626
     for(int n=0; n< EST_TrackFile::map.n() ; n++)
7b3626
     {
7b3626
 	const char *nm = EST_TrackFile::map.name(EST_TrackFile::map.token(n));
7b3626
 	const char *d = EST_TrackFile::map.info(EST_TrackFile::map.token(n)).description;
7b3626
 	
7b3626
-	s += EST_String::cat("        ", nm, EST_String(" ")*(12-strlen(nm)), d, "\n");
7b3626
+	s += EST_String::cat("        ", nm, EST_String(" ")*(13-strlen(nm)), d, "\n");
7b3626
     }
7b3626
     return s;
7b3626
 }
7b3626
@@ -2137,6 +2141,9 @@
7b3626
 {tff_htk_mfcc,	{ "htk_mfcc" }, 
7b3626
 {FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_mfcc,
7b3626
  "htk file (as MFCC)"}},
7b3626
+{tff_htk_mfcc_e,	{ "htk_mfcc_e" }, 
7b3626
+{FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_mfcc_e,
7b3626
+ "htk file (as MFCC_E)"}},
7b3626
 {tff_htk_user,	{ "htk_user" }, 
7b3626
 {FALSE, EST_TrackFile::load_htk, EST_TrackFile::save_htk_user,
7b3626
  "htk file (as USER)"}},
7b3626
diff -ur festival/speech_tools.old/speech_class/EST_TrackFile.h festival/speech_tools/speech_class/EST_TrackFile.h
7b3626
--- festival/speech_tools.old/speech_class/EST_TrackFile.h	2004-05-29 14:34:42.000000000 -0400
7b3626
+++ festival/speech_tools/speech_class/EST_TrackFile.h	2007-02-13 00:12:53.000000000 -0500
7b3626
@@ -111,6 +111,8 @@
7b3626
   static EST_write_status save_htk_fbank(SaveTrackFileArgs);
7b3626
   static EST_read_status load_htk_fbank(LoadTrackFileArgs);
7b3626
 
7b3626
+  static EST_write_status save_htk_mfcc_e(SaveTrackFileArgs);
7b3626
+
7b3626
   static EST_write_status save_htk_mfcc(SaveTrackFileArgs);
7b3626
   static EST_read_status load_htk_mfcc(LoadTrackFileArgs);
7b3626
 
7b3626
diff -ur festival/speech_tools.old/speech_class/EST_wave_io.cc festival/speech_tools/speech_class/EST_wave_io.cc
7b3626
--- festival/speech_tools.old/speech_class/EST_wave_io.cc	2006-01-12 10:37:51.000000000 -0500
7b3626
+++ festival/speech_tools/speech_class/EST_wave_io.cc	2007-02-13 00:12:53.000000000 -0500
7b3626
@@ -173,7 +173,7 @@
7b3626
 
7b3626
     current_pos = ts.tell();
7b3626
     if (ts.fread(header,NIST_HDR_SIZE,1) != 1)
7b3626
-	return misc_read_error;
7b3626
+	return wrong_format;
7b3626
 
7b3626
     if (strncmp(header,NIST_SIG,sizeof(NIST_SIG)) != 0)
7b3626
 	return wrong_format;
7b3626
diff -ur festival/speech_tools.old/stats/EST_DProbDist.cc festival/speech_tools/stats/EST_DProbDist.cc
7b3626
--- festival/speech_tools.old/stats/EST_DProbDist.cc	2004-09-30 08:53:36.000000000 -0400
7b3626
+++ festival/speech_tools/stats/EST_DProbDist.cc	2006-12-11 17:36:12.000000000 -0500
7b3626
@@ -46,6 +46,39 @@
7b3626
 #include "EST_TKVL.h"
7b3626
 #include "EST_simplestats.h"
7b3626
 
7b3626
+/* We share ints and pointers for two types of probability distributions */
7b3626
+/* The know discrete sets can be indexed by ints which is *much* faster  */
7b3626
+/* the indices pass around a pointers but the lower part contain ints in */
7b3626
+/* the discrete case                                                     */
7b3626
+/* On 64bit architectures this is a issue so we need have some macros    */
7b3626
+/* to help us here.                                                      */
7b3626
+
7b3626
+const int est_64to32(void *c)
7b3626
+{   /* this returns the bottom end of the pointer as an unsigned int */
7b3626
+    /* I believe this is a safe way to do it, we check the bits in the */
7b3626
+    /* 64 bit int and multiply them out in the 32 bit one              */
7b3626
+    /* there might be better ways, but I think you'd need to think about */
7b3626
+    /* byte order then                                                 */
7b3626
+    long long l;
7b3626
+    int d;
7b3626
+    int i,x;
7b3626
+
7b3626
+    l = (long long)c;
7b3626
+
7b3626
+    for (i=0,d=0,x=1; i<24; i++)
7b3626
+    {
7b3626
+        if (l & 1)
7b3626
+            d += x;
7b3626
+        l = l >> 1;
7b3626
+        x += x;
7b3626
+    }
7b3626
+
7b3626
+    return d;
7b3626
+}
7b3626
+/* #define tprob_int(X) ((sizeof(void *) != 8) ? est_64to32(X) : (int)X) */
7b3626
+#define tprob_int(X) (est_64to32(X))
7b3626
+
7b3626
+
7b3626
 EST_DiscreteProbDistribution::EST_DiscreteProbDistribution(const EST_Discrete *d,
7b3626
 		 const double n_samples, const EST_DVector &counts)
7b3626
 {
7b3626
@@ -109,7 +142,13 @@
7b3626
 	icounts.a_no_check(i) = 0;
7b3626
 }
7b3626
 
7b3626
-void EST_DiscreteProbDistribution::cumulate(const int i,double count)
7b3626
+void EST_DiscreteProbDistribution::cumulate(EST_Litem *i,double count)
7b3626
+{
7b3626
+    icounts[tprob_int(i)] += count;
7b3626
+    num_samples += count;
7b3626
+}
7b3626
+
7b3626
+void EST_DiscreteProbDistribution::cumulate(int i,double count)
7b3626
 {
7b3626
     icounts[i] += count;
7b3626
     num_samples += count;
7b3626
@@ -257,6 +296,21 @@
7b3626
 
7b3626
 }
7b3626
 
7b3626
+void EST_DiscreteProbDistribution::set_frequency(EST_Litem *i,double c)
7b3626
+{
7b3626
+    if (type == tprob_discrete)
7b3626
+    {
7b3626
+	num_samples -= icounts[tprob_int(i)];
7b3626
+	num_samples += c;
7b3626
+	icounts[tprob_int(i)] = c;
7b3626
+    }
7b3626
+    else
7b3626
+    {
7b3626
+	cerr << "ProbDistribution: can't access string type pd with int\n";
7b3626
+    }
7b3626
+
7b3626
+}
7b3626
+
7b3626
 
7b3626
 void EST_DiscreteProbDistribution::override_frequency(const EST_String &s,double c)
7b3626
 {
7b3626
@@ -274,6 +328,14 @@
7b3626
 	cerr << "ProbDistribution: can't access string type pd with int\n";
7b3626
 }
7b3626
 
7b3626
+void EST_DiscreteProbDistribution::override_frequency(EST_Litem *i,double c)
7b3626
+{
7b3626
+    if (type == tprob_discrete)
7b3626
+	icounts[tprob_int(i)] = c;
7b3626
+    else
7b3626
+	cerr << "ProbDistribution: can't access string type pd with int\n";
7b3626
+}
7b3626
+
7b3626
 double EST_DiscreteProbDistribution::entropy() const
7b3626
 {
7b3626
     // Returns the entropy of the current distribution
7b3626
@@ -305,70 +367,70 @@
7b3626
 }
7b3626
 
7b3626
 //  For iterating through members of a probability distribution
7b3626
-int EST_DiscreteProbDistribution::item_start(void) const
7b3626
+EST_Litem *EST_DiscreteProbDistribution::item_start(void) const
7b3626
 {
7b3626
     if (type == tprob_discrete)
7b3626
-	return 0;
7b3626
+	return NULL;
7b3626
     else
7b3626
-	return (int)scounts.list.head();
7b3626
+	return scounts.list.head();
7b3626
 }
7b3626
 
7b3626
-int EST_DiscreteProbDistribution::item_end(int idx) const
7b3626
+int EST_DiscreteProbDistribution::item_end(EST_Litem *idx) const
7b3626
 {
7b3626
     if (type == tprob_discrete)
7b3626
-	return (idx >= icounts.length());
7b3626
+	return (tprob_int(idx) >= icounts.length());
7b3626
     else
7b3626
-	return ((EST_Litem *)idx == 0);
7b3626
+	return (idx == 0);
7b3626
 }
7b3626
 
7b3626
-int EST_DiscreteProbDistribution::item_next(int idx) const
7b3626
+EST_Litem *EST_DiscreteProbDistribution::item_next(EST_Litem *idx) const
7b3626
 {
7b3626
     if (type == tprob_discrete)
7b3626
-	return ++idx;
7b3626
+	return (EST_Litem *)(((unsigned char *)idx)+1);
7b3626
     else
7b3626
-	return (int)next((EST_Litem *)idx);
7b3626
+	return next(idx);
7b3626
 }
7b3626
 
7b3626
-const EST_String &EST_DiscreteProbDistribution::item_name(int idx) const
7b3626
+const EST_String &EST_DiscreteProbDistribution::item_name(EST_Litem *idx) const
7b3626
 {
7b3626
     if (type == tprob_discrete)
7b3626
-	return discrete->name(idx);
7b3626
+	return discrete->name(tprob_int(idx));
7b3626
     else
7b3626
-	return scounts.list((EST_Litem *)idx).k;
7b3626
+	return scounts.list(idx).k;
7b3626
 }
7b3626
 
7b3626
-void EST_DiscreteProbDistribution::item_freq(int idx,EST_String &s,double &freq) const
7b3626
+void EST_DiscreteProbDistribution::item_freq(EST_Litem *idx,EST_String &s,double &freq) const
7b3626
 {
7b3626
     if (type == tprob_discrete)
7b3626
     {
7b3626
-	s = discrete->name(idx);
7b3626
-	freq = icounts(idx);
7b3626
+	s = discrete->name(tprob_int(idx));
7b3626
+	freq = icounts(tprob_int(idx));
7b3626
     }
7b3626
     else
7b3626
     {
7b3626
-	s = scounts.list((EST_Litem *)idx).k;
7b3626
-	freq = scounts.list((EST_Litem *)idx).v;
7b3626
+	s = scounts.list(idx).k;
7b3626
+	freq = scounts.list(idx).v;
7b3626
     }
7b3626
 }
7b3626
 
7b3626
-void EST_DiscreteProbDistribution::item_prob(int idx,EST_String &s,double &prob) const
7b3626
+void EST_DiscreteProbDistribution::item_prob(EST_Litem *idx,EST_String &s,double &prob) const
7b3626
 {
7b3626
     if (type == tprob_discrete)
7b3626
     {
7b3626
-	prob = probability(idx);
7b3626
-	s = discrete->name(idx);
7b3626
+	prob = probability(tprob_int(idx));
7b3626
+	s = discrete->name(tprob_int(idx));
7b3626
     }
7b3626
     else
7b3626
     {
7b3626
-	s = scounts.list((EST_Litem *)idx).k;
7b3626
-	prob = (double)scounts.list((EST_Litem *)idx).v/num_samples;
7b3626
+	s = scounts.list(idx).k;
7b3626
+	prob = (double)scounts.list(idx).v/num_samples;
7b3626
     }
7b3626
 }
7b3626
 
7b3626
 ostream & operator<<(ostream &s, const EST_DiscreteProbDistribution &pd)
7b3626
 {
7b3626
     // Output best with probabilities
7b3626
-    int i;
7b3626
+    EST_Litem *i;
7b3626
     double prob;
7b3626
     double sum=0;
7b3626
     EST_String name;
7b3626
diff -ur festival/speech_tools.old/stats/EST_viterbi.cc festival/speech_tools/stats/EST_viterbi.cc
7b3626
--- festival/speech_tools.old/stats/EST_viterbi.cc	2006-07-07 17:26:11.000000000 -0400
7b3626
+++ festival/speech_tools/stats/EST_viterbi.cc	2006-09-27 09:19:35.000000000 -0400
7b3626
@@ -165,7 +165,7 @@
7b3626
 	return (a < b);
7b3626
 }
7b3626
 
7b3626
-static void init_dynamic_states(EST_VTPoint *p, EST_VTCandidate *cands)
7b3626
+static int init_dynamic_states(EST_VTPoint *p, EST_VTCandidate *cands)
7b3626
 {
7b3626
     // In a special (hmm maybe not so special), the number of "states"
7b3626
     // is the number of candidates
7b3626
@@ -175,6 +175,8 @@
7b3626
     for (i=0, c=cands; c != 0; c=c->next,i++)
7b3626
 	c->pos = i;
7b3626
     init_paths_array(p,i);
7b3626
+    
7b3626
+    return i;
7b3626
 }
7b3626
 
7b3626
 void EST_Viterbi_Decoder::set_pruning_parameters(float beam, float
7b3626
diff -ur festival/speech_tools.old/stats/wagon/wagon_aux.cc festival/speech_tools/stats/wagon/wagon_aux.cc
7b3626
--- festival/speech_tools.old/stats/wagon/wagon_aux.cc	2006-08-20 13:02:39.000000000 -0400
7b3626
+++ festival/speech_tools/stats/wagon/wagon_aux.cc	2006-12-12 10:45:19.000000000 -0500
7b3626
@@ -422,16 +422,19 @@
7b3626
 
7b3626
 #if 1
7b3626
     /* simple distance */
7b3626
-    for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
+    for (j=0; j
7b3626
     {
7b3626
-        b.reset();
7b3626
-        for (pp=members.head(); pp != 0; pp=next(pp))
7b3626
+        if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
         {
7b3626
-            i = members.item(pp);
7b3626
-            b += wgn_VertexTrack.a(i,j);
7b3626
+            b.reset();
7b3626
+            for (pp=members.head(); pp != 0; pp=next(pp))
7b3626
+            {
7b3626
+                i = members.item(pp);
7b3626
+                b += wgn_VertexTrack.a(i,j);
7b3626
+            }
7b3626
+            a += b.stddev();
7b3626
+            count = b.samples();
7b3626
         }
7b3626
-        a += b.stddev();
7b3626
-        count = b.samples();
7b3626
     }
7b3626
 #endif
7b3626
 
7b3626
@@ -440,26 +443,37 @@
7b3626
     /* worse in listening experiments */
7b3626
     EST_SuffStats **cs;
7b3626
     int mmm;
7b3626
-    cs = new EST_SuffStats *[wgn_VertexTrack_end+1];
7b3626
-    for (j=0; j<=wgn_VertexTrack_end; j++)
7b3626
-        cs[j] = new EST_SuffStats[wgn_VertexTrack_end+1];
7b3626
+    cs = new EST_SuffStats *[wgn_VertexTrack.num_channels()+1];
7b3626
+    for (j=0; j<=wgn_VertexTrack.num_channels(); j++)
7b3626
+        cs[j] = new EST_SuffStats[wgn_VertexTrack.num_channels()+1];
7b3626
     /* Find means for diagonal */
7b3626
-    for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
+    for (j=0; j
7b3626
     {
7b3626
-        for (pp=members.head(); pp != 0; pp=next(pp))
7b3626
-            cs[j][j] += wgn_VertexTrack.a(members.item(pp),j);
7b3626
-    }
7b3626
-    for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-        for (i=j+1; i
7b3626
+        if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+        {
7b3626
             for (pp=members.head(); pp != 0; pp=next(pp))
7b3626
+                cs[j][j] += wgn_VertexTrack.a(members.item(pp),j);
7b3626
+        }
7b3626
+    }
7b3626
+    for (j=0; j
7b3626
+    {
7b3626
+        for (i=j+1; i
7b3626
+            if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
             {
7b3626
-                mmm = members.item(pp);
7b3626
-                cs[i][j] += (wgn_VertexTrack.a(mmm,i)-cs[j][j].mean())*
7b3626
-                    (wgn_VertexTrack.a(mmm,j)-cs[j][j].mean());
7b3626
-            }
7b3626
-    for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-        for (i=j+1; i
7b3626
-            a += cs[i][j].stddev();
7b3626
+                for (pp=members.head(); pp != 0; pp=next(pp))
7b3626
+                {
7b3626
+                    mmm = members.item(pp);
7b3626
+                    cs[i][j] += (wgn_VertexTrack.a(mmm,i)-cs[j][j].mean())*
7b3626
+                        (wgn_VertexTrack.a(mmm,j)-cs[j][j].mean());
7b3626
+                }
7b3626
+            }
7b3626
+    }
7b3626
+    for (j=0; j
7b3626
+    {
7b3626
+        for (i=j+1; i
7b3626
+            if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                a += cs[i][j].stddev();
7b3626
+    }
7b3626
     count = cs[0][0].samples();
7b3626
 #endif
7b3626
 
7b3626
@@ -476,11 +490,12 @@
7b3626
         for (qq=next(pp); qq != 0; qq=next(qq))
7b3626
         {
7b3626
             y = members.item(qq);
7b3626
-            for (q=0.0,j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-            {
7b3626
-                d = wgn_VertexTrack(x,j)-wgn_VertexTrack(y,j);
7b3626
-                q += d*d;
7b3626
-            }
7b3626
+            for (q=0.0,j=0; j
7b3626
+                if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                {
7b3626
+                    d = wgn_VertexTrack(x,j)-wgn_VertexTrack(y,j);
7b3626
+                    q += d*d;
7b3626
+                }
7b3626
             a += sqrt(q);
7b3626
         }
7b3626
 
7b3626
@@ -562,7 +577,7 @@
7b3626
 
7b3626
         /* a list of SuffStats on for each point in the trajectory */
7b3626
         trajectory = new EST_SuffStats *[l];
7b3626
-        width = wgn_VertexTrack_end+1;
7b3626
+        width = wgn_VertexTrack.num_channels()+1;
7b3626
         for (j=0; j
7b3626
             trajectory[j] = new EST_SuffStats[width];
7b3626
 
7b3626
@@ -574,16 +589,22 @@
7b3626
             for (ti=0,n=0.0; ti
7b3626
             {
7b3626
                 ni = (int)n;  // hmm floor or nint ??
7b3626
-                for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-                    trajectory[ti][j] += wgn_VertexTrack.a(s+ni,j);
7b3626
+                for (j=0; j
7b3626
+                {
7b3626
+                    if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                        trajectory[ti][j] += wgn_VertexTrack.a(s+ni,j);
7b3626
+                }
7b3626
             }
7b3626
         }
7b3626
 
7b3626
         /* find sum of sum of stddev for all coefs of all traj points */
7b3626
         stdss.reset();
7b3626
         for (ti=0; ti
7b3626
-            for (j=wgn_VertexTrack_start+1; j<=wgn_VertexTrack_end; j++)
7b3626
-                stdss += trajectory[ti][j].stddev();
7b3626
+            for (j=0; j
7b3626
+            {
7b3626
+                if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                    stdss += trajectory[ti][j].stddev();
7b3626
+            }
7b3626
 
7b3626
         // This is sum of all stddev * samples
7b3626
         score = stdss.mean() * members.length();
7b3626
@@ -597,7 +618,7 @@
7b3626
         /* a list of SuffStats on for each point in the trajectory */
7b3626
         trajectory = new EST_SuffStats *[l];
7b3626
         for (j=0; j
7b3626
-            trajectory[j] = new EST_SuffStats[wgn_VertexTrack_end+1];
7b3626
+            trajectory[j] = new EST_SuffStats[wgn_VertexTrack.num_channels()+1];
7b3626
 
7b3626
         for (pp=members.head(); pp != 0; pp=next(pp))
7b3626
         {   /* for each unit */
7b3626
@@ -617,22 +638,26 @@
7b3626
             for (ti=0,n=0.0; s1l > 0 && ti
7b3626
             {
7b3626
                 ni = s + (((int)n < s1l) ? (int)n : s1l - 1);
7b3626
-                for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-                    trajectory[ti][j] += wgn_VertexTrack.a(ni,j);
7b3626
+                for (j=0; j
7b3626
+                    if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                        trajectory[ti][j] += wgn_VertexTrack.a(ni,j);
7b3626
             }
7b3626
             ti = l1; /* do it explicitly in case s1l < 1 */
7b3626
-            for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-                trajectory[ti][j] += -1;
7b3626
+            for (j=0; j
7b3626
+                if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                    trajectory[ti][j] += -1;
7b3626
             /* Second half */
7b3626
             s += s1l+1;
7b3626
             for (ti++,n=0.0; s2l > 0 && ti
7b3626
             {
7b3626
                 ni = s + (((int)n < s2l) ? (int)n : s2l - 1);
7b3626
-                for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-                    trajectory[ti][j] += wgn_VertexTrack.a(ni,j);
7b3626
-            }
7b3626
-            for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-                trajectory[ti][j] += -2;
7b3626
+                for (j=0; j
7b3626
+                    if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                        trajectory[ti][j] += wgn_VertexTrack.a(ni,j);
7b3626
+            }
7b3626
+            for (j=0; j
7b3626
+                if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                    trajectory[ti][j] += -2;
7b3626
         }
7b3626
 
7b3626
         /* find sum of sum of stddev for all coefs of all traj points */
7b3626
@@ -640,12 +665,14 @@
7b3626
         stdss.reset();
7b3626
         m = 1.0/(float)l1;
7b3626
         for (w=0.0,ti=0; ti
7b3626
-            for (j=wgn_VertexTrack_start+1; j<=wgn_VertexTrack_end; j++)
7b3626
+            for (j=0; j
7b3626
+                if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
                 stdss += trajectory[ti][j].stddev() * w;
7b3626
         m = 1.0/(float)l2;
7b3626
         for (w=1.0,ti++; ti
7b3626
-            for (j=wgn_VertexTrack_start+1; j<=wgn_VertexTrack_end; j++)
7b3626
-                stdss += trajectory[ti][j].stddev() * w;
7b3626
+            for (j=0; j
7b3626
+                if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                    stdss += trajectory[ti][j].stddev() * w;
7b3626
     
7b3626
         // This is sum of all stddev * samples
7b3626
         score = stdss.mean() * members.length();
7b3626
@@ -824,25 +851,27 @@
7b3626
             int bestp = 0;
7b3626
             EST_SuffStats *cs;
7b3626
 
7b3626
-            cs = new EST_SuffStats [wgn_VertexTrack_end+1];
7b3626
+            cs = new EST_SuffStats [wgn_VertexTrack.num_channels()+1];
7b3626
             
7b3626
-            for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-            {
7b3626
-                cs[j].reset();
7b3626
-                for (p=imp.members.head(); p != 0; p=next(p))
7b3626
+            for (j=0; j
7b3626
+                if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
                 {
7b3626
-                    cs[j] += wgn_VertexTrack.a(imp.members.item(p),j);
7b3626
+                    cs[j].reset();
7b3626
+                    for (p=imp.members.head(); p != 0; p=next(p))
7b3626
+                    {
7b3626
+                        cs[j] += wgn_VertexTrack.a(imp.members.item(p),j);
7b3626
+                    }
7b3626
                 }
7b3626
-            }
7b3626
 
7b3626
             for (p=imp.members.head(); p != 0; p=next(p))
7b3626
             {
7b3626
-                for (x=0,j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-                {
7b3626
-                    d = (wgn_VertexTrack.a(imp.members.item(p),j)-cs[j].mean())
7b3626
-                        /* / b.stddev() */ ;
7b3626
-                    x += d*d;
7b3626
-                }
7b3626
+                for (x=0.0,j=0; j
7b3626
+                    if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
+                    {
7b3626
+                        d = (wgn_VertexTrack.a(imp.members.item(p),j)-cs[j].mean())
7b3626
+                        /* / cs[j].stddev() */ ;
7b3626
+                        x += d*d;
7b3626
+                    }
7b3626
                 if (x < best)
7b3626
                 {
7b3626
                     bestp = imp.members.item(p);
7b3626
@@ -853,7 +882,12 @@
7b3626
             {
7b3626
                 s << "( ";
7b3626
                 s << wgn_VertexTrack.a(bestp,j);
7b3626
-                s << " 0 "; // fake stddev
7b3626
+                //                s << " 0 "; // fake stddev
7b3626
+                s << " ";
7b3626
+                if (finite(cs[j].stddev()))
7b3626
+                    s << cs[j].stddev();
7b3626
+                else
7b3626
+                    s << "0";
7b3626
                 s << " ) ";
7b3626
                 if (j+1
7b3626
                     s << " ";
7b3626
@@ -900,7 +934,7 @@
7b3626
     }
7b3626
     else if (imp.t == wnim_class)
7b3626
     {
7b3626
-	int i;
7b3626
+	EST_Litem *i;
7b3626
 	EST_String name;
7b3626
 	double prob;
7b3626
 
7b3626
diff -ur festival/speech_tools.old/stats/wagon/wagon.cc festival/speech_tools/stats/wagon/wagon.cc
7b3626
--- festival/speech_tools.old/stats/wagon/wagon.cc	2006-08-11 18:35:19.000000000 -0400
7b3626
+++ festival/speech_tools/stats/wagon/wagon.cc	2006-12-02 13:13:43.000000000 -0500
7b3626
@@ -58,8 +58,7 @@
7b3626
 WDataSet wgn_test_dataset;
7b3626
 EST_FMatrix wgn_DistMatrix;
7b3626
 EST_Track wgn_VertexTrack;
7b3626
-int wgn_VertexTrack_start=0;
7b3626
-int wgn_VertexTrack_end=24;
7b3626
+EST_Track wgn_VertexFeats;
7b3626
 EST_Track wgn_UnitTrack;
7b3626
 
7b3626
 int wgn_min_cluster_size = 50;
7b3626
@@ -349,34 +348,35 @@
7b3626
     {
7b3626
 	leaf = tree.predict_node((*dataset(p)));
7b3626
 	pos = dataset(p)->get_int_val(wgn_predictee);
7b3626
-        for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-        {
7b3626
-            b.reset();
7b3626
-            for (pp=leaf->get_impurity().members.head(); pp != 0; pp=next(pp))
7b3626
+        for (j=0; j
7b3626
+            if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
             {
7b3626
-                i = leaf->get_impurity().members.item(pp);
7b3626
-                b += wgn_VertexTrack.a(i,j);
7b3626
+                b.reset();
7b3626
+                for (pp=leaf->get_impurity().members.head(); pp != 0; pp=next(pp))
7b3626
+                {
7b3626
+                    i = leaf->get_impurity().members.item(pp);
7b3626
+                    b += wgn_VertexTrack.a(i,j);
7b3626
+                }
7b3626
+                predict = b.mean();
7b3626
+                actual = wgn_VertexTrack.a(pos,j);
7b3626
+                if (wgn_count_field == -1)
7b3626
+                    count = 1.0;
7b3626
+                else
7b3626
+                    count = dataset(p)->get_flt_val(wgn_count_field);
7b3626
+                x.cumulate(predict,count);
7b3626
+                y.cumulate(actual,count);
7b3626
+                /* Normalized the error by the standard deviation */
7b3626
+                if (b.stddev() == 0)
7b3626
+                    error = predict-actual;
7b3626
+                else
7b3626
+                    error = (predict-actual)/b.stddev();
7b3626
+                error = predict-actual; /* awb_debug */
7b3626
+                se.cumulate((error*error),count);
7b3626
+                e.cumulate(fabs(error),count);
7b3626
+                xx.cumulate(predict*predict,count);
7b3626
+                yy.cumulate(actual*actual,count);
7b3626
+                xy.cumulate(predict*actual,count);
7b3626
             }
7b3626
-            predict = b.mean();
7b3626
-            actual = wgn_VertexTrack.a(pos,j);
7b3626
-            if (wgn_count_field == -1)
7b3626
-                count = 1.0;
7b3626
-            else
7b3626
-                count = dataset(p)->get_flt_val(wgn_count_field);
7b3626
-            x.cumulate(predict,count);
7b3626
-            y.cumulate(actual,count);
7b3626
-            /* Normalized the error by the standard deviation */
7b3626
-            if (b.stddev() == 0)
7b3626
-                error = predict-actual;
7b3626
-            else
7b3626
-                error = (predict-actual)/b.stddev();
7b3626
-            error = predict-actual; /* awb_debug */
7b3626
-            se.cumulate((error*error),count);
7b3626
-            e.cumulate(fabs(error),count);
7b3626
-            xx.cumulate(predict*predict,count);
7b3626
-            yy.cumulate(actual*actual,count);
7b3626
-            xy.cumulate(predict*actual,count);
7b3626
-        }
7b3626
     }
7b3626
 
7b3626
     // Pearson's product moment correlation coefficient
7b3626
@@ -437,34 +437,35 @@
7b3626
     {
7b3626
 	leaf = tree.predict_node((*dataset(p)));
7b3626
 	pos = dataset(p)->get_int_val(wgn_predictee);
7b3626
-        for (j=wgn_VertexTrack_start; j<=wgn_VertexTrack_end; j++)
7b3626
-        {
7b3626
-            b.reset();
7b3626
-            for (pp=leaf->get_impurity().members.head(); pp != 0; pp=next(pp))
7b3626
+        for (j=0; j
7b3626
+            if (wgn_VertexFeats.a(0,j) > 0.0)
7b3626
             {
7b3626
-                i = leaf->get_impurity().members.item(pp);
7b3626
-                b += wgn_VertexTrack.a(i,j);
7b3626
+                b.reset();
7b3626
+                for (pp=leaf->get_impurity().members.head(); pp != 0; pp=next(pp))
7b3626
+                {
7b3626
+                    i = leaf->get_impurity().members.item(pp);
7b3626
+                    b += wgn_VertexTrack.a(i,j);
7b3626
+                }
7b3626
+                predict = b.mean();
7b3626
+                actual = wgn_VertexTrack.a(pos,j);
7b3626
+                if (wgn_count_field == -1)
7b3626
+                    count = 1.0;
7b3626
+                else
7b3626
+                    count = dataset(p)->get_flt_val(wgn_count_field);
7b3626
+                x.cumulate(predict,count);
7b3626
+                y.cumulate(actual,count);
7b3626
+                /* Normalized the error by the standard deviation */
7b3626
+                if (b.stddev() == 0)
7b3626
+                    error = predict-actual;
7b3626
+                else
7b3626
+                    error = (predict-actual)/b.stddev();
7b3626
+                error = predict-actual; /* awb_debug */
7b3626
+                se.cumulate((error*error),count);
7b3626
+                e.cumulate(fabs(error),count);
7b3626
+                xx.cumulate(predict*predict,count);
7b3626
+                yy.cumulate(actual*actual,count);
7b3626
+                xy.cumulate(predict*actual,count);
7b3626
             }
7b3626
-            predict = b.mean();
7b3626
-            actual = wgn_VertexTrack.a(pos,j);
7b3626
-            if (wgn_count_field == -1)
7b3626
-                count = 1.0;
7b3626
-            else
7b3626
-                count = dataset(p)->get_flt_val(wgn_count_field);
7b3626
-            x.cumulate(predict,count);
7b3626
-            y.cumulate(actual,count);
7b3626
-            /* Normalized the error by the standard deviation */
7b3626
-            if (b.stddev() == 0)
7b3626
-                error = predict-actual;
7b3626
-            else
7b3626
-                error = (predict-actual)/b.stddev();
7b3626
-            error = predict-actual; /* awb_debug */
7b3626
-            se.cumulate((error*error),count);
7b3626
-            e.cumulate(fabs(error),count);
7b3626
-            xx.cumulate(predict*predict,count);
7b3626
-            yy.cumulate(actual*actual,count);
7b3626
-            xy.cumulate(predict*actual,count);
7b3626
-        }
7b3626
     }
7b3626
 
7b3626
     // Pearson's product moment correlation coefficient
7b3626
diff -ur festival/speech_tools.old/.time-stamp festival/speech_tools/.time-stamp
7b3626
--- festival/speech_tools.old/.time-stamp	2006-09-27 10:59:11.000000000 -0400
7b3626
+++ festival/speech_tools/.time-stamp	2007-03-14 11:18:07.000000000 -0400
7b3626
@@ -1,2 +1,2 @@
7b3626
 speech_tools 1.2.96
7b3626
-Wed Sep 27 10:59:11 EDT 2006
7b3626
+Wed Mar 14 11:18:07 EDT 2007