Package com.basistech.rosette.dm
Class Sentence.Builder
java.lang.Object
com.basistech.rosette.dm.BaseAttribute.Builder<Attribute,Attribute.Builder<T,B>>
com.basistech.rosette.dm.Attribute.Builder<Sentence,Sentence.Builder>
com.basistech.rosette.dm.Sentence.Builder
- Enclosing class:
- Sentence
Builder for Sentence attributes.
-
Field Summary
Fields inherited from class com.basistech.rosette.dm.Attribute.Builder
endOffset, startOffset
-
Constructor Summary
ConstructorDescriptionBuilder
(int[] tokenOffsets, int tokenStartIndex, int tokenEndIndex) Constructs a builder from the 'traditional Rosette' data structure.Builder
(int startOffset, int endOffset) Constructs a builder from the required properties.Constructs a builder from the contents of an existing sentence. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates an immutable sentence from the current state of the builder.protected Sentence.Builder
getThis()
Methods inherited from class com.basistech.rosette.dm.Attribute.Builder
endOffset, setEndOffset, startOffset
Methods inherited from class com.basistech.rosette.dm.BaseAttribute.Builder
addAllToList, addAllToSet, buildExtendedProperties, extendedProperties, extendedProperty, nullOrList
-
Constructor Details
-
Builder
public Builder(int startOffset, int endOffset) Constructs a builder from the required properties.- Parameters:
startOffset
- start character offsetendOffset
- end character offset
-
Builder
public Builder(int[] tokenOffsets, int tokenStartIndex, int tokenEndIndex) Constructs a builder from the 'traditional Rosette' data structure. That data structure is an int[] in which the even-numbered items are token start offsets, and the odd-numbered items are token end offsets.- Parameters:
tokenOffsets
- array of token start/end offsetstokenStartIndex
- index in tokenOffsets for the start of the phrasetokenEndIndex
- index in tokenOffsets for the end of the phrase
-
Builder
Constructs a builder from the contents of an existing sentence.- Parameters:
toCopy
- the object to copy
-
-
Method Details
-
build
Creates an immutable sentence from the current state of the builder.- Returns:
- the new sentence
-
getThis
- Specified by:
getThis
in classAttribute.Builder<Sentence,
Sentence.Builder>
-