 |
Edinburgh Speech Tools
2.4-release
|
|
44 #ifndef __EST_ITEM_H__
45 #define __EST_ITEM_H__
47 #include "EST_String.h"
48 #include "EST_Features.h"
49 #include "ling_class/EST_Item_Content.h"
52 extern val_type val_type_featfunc;
53 const EST_Item_featfunc featfunc(
const EST_Val &v);
54 EST_Val est_val(
const EST_Item_featfunc f);
95 void unref_contents();
107 static void class_init(
void);
139 {
return f(name,def).
Float();}
150 {
return f(name, def).
string();}
159 {
return f(name, def).
Int();}
171 return *feats(f(name, est_val(ff)));}
209 features().
set_path(name, est_val(ff)); }
223 { features().
remove(name); }
233 return features().
present(name);
249 {
return f(
"name",0).
string(); }
262 v.
type() == val_type_featfunc && featfunc(v) != NULL;
263 v=(featfunc(v))((
EST_Item *)(
void *)
this));
264 if (v.
type() == val_type_featfunc)
265 EST_error(
"NULL %s function",(
const char *)name);
277 for (v=&(p_contents->
f.
val_path(name, def));
278 v->
type() == val_type_featfunc && featfunc(*v) != NULL;
279 v=&(featfunc(*v))((
EST_Item *)(
void *)
this));
280 if (v->
type() == val_type_featfunc)
290 for (v=p_contents->
f.
val_path(name, def);
291 v.
type() == val_type_featfunc && featfunc(v) != NULL;
292 v=(featfunc(v))((
EST_Item *)(
void *)
this));
293 if (v.
type() == val_type_featfunc)
303 {
return p_contents->Relation(relname); }
307 {
return p_contents->in_relation(relname); }
317 {
return (
this == 0) ? 0 : p_relation; }
321 {
return contents() && li->contents() && (contents() == li->contents()); }
330 {
if(a !=NULL) a->n = b;
if (b != NULL) b->p=a; }
370 friend ostream& operator << (ostream &s,
const EST_Item &a);
372 {
return !i_same_item(&a,&b); }
374 {
return i_same_item(&a,&b); }
382 return l1->contents() && l2->contents() &&
383 (l1->contents() == l2->contents());
407 #include "ling_class/EST_Relation_list.h"
408 #include "ling_class/EST_Relation_tree.h"
409 #include "ling_class/EST_Relation_mls.h"
411 void remove_item(
EST_Item *l,
const char *relname);
418 #include "ling_class/EST_FeatureFunctionPackage.h"
423 void register_featfunc(
const EST_String &name,
const EST_Item_featfunc func);
424 const EST_Item_featfunc get_featfunc(
const EST_String &name,
int must=0);
425 EST_String get_featname(
const EST_Item_featfunc func);
427 #define EST_register_feature_functions(PACKAGE) \
429 extern void register_ ## PACKAGE ## _feature_functions(EST_FeatureFunctionPackage &p); \
430 EST_register_feature_function_package( #PACKAGE , register_ ## PACKAGE ## _feature_functions); \
void set_path(const EST_String &name, const EST_Val &sval)
void set(const EST_String &name, double fval)
EST_Features & A(const EST_String &name, EST_Features &def) const
const EST_String & relation_name() const
The relation name of this particular item.
int same_item(const EST_Item *li) const
True if li is the same item ignoring its relation viewpoint.
int in_relation(const EST_String &relname) const
TRUE if this item is in named relation.
void set(const EST_String &name, const EST_String &sval)
const EST_String S(const EST_String &name) const
void set(const EST_String &name, float fval)
void set_function(const EST_String &name, const EST_String &funcname)
const EST_String & string(void) const
~EST_Item()
Deletes it and references to it in its contents.
EST_Item * as_relation(const char *relname) const
View item from another relation (const char *) method.
const int Int(void) const
int f_present(const EST_String &name) const
void f_remove(const EST_String &name)
void set(const EST_String &name, EST_Features &f)
EST_Relation * relation(void) const
The relation of this particular item.
const float F(const EST_String &name) const
void set_name(const EST_String &s)
set name
void remove(const EST_String &name)
void set(const EST_String &name, const char *cval)
EST_Item()
Default constructor.
const float Float(void) const
const float F(const EST_String &name, float def) const
const val_type type(void) const
int present(const EST_String &name) const
void set_val(const EST_String &name, const EST_Val &sval)
const EST_String S(const EST_String &name, const EST_String &def) const
void set(const EST_String &name, int ival)
EST_Features & A(const EST_String &name) const
EST_TKVL< EST_String, EST_Val > & relations()
Access to the relation links.
const EST_Val & val_path(const EST_String &path) const
void set_function(const EST_String &name, const EST_String &f)
const int I(const EST_String &name) const
const int I(const EST_String &name, int def) const
EST_Features f
General features for this item.