Class BratDocument

Namespace
NOpenNLP.Tools.Formats.Brat
Assembly
NOpenNLP.Tools.dll
public class BratDocument
Inheritance
BratDocument
Inherited Members

Constructors

BratDocument(AnnotationConfiguration, string, string, ICollection<BratAnnotation>)

public BratDocument(AnnotationConfiguration config, string id, string text, ICollection<BratAnnotation> annotations)

Parameters

config AnnotationConfiguration
id string
text string
annotations ICollection<BratAnnotation>

Properties

Annotations

public ICollection<BratAnnotation> Annotations { get; }

Property Value

ICollection<BratAnnotation>

Config

public AnnotationConfiguration Config { get; }

Property Value

AnnotationConfiguration

Id

public string Id { get; }

Property Value

string

Text

public string Text { get; }

Property Value

string

Methods

GetAnnotation(string)

Gets the annotation registered under id.

public BratAnnotation? GetAnnotation(string id)

Parameters

id string

the annotation id to look up

Returns

BratAnnotation

the annotation, or null if no annotation has that id

ParseDocument(AnnotationConfiguration, string, Stream, Stream)

Parses a brat document from its text and annotation streams.

public static BratDocument ParseDocument(AnnotationConfiguration config, string id, Stream txtIn, Stream annIn)

Parameters

config AnnotationConfiguration

the annotation configuration to parse against

id string

the document id

txtIn Stream

the stream to read the document text from

annIn Stream

the stream to read the .ann annotations from

Returns

BratDocument

the parsed BratDocument

Exceptions

IOException

if there is an error during reading