public final class WordHandler
extends java.lang.Object
Constructor and Description |
---|
WordHandler()
Create a new instance of WordHandler
|
Modifier and Type | Method and Description |
---|---|
static java.util.ArrayList<java.lang.String> |
asLines(java.lang.String theText)
Parse the text from a single line into list of new lines.
|
static java.lang.String |
asString(java.util.ArrayList<java.lang.String> theText)
Convert the text back to a single string but keep any newlines.
|
static int |
getLineWordNumber(java.lang.String theTextLine)
Get the number of words in a single line of text.
|
static java.util.ArrayList<java.lang.String> |
loadWordFile(java.io.File wordFile)
Load the specified word file and parse into a list.
|
static int |
removeLineWhitespaceCount(java.lang.String theText)
Remove the whitespace from the existing line of text and return
the number of characters.
|
static java.util.ArrayList<java.lang.String> |
tagsToWords(java.util.ArrayList<java.lang.String> theText)
Convert a text document containing XML tags into one where each tag
is a separate word that can be read in isolation.
|
static java.util.ArrayList<java.lang.String> |
wordsToTags(java.util.ArrayList<java.lang.String> theText)
Convert a text document containing tags that have been separated into
isolated words back into XML tags again.
|
public static java.util.ArrayList<java.lang.String> tagsToWords(java.util.ArrayList<java.lang.String> theText)
theText
- the original XML document as a list of lines.public static java.util.ArrayList<java.lang.String> wordsToTags(java.util.ArrayList<java.lang.String> theText)
theText
- the text with the separated XML tags.public static int removeLineWhitespaceCount(java.lang.String theText)
theText
- the original line of text.public static int getLineWordNumber(java.lang.String theTextLine)
theTextLine
- the line of text.public static java.util.ArrayList<java.lang.String> loadWordFile(java.io.File wordFile) throws java.lang.Exception
wordFile
- the path to the file to load. Each line represents a new word.java.lang.Exception
- any error.public static java.lang.String asString(java.util.ArrayList<java.lang.String> theText)
theText
- the input text.public static java.util.ArrayList<java.lang.String> asLines(java.lang.String theText)
theText
- the input text.