name: AnnotationGraph
synopsis:

>     g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_mmedia.a

>     #include <AnnotationGraph.h>

>     static boolean diagnose(Integral::DEBUG debug_level);
>     String getId() const;
>     boolean setType(String& type);
>     String getType() const;
>     boolean get(DoubleLinkedList<Pair<Long, Anchor> >& ancrs, DoubleLinkedList<Triple<Long, Long, Annotation> >& annos);
>     boolean set(DoubleLinkedList<Pair<Long, Anchor> >& ancrs, DoubleLinkedList<Triple<Long, Long, Annotation> >& annos);
>     String createAnchor(String& id, float offset, String& unit);
>     boolean addAnchor(Anchor* ancr);
>     boolean deleteAnchor(Anchor* ancr);
>     Anchor* getAnchorById(const String& id);
>     String createAnnotation(String& id, Anchor* ancr, Anchor* ancr, String& type, long channel = Annotation::DEF_CHANNEL_INDEX);
>     boolean add(Annotation* anno);
>     boolean deleteAnnotation(Annotation* anno);
>     Annotation* getById(const String& id);
>     boolean setAnchorOffset(Anchor* ancr, float offset);
>     float getAnchorOffset(Anchor* ancr);
>     boolean unsetAnchorOffset(Anchor* ancr);
>     boolean getIncomingAnnotationSet(Anchor* ancr, DoubleLinkedList<Annotation>& annos);
>     boolean getOutgoingAnnotationSet(Anchor* ancr, DoubleLinkedList<Annotation>& annos);
>     Anchor* splitAnchor(Anchor* ancr);
>     Annotation* splitAnnotation(Annotation* anno);
>     boolean nSplitAnnotation(Annotation* anno, long num_split, DoubleLinkedList<Annotation>& annos);
>     boolean getAnchorSet(DoubleLinkedList<Anchor>& ancrs);
>     boolean getAnchorSetByOffset(float offset, DoubleLinkedList<Anchor>& ancrs, double epsilon = DEF_EPSILON);
>     boolean getAnnotationSetByType(const String& type, DoubleLinkedList<Annotation>& annos);
>     boolean getAnnotationSetByOffset(float offset, DoubleLinkedList<Annotation>& annos);
>     boolean getAnnotationSeqByOffset(DoubleLinkedList<Annotation>& annos, float begin = DEF_OFFSET, float end = DEF_OFFSET);
>     Annotation* getAnnotationByOffset(float offset);
>     float getNearestOffset(float arg);
>     boolean getAnchorSetNearestOffset(float offset, DoubleLinkedList<Anchor>& ancrs);
>     boolean setFeature(String& id, String& fname, String& fvalue);
>     boolean existsFeature(String& id, String& fmame);
>     boolean deleteFeature(String& id, String& fname);
>     String getFeature(String& id, String& fname);
>     boolean getFeatureNames(String& id, Vector<String>& names);
>     boolean unsetFeatures(String& id);
>     boolean setFeature(Annotation* anno, String& fname, String& fvalue);
>     boolean getAnnotationSetByFeature(const String& feature, const String& value, DoubleLinkedList<Annotation>& annos);

quick start:

>     Anchor* ancr_00;
>     Anchor* ancr_01;

>     String newid_00;
>     String newid_01;
>     String newid_02;

>     Float offset_00(2.4);
>     Float offset_01(4.9);

>     String atype_01(L"oh i see uh-huh");
>     String unit_00(L"seconds");

>     String gname_01(L"Switchboard");
>     String gtype_01(L"sw2001A-ms98-a-0001");

>     AnnotationGraph angr_01(gname_00, gtype_00);

>     newid_00 = angr_01.createAnchor(gname_01, offset_00, unit_00);
>     ancr_00 = angr_01.getAnchorById(newid_00);

>     newid_01 = angr_01.createAnchor(gname_01, offset_01, unit_00);
>     ancr_01 = angr_01.getAnchorById(newid_01);

>     newid_02 = angr_01.createAnnotation(gname_01, ancr_00, ancr_01, atype_00);

description:
This class is used to represent a set of annotations with different levels of annotations (sentence, word and phone) of a signal.

[1] S. Bird, M. Liberman, A Formal Framework for Linguistic Annotation, Linguistic Data Consortium, University of Pennsylvania, Philadelphia, Pennsylvania, USA, 2000. [2] K. Maeda, X. Ma, H. Lee, S. Bird, The Annotation Graph Toolkit: Application Developer's Manual (Draft), Linguistic Data Consortium, University of Pennsylvania, Philadelphia, Pennsylvania, USA, 2001.

dependencies:

- String.h
- HashTable.h
- Annotation.h
- Anchor.h

public constants:

- define the class name:

      static const String CLASS_NAME = L"AnnotationGraph";

- define i/o related constants:

      static const String DEF_PARAM;

      static const String DEF_ANCHOR;

      static const String DEF_ANNOTATION;

      static const String PARAM_ID;

      static const String PARAM_TYPE;

      static const String PARAM_ANCHORS;

      static const String PARAM_ANNOTATIONS;

- define default values and arguments:

      static const long DEF_INDEX = -1;

      static const float DEF_OFFSET = 0.0;

      static const float DEF_EPSILON = 0.0;

