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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetElement(String line) Reads one tree line into aADSentenceStream.SentenceParser.Nodeor aADSentenceStream.SentenceParser.Leaf.Parses a sentence string into aADSentenceStream.Sentence.
-
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.
-
getElement
Reads one tree line into aADSentenceStream.SentenceParser.Nodeor aADSentenceStream.SentenceParser.Leaf. A leaf line with an equals sign in its tag part, as in=H==CJT:num("818-5817" ...), takes the functional tag after the last colon and the syntactic tag before it; without a colon it has no functional tag.- Parameters:
line- The tree line.- Returns:
- The element, or
nullfor a line that is no element.
-