Package opennlp.tools.formats.ad
Class ADSentenceStream
java.lang.Object
opennlp.tools.util.FilterObjectStream<String,ADSentenceStream.Sentence>
opennlp.tools.formats.ad.ADSentenceStream
- All Implemented Interfaces:
AutoCloseable,ObjectStream<ADSentenceStream.Sentence>
@Internal
public class ADSentenceStream
extends FilterObjectStream<String,ADSentenceStream.Sentence>
Stream filter which merges text lines into sentences, following the Arvores
Deitadas syntax.
Information about the format:
Susana Afonso.
"Árvores deitadas: Descrição do formato e das opções de análise na Floresta Sintáctica".
12 de Fevereiro de 2006.
Whitespace in the markup and the tree lines is the Unicode White_Space property, see
StringUtil.isUnicodeWhitespace(char), independent of the whitespace mode.
Note: Do not use this class, internal use only!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic classParses a sample of AD corpus. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Stringprivate booleanprivate booleanprivate static final Stringprivate intprivate final ADSentenceStream.SentenceParserprivate static final Stringprivate static final charprivate static final charprivate static final charprivate static final Stringprivate static final StringFields inherited from class opennlp.tools.util.FilterObjectStream
samples -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) booleanisClosingTag(String line, String name) Tests whether a line is exactly the closing markup tag with the given name.(package private) booleanisOpeningTag(String line, String name) Checks whether a line is an opening markup tag with the given name: the name right after the opening angle bracket, then either the closing angle bracket or whitespace and attributes, which contain no closing angle bracket, then the closing angle bracket as the last character.read()Reads the next sentence.Methods inherited from class opennlp.tools.util.FilterObjectStream
close, reset
-
Field Details
-
SENTENCE_TAG
- See Also:
-
TEXT_TAG
- See Also:
-
TITLE_TAG
- See Also:
-
BOX_TAG
- See Also:
-
PARAGRAPH_TAG
- See Also:
-
TAG_OPEN
private static final char TAG_OPEN- See Also:
-
TAG_CLOSE
private static final char TAG_CLOSE- See Also:
-
SLASH
private static final char SLASH- See Also:
-
CLOSING_TAG_OPEN
- See Also:
-
parser
-
paraID
private int paraID -
isTitle
private boolean isTitle -
isBox
private boolean isBox
-
-
Constructor Details
-
ADSentenceStream
-
-
Method Details
-
read
Reads the next sentence.- Returns:
- The next
ADSentenceStream.Sentence, ornullat the end of the input. A sentence cut off before the closing tag is returned with the lines read so far; an opening tag with no lines after it at the end of the input yields no sentence. - Throws:
IOException- Thrown if the line stream cannot be read.
-
isOpeningTag
Checks whether a line is an opening markup tag with the given name: the name right after the opening angle bracket, then either the closing angle bracket or whitespace and attributes, which contain no closing angle bracket, then the closing angle bracket as the last character. A self-closing tag, with a slash right before the closing angle bracket as in<s/>,<s />or<s id="1"/>, is not an opening tag.- Parameters:
line- The line.name- The tag name.- Returns:
trueif the whole line is such a tag.
-
isClosingTag
Tests whether a line is exactly the closing markup tag with the given name.- Parameters:
line- The line.name- The tag name.- Returns:
trueif the whole line is that closing tag.
-