public class AdornedWordsLoader
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,AdornedWordData> |
adornedWordDataMap
Map from word ID to adorned word data.
|
protected org.jdom2.Document |
adornedXMLDocument
Adorned XML file as JDOM document.
|
protected java.util.List<java.lang.String> |
wordIDs
List of word IDs.
|
protected java.util.Set<java.lang.String> |
wordTagsSet
Set of word tags (typically "w" and "pc").
|
Constructor and Description |
---|
AdornedWordsLoader(java.lang.String adornedFileName)
Create adorned words loader.
|
AdornedWordsLoader(java.lang.String adornedFileName,
java.lang.String[] wordTags)
Create adorned words loader.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
findSiblingID(org.jdom2.Element wordElement,
java.lang.String id)
Get sibling ID for a given word ID.
|
AdornedWordData |
getAdornedWordData(java.lang.String id)
Get data for a specified word ID.
|
java.util.List<java.lang.String> |
getAdornedWordIDs()
Return list of words IDs.
|
org.jdom2.Document |
getDocument()
Get adorned XML document.
|
boolean |
ifBlankPrecedes(org.jdom2.Element wordElement)
Determine if blank marker element (
|
void |
releaseDocument()
Release adorned XML document.
|
protected java.util.Map<java.lang.String,AdornedWordData> adornedWordDataMap
protected java.util.List<java.lang.String> wordIDs
protected java.util.Set<java.lang.String> wordTagsSet
protected org.jdom2.Document adornedXMLDocument
public AdornedWordsLoader(java.lang.String adornedFileName, java.lang.String[] wordTags) throws java.lang.Exception
adornedFileName
- The adorned file from which to load
word data.wordTags
- String array of word tag element
names, typically "w" and "pc".java.lang.Exception
- in case of error.public AdornedWordsLoader(java.lang.String adornedFileName) throws java.lang.Exception
adornedFileName
- The adorned file from which to load
word data.java.lang.Exception
- in case of error.
The word elements are assumed to be tagged as
public java.util.List<java.lang.String> getAdornedWordIDs()
public AdornedWordData getAdornedWordData(java.lang.String id)
id
- Word ID.public java.lang.String findSiblingID(org.jdom2.Element wordElement, java.lang.String id)
wordElement
- The word element.id
- The word ID.public boolean ifBlankPrecedes(org.jdom2.Element wordElement)
wordElement
- The word element.public org.jdom2.Document getDocument()
public void releaseDocument()