public final class Sentence extends Object implements Serializable
Constructor and Description |
---|
Sentence(String sentenceContent,
int lineNum)
Constructor.
|
Sentence(String sentenceContent,
int sentencePosition,
int startOffset)
Constructor.
|
Sentence(String content,
List<LineOffset> offsetMap,
List<String> links) |
Modifier and Type | Method and Description |
---|---|
void |
addLink(String link)
Add a link to Sentence
|
boolean |
equals(Object o) |
String |
getContent()
Get content of sentence.
|
int |
getLineNumber()
Get line number where the sentence starts.
|
List<String> |
getLinks()
Return links the sentence contains.
|
Optional<LineOffset> |
getOffset(int position)
Get offset position for specified character position.
|
int |
getOffsetMapSize()
Get size of offset mapping table (the size should be same as the content length).
|
int |
getOffsetPosition(LineOffset offset)
Get the position of the supplied offset (ie: the position in the source text) in this sentence's normalized content
|
int |
getStartPositionOffset()
Get start column offset where the sentence starts.
|
List<TokenElement> |
getTokens()
Get a set of tokenized words in the sentence.
|
int |
hashCode() |
boolean |
isFirstSentence()
Detect the sentence is the first sentence of a paragraph.
|
void |
setContent(String content)
Set content of sentence.
|
void |
setIsFirstSentence(boolean isFirstSentence)
Set a flag to detect if the sentence is a first sentence of a paragraph.
|
void |
setLineNumber(int lineNumber)
Set line number where the sentence starts.
|
void |
setOffsetMap(List<LineOffset> offsetMap)
Set the offset mapping table which contains character position to column offset in line.
|
void |
setTokens(List<TokenElement> tokens)
Set a set of tokenized words.
|
String |
toString() |
public Sentence(String sentenceContent, int lineNum)
sentenceContent
- content of sentencelineNum
- line number of sentencepublic Sentence(String sentenceContent, int sentencePosition, int startOffset)
sentenceContent
- content of sentencesentencePosition
- sentence positionstartOffset
- offset of the start position in the linepublic Sentence(String content, List<LineOffset> offsetMap, List<String> links)
public int getLineNumber()
public void setLineNumber(int lineNumber)
lineNumber
- line numberpublic void addLink(String link)
link
- link urlpublic String getContent()
public void setContent(String content)
content
- sentencepublic int getStartPositionOffset()
public boolean isFirstSentence()
public void setIsFirstSentence(boolean isFirstSentence)
isFirstSentence
- a flag to detect if the sentence exists in the begging of a paragraphpublic List<TokenElement> getTokens()
public void setTokens(List<TokenElement> tokens)
tokens
- tokenized wordspublic void setOffsetMap(List<LineOffset> offsetMap)
offsetMap
- position mapping tablepublic Optional<LineOffset> getOffset(int position)
position
- character position in a sentencepublic int getOffsetPosition(LineOffset offset)
offset
- the position in the source textpublic int getOffsetMapSize()
Copyright © 2015. All rights reserved.