|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.columbia.cs.ref.model.Document
public class Document
Representation of a Document.
A Document is defined by its path, the name of the file and a list of Segments that represent
the content of the document. Additionally, a document may be annotated with information
like entities and relationships.
Constructor Summary | |
---|---|
Document(java.util.List<Segment> text)
From text constructor for documents that are not stored in disk |
|
Document(java.lang.String path,
java.lang.String fileName,
java.util.List<Segment> text)
Constructor of the Document |
Method Summary | |
---|---|
void |
addEntity(Entity entity)
Adds a new annotation of an entity present in the document |
void |
addRelationship(Relationship relationship)
Adds a new annotation of a relationship present in the document |
boolean |
equals(java.lang.Object obj)
|
java.util.Collection<Entity> |
getEntities()
Obtains the annotations of entities present in the document |
Entity |
getEntity(java.lang.String id)
Obtains the entity annotation with a given id |
java.lang.String |
getFilename()
Obtains the name of the file containing the document |
java.lang.String |
getPath()
Obtains the path to the file containing the document |
java.util.List<Segment> |
getPlainText()
Obtains the segments that represent the content of the document |
Relationship |
getRelationship(java.lang.String id)
Obtains the relationship annotation with a given id |
java.util.Collection<Relationship> |
getRelationships()
Obtains the annotations of relationships present in the document |
java.lang.String |
getSubstring(int offset,
int length)
Obtains the substring of the document starting at a given offset and with a given length |
java.lang.String |
getWritableValue()
Obtains the name to be used when writing the file |
void |
setFilename(java.lang.String f)
Sets the name of the file containing the document |
void |
setPath(java.lang.String path)
Sets the path to the file containing the document |
void |
setPlainText(java.util.List<Segment> text)
Sets the segments that represent the content of the document |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Document(java.util.List<Segment> text)
text
- list of segments in the documentpublic Document(java.lang.String path, java.lang.String fileName, java.util.List<Segment> text)
path
- Path to the file containing the documentfileName
- Name of the file containing the documenttext
- Segments that represent the content of the documentMethod Detail |
---|
public java.util.List<Segment> getPlainText()
public void setPlainText(java.util.List<Segment> text)
text
- the segments to setpublic java.util.Collection<Entity> getEntities()
public void addEntity(Entity entity)
new
- annotation of an entitypublic Entity getEntity(java.lang.String id)
id
- id of the annotation to be retrieved
public java.util.Collection<Relationship> getRelationships()
public void addRelationship(Relationship relationship)
new
- annotation of a relationshippublic Relationship getRelationship(java.lang.String id)
id
- id of the annotation to be retrieved
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getSubstring(int offset, int length)
offset
- start of the substring to be retrievedlength
- size of the substring to be retrieved
public void setPath(java.lang.String path)
path
- the path to setpublic void setFilename(java.lang.String f)
f
- the filename to setpublic java.lang.String getFilename()
public java.lang.String getPath()
public java.lang.String getWritableValue()
getWritableValue
in interface Writable
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |