#include <OCDM.h>
Public Member Functions | |
OCDM_Document () | |
This is a null constructor of an OCDM_Document Object. The purpose of this function is to create a null document, just to be used for programming reasons. | |
OCDM_Document (const char *TclCmdName) | |
This function servers as the main constructor of an OCDM_Document object. | |
OCDM_Document (const class OCDM_Document &obj) | |
This is the default copy constructor. | |
OCDM_Document (const Tcl_Obj *TclCmdName) | |
This function servers as the main constructor of an OCDM_Document object. | |
OCDM_Document (const CDM_Document) | |
A constructor that maps a CDM_Document to an OCDM_Document object. | |
~OCDM_Document () | |
This is the destructor of an OCDM_document object. | |
void | Close (void) |
This method will remove a Document from memory.. | |
OCDM_Document & | operator= (const class OCDM_Document &obj) |
This is the default Assignment operator. | |
void | storeObject (const class OCDM_Object *objPtr) const |
void | storeObject (const class OCDM_Collection *objPtr) const |
OCDM_Object * | getStoredObject (void) const |
void | releaseStoredObject (void) const |
long | AddAnnotation (const OCDM_Annotation &Ann) |
OCDM_REF (OCDM_AnnotationSet) AnnotationsAt(const long position) const | |
OCDM_REF (OCDM_AnnotationSet) AnnotationsContaining(const long position) const | |
OCDM_REF (OCDM_AnnotationSet) AnnotationsContaining(const long position1 | |
OCDM_REF (OCDM_AnnotationSet) AnnotationsInRange(const long Start | |
OCDM_REF (OCDM_AnnotationSet) AnnotationsInRange(const OCDM_Annotation &Ann) const | |
OCDM_REF (OCDM_AnnotationSet) AnnotationsMatchingRange(const long Start | |
OCDM_REF (OCDM_AnnotationSet) AnnotationsMatchingRange(const OCDM_Annotation &Ann) const | |
OCDM_BOOL | AttributeExists (const char *name) const |
This function will return true if an Attribute with the specified name exists in the Document object. | |
int | DisplaceAnnotations (long offset, long displacement) |
OCDM_REF (OCDM_Annotation) FirstAnnotationContaining(const long Position) const | |
OCDM_REF (OCDM_Annotation) FirstAnnotationContaining(const long Position1 | |
OCDM_REF (OCDM_RawDataSet) GetAnnotatedTextRanges(const OCDM_Annotation &Ann) const | |
OCDM_REF (OCDM_Annotation) GetAnnotation(const long Id) const | |
OCDM_REF (OCDM_Attribute) GetAttribute(const char *name) const | |
OCDM_REF (OCDM_AttributeSet) GetAttributes(void) const | |
OCDM_REF (OCDM_ByteSequence) GetFirstAnnotatedTextRange(const OCDM_Annotation &Ann) const | |
OCDM_REF (OCDM_AnnotationSet) NextAnnotations(const long Position) const | |
int | PutAttribute (const OCDM_Attribute &Attr) |
This function will add a given Attribute to the specified Document object. | |
int | RemoveAnnotation (const long Id) |
As the name implies this function will remove the Annotation object that has as Id the value specified by the "Id" parameter. | |
const char * | GetId (void) const |
This function will return the Id of the Document object in use. | |
int | RemoveAttribute (const char *name) |
This function will remove the Attribute named exactly as the "Name" parameter. | |
OCDM_REF (OCDM_AnnotationSet) SelectAnnotations(const char *Type) const | |
OCDM_REF (OCDM_AnnotationSet) SelectAnnotations(const char *Type | |
OCDM_REF (OCDM_AnnotationSet) SelectAnnotationsSorted(const char *Type) const | |
OCDM_REF (OCDM_AnnotationSet) SelectAnnotationsSorted(const char *Type | |
OCDM_REF (OCDM_ByteSequence) ByteSequenceInsertString(const long pos | |
OCDM_REF (OCDM_ByteSequence) ByteSequenceReplace(const long first | |
OCDM_REF (OCDM_ByteSequence) ByteSequenceReplaceCharacters(const long first | |
int | DeleteAnnotations (const char *Type) |
int | DeleteAnnotations (const char *Type, const char *Constraints) |
long | FindMaxUsedAnnotationId (void) const |
OCDM_REF (OCDM_AnnotationSet) GetAnnotations(void) const | |
OCDM_REF (OCDM_ByteSequence) GetByteSequence(void) const | |
const char * | GetByteSequence (const char *encoding) const |
const char * | GetEncoding (void) const |
const char * | GetExternalId (void) const |
OCDM_REF (OCDM_Annotation) GetFirstAnnotation(const char *Type) const | |
OCDM_REF (OCDM_Annotation) GetNextAnnotation(void) const | |
OCDM_REF (OCDM_Collection) GetParent(void) const | |
OCDM_REF (OCDM_RawData) GetRawData(void) const | |
const char * | GetRawData (const char *encoding) const |
int | SetByteSequence (const OCDM_ByteSequence &Text) |
This function will change the text of a Document object to the text specified by the "Text" parameter. | |
void | SetProcessStatus (const int value) const |
Updates the Percent Bar displayed when an Annotator runs... | |
const char * | SetEncoding (const char *encoding) |
const char * | SetExternalId (const char *ExternalId) |
This function will modify the external Id (XID) of the Document object in use. | |
OCDM_REF (OCDM_ByteSequence) Status(void) const | |
int | Sync (void) const |
This function will save the Document object in disk. | |
OCDM_REF (OCDM_RawData) RawDataReplace(const long first | |
OCDM_REF (OCDM_RawData) RawDataInsertString(const long pos | |
OCDM_REF (OCDM_RawData) RawDataReplaceCharacters(const long first | |
void | Log (const char *str,...) const |
This method logs information. It is equivalent to OCDM_Utilities.Log(). | |
OCDM_BOOL | Valid (void) const |
As the name implies this function checks for a valid Document. | |
const char * | toString (void) const |
Return object as a formatted string. | |
const char * | objectType (void) const |
Public Attributes | |
const long position2 | const |
const long End | const |
const long Position2 | const |
const char *Constraints | const |
const char *Constraints | const |
const char * | string |
const long | last |
const long const char * | newstring |
const long const char * | string |
const long const char * | newstring |
const char * | string |
const int | characters |
const int const char * | string |
OCDM_Document | ( | ) |
OCDM_Document | ( | const char * | TclCmdName | ) |
TclCmdName:
The parameter TclCmdName represents the name of the document to be created. OCDM_Document | ( | const class OCDM_Document & | obj | ) |
OCDM_Document | ( | const Tcl_Obj * | TclCmdName | ) |
TclCmdName:
The parameter TclCmdName represents the name of the document to be created OCDM_Document | ( | const | CDM_Document | ) |
~OCDM_Document | ( | ) |
void Close | ( | void | ) |
class OCDM_Document & operator= | ( | const class OCDM_Document & | obj | ) |
void storeObject | ( | const class OCDM_Object * | objPtr | ) | const |
void storeObject | ( | const class OCDM_Collection * | objPtr | ) | const |
class OCDM_Object * getStoredObject | ( | void | ) | const |
void releaseStoredObject | ( | void | ) | const |
long AddAnnotation | ( | const OCDM_Annotation & | Ann | ) |
This
function will add the given Annotation (specified by the "Ann" parameter) into the Document object that we are currently use. If the Annotation does not already have an Id, a new unique Id will be assigned to that Annotation and the Annotation will be added to the current Annotation set of the Document. If the Annotation already has an Id, then this Id will left intact. If an Annotation with the same Id already exists in the current Annotation set, then the new Annotation will replace the old one. If an Annotation with the same Id does not exist, the given Annotation will be appended to the existing Annotation set.Ann:
The Annotation object to be added. OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_BOOL AttributeExists | ( | const char * | name | ) | const |
name:
The Attribute name to be found.int DisplaceAnnotations | ( | long | offset, | |
long | displacement | |||
) |
OCDM_REF | ( | OCDM_Annotation | ) | const |
OCDM_REF | ( | OCDM_Annotation | ) | const |
OCDM_REF | ( | OCDM_RawDataSet | ) | const |
OCDM_REF | ( | OCDM_Annotation | ) | const |
OCDM_REF | ( | OCDM_Attribute | ) | const |
OCDM_REF | ( | OCDM_AttributeSet | ) | const |
OCDM_REF | ( | OCDM_ByteSequence | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
int PutAttribute | ( | const OCDM_Attribute & | Attr | ) |
Attr:
The attribute to be added to the Document in use.int RemoveAnnotation | ( | const long | Id | ) |
Id:
The Id value of the parameter to be removed const char * GetId | ( | void | ) | const |
int RemoveAttribute | ( | const char * | name | ) |
name:
The name of the attribute to be removed from the document.OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_ByteSequence | ) | const |
OCDM_REF | ( | OCDM_ByteSequence | ) | const |
OCDM_REF | ( | OCDM_ByteSequence | ) | const |
int DeleteAnnotations | ( | const char * | Type | ) |
If Annotations having as type the value of the "Type" parameter exist, then all these Annotations will be deleted from the Document. If the deletion is done successfully, the total number of the deleted Annotations will be returned.
If all Annotations have been searched and no Annotation having as type the value of the "Type" parameter was found, the value of the "Type" parameter is examined whether it can be splitted in two words. If this is the case (the value of the "Type" parameter contains at least one space character), then the value is splitted in two parts on the first space character that is found. The first word will be used as an Annotation type and the rest of the value (second word) will be used as an Attribute name. All Annotations will be seached. If Annotations having as type the first word are found, they are examined whether they contain an Attribute named as the second word. If such an Attribute is found in an Annotation, it will be deleted from the Annotation. The total number of deleted Attributes will be returned as the return value of this function.
All Annotations will be seached. If Annotations having as type the first word are found, they are examined whether they contain an Attribute named as the second word. If such an Attribute is found in an Annotation and the OCDM_BOOLean expression is true for this Annotation, it will be deleted from the Annotation. The total number of deleted Attributes will be returned as the return value of this function.
The OCDM_BOOLean expression that can be specified through the "Constraints" parameter will be evaluated before an Annotation or an Annotation Attribute is deleted. If the expression is true, then the deletion will be done. Else, this Annotation or Annotation Attribute will not be deleted. This expression can be any valid Tcl OCDM_BOOLean expression (i.e. a OCDM_BOOLean expression that will be accepted by the "expr" Tcl command), with the following excepion: The OCDM_BOOLean expression can contain references to the values of Atttributes of the Annotation, by utilising the notation "ann::<Attribute Name>". The only limitation is that "<Attribute Name>" cannot exceed 120 characters. For example, the following code will delete all Annotations from the specified Document that their type is token, they have a "type" Attribute which has as value "EFW" and also have a "pos" Attribute that has a value other than "NN":
DeleteAnnotations("token", "ann::type == \"EFW\" && ann::pos != \"NN\"");
If the value of the "Type" parameter is an empty string or NULL, then all Annotations will be searched for deletion, regardless their type. If the value of the "Constraints" parameter is an empty string or NULL, then the expression is ignored and the deletions will be based only on the value of the "Type" parameter. Note that if all Annotations are deleted from the Document object in use then the set of utilised Ids will also be reseted. As a result, the first Annotation that will be added to this Document after the deletion will take the value "0" as Annotation Id, if it does not already have an Id. If any deletion are done successfully, the total number of the deleted (or modified) Annotations will be returned. If this function fails to delete any Annotation or any Annotation Attribute, then the value "0" will be deleted. In case of an error, an exception of type OCDM_Exception will be thrown.
long FindMaxUsedAnnotationId | ( | void | ) | const |
OCDM_REF | ( | OCDM_AnnotationSet | ) | const |
OCDM_REF | ( | OCDM_ByteSequence | ) | const |
encoding:
The text will be stored in a newly allocated memory space, using the requested by the value of the "Encoding" parameter encoding. The pointer to that new memory segment will be returned to the caller. const char * GetEncoding | ( | void | ) | const |
const char * GetExternalId | ( | void | ) | const |
OCDM_REF | ( | OCDM_Annotation | ) | const |
OCDM_REF | ( | OCDM_Annotation | ) | const |
OCDM_REF | ( | OCDM_Collection | ) | const |
OCDM_REF | ( | OCDM_RawData | ) | const |
int SetByteSequence | ( | const OCDM_ByteSequence & | Text | ) |
void SetProcessStatus | ( | const int | value | ) | const |
OCDM_REF | ( | OCDM_ByteSequence | ) | const |
int Sync | ( | void | ) | const |
OCDM_REF | ( | OCDM_RawData | ) | const |
OCDM_REF | ( | OCDM_RawData | ) | const |
OCDM_REF | ( | OCDM_RawData | ) | const |
void Log | ( | const char * | str, | |
... | ||||
) | const |
OCDM_BOOL Valid | ( | void | ) | const |
const char * toString | ( | void | ) | const |
const char* objectType | ( | void | ) | const |
const int characters |