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

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