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

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