40 #include "EST_Features.h" 
   41 #include "ling_class/EST_Item.h" 
   42 #include "EST_error.h" 
   43 #include "EST_String.h" 
   44 #include "EST_Token.h" 
   49     EST_Item_featfunc 
f = get_featfunc(funcname,1);
 
   54 void EST_Features::save_fpair(ostream &outf,
 
   59     if (fvalue.
type() == val_type_feats)
 
   62     if (f->features->
list.head() == 0)
 
   65         outf << fname << 
" () ; ";
 
   71                fname+
"."+f->features->
list(q).k,
 
   72                f->features->
list(q).v);
 
   83     outf << quote_string(fname,
"\"",
"\\",1) << 
" ";
 
   88     else if ((fvalue.
type() == val_string) &&
 
   95     outf << quote_string(fvalue.
string(),
"\"",
"\\",1);
 
   96     else if (fvalue.
type() == val_float)
 
   99     sprintf(b,
"%g",fvalue.
Float());
 
  102     else if (fvalue.
type() == val_type_featfunc)
 
  104     outf << 
"F:"<<get_featname(featfunc(fvalue));
 
  107     outf << quote_string(fvalue.
string());
 
  114     if (features->
list.head() == 0)
 
  117     for (
EST_Litem *p=features->
list.head(); p != 0; p=p->next() )
 
  120                features->
list(p).v);
 
  129     for (
EST_Litem *p=features->
list.head(); p != 0; p=p->next() )
 
  140         outf << quote_string(fname,
"\"",
"\\",1);
 
  146     else if ((fvalue.
type() == val_string) &&
 
  153         outf << quote_string(fvalue.
string(),
"\"",
"\\",1);
 
  154     else if (fvalue.
type() == val_float)
 
  157         sprintf(b,
"%g",fvalue.
Float());
 
  160     else if (fvalue.
type() == val_type_featfunc)
 
  162         outf << 
"F:"<<get_featname(featfunc(fvalue));
 
  164     else if (fvalue.
type() == val_type_feats)
 
  166         feats(fvalue)->save_sexpr(outf);
 
  169         outf << quote_string(fvalue.
string());
 
  183     if (ts.
peek() != 
"(")
 
  185     cerr << 
"load_features: no sexpression found\n";
 
  186     return misc_read_error;
 
  193     for (; ts.
peek() != 
")"; )
 
  195         if (ts.
peek() != 
"(")
 
  197         cerr << 
"load_features: no sexpression found\n";
 
  198         return misc_read_error;
 
  201         f = ts.
get().string();  
 
  213         else if (v.string().
matches(RXint))
 
  214             set(f,atoi(v.string()));
 
  215         else if (v.string().
matches(RXdouble))
 
  216             set(f,atof(v.string()));
 
  219             EST_Item_featfunc func = 
 
  220             get_featfunc(v.string().
after(
"F:"));
 
  225             cerr << 
"load_features: Unknown Function '" << f <<
"'\n";
 
  226             set_val(f,feature_default_value);
 
  235         cerr << 
"load_features: no sexpression found\n";
 
  236         return misc_read_error;
 
  241         cerr << 
"load_features: no sexpression found\n";
 
  242         return misc_read_error;
 
  259         cerr << 
"load_features: unexpected end of file\n";
 
  260         return misc_read_error;
 
  262     f = ts.
get().string();
 
  270             + ts.
peek().whitespace() 
 
  272     if (v.
quoted() || (v.string() == 
""))
 
  274     else if (v.string() == 
"0")  
 
  276     else if ((strchr(
"0123456789-.",v.string()(0)) != NULL) &&
 
  277          (v.string().
matches(RXdouble)))
 
  286         EST_Item_featfunc func = get_featfunc(v.string().
after(
"F:"));
 
  291         cerr << 
"load_features: Unknown Function '" << f <<
"'\n";
 
  295     else if (v.string() == 
"()")
 
  300     else if (v != 
"<contents>")  
 
  302     if (ts.
peek() == 
";")
 
  307         " missing semicolon in feature list\n";
 
  308         return misc_read_error;