Class ADSentenceStream.SentenceParser
java.lang.Object
opennlp.tools.formats.ad.ADSentenceStream.SentenceParser
- Enclosing class:
ADSentenceStream
Parses a sample of AD corpus. A sentence in AD corpus is represented by a
Tree. In this class we declare some types to represent that tree. Today we get only
the first alternative (A1).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the AD leafstatic classRepresents the AD nodestatic classRepresents a tree element, Node or Leaf -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringfixPunctuation(String text) getElement(String line) Parse a tree element from a AD lineParses a sentence string into aADSentenceStream.Sentence.
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
NODE_PATTERN
-
LEAF_PATTERN
-
BIZARRE_LEAF_PATTERN
-
PUNCTUATION_PATTERN
-
PUNCTUATION_DOT_PATTERN
-
PUNCTUATION_COMMA_PATTERN
-
text
-
meta
-
-
Constructor Details
-
SentenceParser
public SentenceParser()
-
-
Method Details
-
parse
public ADSentenceStream.Sentence parse(String sentenceString, int para, boolean isTitle, boolean isBox) Parses a sentence string into aADSentenceStream.Sentence.- Parameters:
sentenceString- The input string to parse.para- The parameter number.isTitle-trueif it represents a title element,falseotherwise.isBox-trueif it represents a box element,falseotherwise.- Returns:
- A
ADSentenceStream.Sentenceinstance parsed fromsentenceString.
-
fixPunctuation
-
getElement
Parse a tree element from a AD line- Parameters:
line- the AD line- Returns:
- the tree element
-