Package opennlp.tools.formats.ad
Class ADMetadata
java.lang.Object
opennlp.tools.formats.ad.ADMetadata
Reads the ids from the metadata of an Arvores Deitadas sentence, which differs between
corpora.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordWhere the digit runs of the two ids lie in the metadata, each as an inclusive start and an exclusive end.(package private) static final recordThe ids of a sentence. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intparseDigits(String meta, int start, int end) Reads a run of ASCII digits as a number.(package private) static ADMetadata.TextAndParagraphparseTextAndParagraph(String meta) Parses the text id and the paragraph id: the text id is the ASCII digit run that directly follows the leading ASCII letters and hyphens, the paragraph id the digit run after the firstp=that at least one digit follows.(package private) static ADMetadata.TextAndParagraphParses the text id and the paragraph id asparseTextAndParagraph(String)does.private static ADMetadata.IdSpansscanTextAndParagraph(String meta) Scans the text id and the paragraph id, seeparseTextAndParagraph(String).(package private) static StringReads the source: the text between the firstsource="and the next double quote.(package private) static StringtextPrefix(String meta) Reads the ASCII letters and hyphens before the text id, which name the text in literary corpora.
-
Field Details
-
PARAGRAPH_PREFIX
- See Also:
-
SOURCE_PREFIX
- See Also:
-
HYPHEN
private static final char HYPHEN- See Also:
-
QUOTE
private static final char QUOTE- See Also:
-
-
Constructor Details
-
ADMetadata
private ADMetadata()
-
-
Method Details
-
parseTextAndParagraph
Parses the text id and the paragraph id: the text id is the ASCII digit run that directly follows the leading ASCII letters and hyphens, the paragraph id the digit run after the firstp=that at least one digit follows.- Parameters:
meta- The metadata.- Returns:
- The two ids, or
nullif either is missing or does not fit into anint.
-
requireTextAndParagraph
static ADMetadata.TextAndParagraph requireTextAndParagraph(String meta) throws InvalidFormatException Parses the text id and the paragraph id asparseTextAndParagraph(String)does.- Parameters:
meta- The metadata.- Returns:
- The two ids.
- Throws:
InvalidFormatException- Thrown if either id is missing or does not fit into anint.
-
textPrefix
Reads the ASCII letters and hyphens before the text id, which name the text in literary corpora.- Parameters:
meta- The metadata.- Returns:
- The prefix, or
nullif it is empty or the text id or the paragraph id is missing.
-
source
Reads the source: the text between the firstsource="and the next double quote.- Parameters:
meta- The metadata.- Returns:
- The source, or
nullif the metadata has none.
-
scanTextAndParagraph
Scans the text id and the paragraph id, seeparseTextAndParagraph(String).- Parameters:
meta- The metadata.- Returns:
- The spans of the two ids, or
nullif either is missing.
-
parseDigits
Reads a run of ASCII digits as a number.- Parameters:
meta- The metadata.start- The inclusive start of the run.end- The exclusive end of the run.- Returns:
- The number, or -1 if it does not fit into an
int.
-