error codes:

- error codes indicating general errors:

protected data:

- declare define the annotation graph id:

      String id_d;

- declare define the annotation graph type:

      String type_d;

- declare define the index structure:

      AnnotationIndex index_d;

- declare define the anchor id issuer:

      Identifier* anchorids_d;

- declare define the annotation id issuer:

      Identifier* annotationids_d;

- declare define the annotation sequence:

      DoubleLinkedList<Annotation> annoseq_d;

- declare the debugging parameters:

      static Integral::DEBUG debug_level_d;

- declare the memory manager:

      static MemoryManager mgr_d;

required public methods:

- static methods:

      static const String& name();

- debug methods:

      boolean debug(const unichar* msg) const;

      static boolean setDebug(Integral::DEBUG arg);

      static boolean diagnose(Integral::DEBUG debug_level);

- destructor/constructor(s):

      ~AnnotationGraph();

      AnnotationGraph();

      AnnotationGraph(const AnnotationGraph& arg);

      AnnotationGraph(String& id, String& type);

- assign methods:

      boolean assign(const AnnotationGraph& arg);

- operator= method:

      AnnotationGraph& operator= (const AnnotationGraph& arg);

- i/o methods:

      long sofSize() const;

      boolean read(Sof& sof, long tag);

      boolean read(Sof& sof, long tag, const String& name);

      boolean write(Sof& sof, long tag) const;

      boolean write(Sof& sof, long tag, const String& name) const;

      boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);

      boolean writeData(Sof& sof, const String& pname =  DEF_PARAM) const;

- equality methods:

      boolean eq(const AnnotationGraph& arg) const;

- memory management methods:

      static void* operator new(size_t arg);

      static void* operator new[](size_t arg);

      static void operator delete(void* arg);

      static void operator delete[](void* arg);

      static boolean setGrowSize(long arg);

      boolean clear(Integral::CMODE cmode = Integral::DEF_CMODE);

class-specific public methods:

- declare annotation graph property methods:

      String getId() const;

      boolean setType(String& type);

      String getType() const;

      boolean get(DoubleLinkedList<Pair<Long, Anchor> >& ancrs, DoubleLinkedList<Triple<Long, Long, Annotation> >& annos);

      boolean set(DoubleLinkedList<Pair<Long, Anchor> >& ancrs, DoubleLinkedList<Triple<Long, Long, Annotation> >& annos);

- declare anchor related methods:

      String createAnchor(String& id, float offset, String& unit);

      boolean addAnchor(Anchor* ancr);

      boolean deleteAnchor(Anchor* ancr);

      Anchor* getAnchorById(const String& id);

      boolean setAnchorOffset(Anchor* ancr, float offset);

      float getAnchorOffset(Anchor* ancr);

      boolean unsetAnchorOffset(Anchor* ancr);

      Anchor* splitAnchor(Anchor* ancr);

      boolean getAnchorSet(DoubleLinkedList<Anchor>& ancrs);

      boolean getAnchorSetByOffset(float offset, DoubleLinkedList<Anchor>& ancrs, double epsilon = DEF_EPSILON);

      boolean getAnchorSetNearestOffset(float offset, DoubleLinkedList<Anchor>& ancrs);

- declare annotation related methods:

      String createAnnotation(String& id, Anchor* ancr, Anchor* ancr, String& type, long channel = Annotation::DEF_CHANNEL_INDEX);

      boolean add(Annotation* anno);

      boolean deleteAnnotation(Annotation* anno);

      Annotation* getById(const String& id);

      boolean getIncomingAnnotationSet(Anchor* ancr, DoubleLinkedList<Annotation>& annos);

      boolean getOutgoingAnnotationSet(Anchor* ancr, DoubleLinkedList<Annotation>& annos);

      Annotation* splitAnnotation(Annotation* anno);

      boolean nSplitAnnotation(Annotation* anno, long num_split, DoubleLinkedList<Annotation>& annos);

      boolean getAnnotationSetByType(const String& type, DoubleLinkedList<Annotation>& annos);

      boolean getAnnotationSetByOffset(float offset, DoubleLinkedList<Annotation>& annos);

      boolean getAnnotationSeqByOffset(DoubleLinkedList<Annotation>& annos, float begin = DEF_OFFSET, float end = DEF_OFFSET);

      Annotation* getAnnotationByOffset(float offset);

      float getNearestOffset(float arg);

- declare feature map related methods:

      boolean setFeature(String& id, String& fname, String& fvalue);

      boolean existsFeature(String& id, String& fmame);

      boolean deleteFeature(String& id, String& fname);

      String getFeature(String& id, String& fname);

      boolean getFeatureNames(String& id, Vector<String>& names);

      boolean unsetFeatures(String& id);

      boolean setFeature(Annotation* anno, String& fname, String& fvalue);

      boolean getAnnotationSetByFeature(const String& feature, const String& value, DoubleLinkedList<Annotation>& annos);

private methods:

- declare private methods:

      Annotation* copyAnnotation(const Annotation* anno);

      boolean setStartAnchor(Annotation* anno, Anchor* ancr);

      boolean setEndAnchor(Annotation* anno, Anchor* ancr);

examples:

- This example shows how to use the AnnotationGraph object.

notes:

- none.