public class Corpus
extends java.lang.Object
History:
Constructor and Description |
---|
Corpus()
Create a corpus java object with default values
|
Corpus(java.lang.String inFile)
Create a corpus java object by loading a list of terms into the corpus
tree from the specified file.
|
Corpus(java.lang.String inFile,
boolean verboseFlag,
int lineNum)
Create a corpus java object by loading a list of terms into the corpus
tree from the specified file.
|
Corpus(java.util.Vector<java.lang.String> terms)
Create a corpus java object by loading a list of terms into the corpus
tree.
|
Corpus(java.util.Vector<java.lang.String> terms,
boolean verboseFlag,
int lineNum)
Create a corpus java object by loading a list of terms into the corpus
tree.
|
Modifier and Type | Method and Description |
---|---|
static int |
GetMaxChildrenNoForLevel(java.util.Collection<TreeNode> nodeList,
int level)
Get the maximum number of children for a specified level and node list
|
static int |
GetMaxLevel(java.util.Collection<TreeNode> nodeList)
Get the maximum level for a specified the node List.
|
static java.util.Collection<TreeNode> |
GetNodeList(Corpus corpus)
Get list of total nodes for the tree.
|
static java.util.Collection<TreeNode> |
GetNodeListForNode(TreeNode inNode,
java.util.Collection<TreeNode> inNodeList)
Get total nodes list of a branch under a given node.
|
static java.util.Collection<java.lang.String> |
GetPathList(Corpus corpus)
Get the total path list in the tree.
|
static java.util.Collection<java.lang.String> |
GetPathListForNode(TreeNode inNode,
java.util.Collection<java.lang.String> inPathList,
java.lang.String inPath)
Get the total path list in the tree for a given node.
|
TreeNode |
GetRoot()
Get the root node of the corpus tree.
|
static int |
GetTotalNodeNo(Corpus corpus)
Get the total number of tree nodes in the corpus tree
|
static int |
GetTotalPathNo(Corpus corpus)
Get the total number of branches (paths) in the corpus tree
|
static int |
GetTotalTermNo(Corpus corpus)
Get the total number of terms in the corpus
|
static java.lang.String |
GetTreeString(Corpus corpus)
Get the entire corpus tree in a string format
|
static java.lang.String |
GetTreeStringForNode(TreeNode node,
java.lang.String inStr)
Get the sub-tree (branch) string for a given node
|
void |
LoadCorpus(java.util.Vector<java.lang.String> terms,
boolean verboseFlag,
int lineNum)
Load the Corpus from a collections of terms.
|
void |
LoadCorpusFromFile(java.lang.String inFile)
Load the corpus tree from a specified corpus file.
|
void |
LoadCorpusFromFile(java.lang.String inFile,
boolean verboseFlag,
int lineNum)
Load the corpus tree from a specified corpus file with verbose option.
|
static void |
main(java.lang.String[] args)
Test driver for this class.
|
public Corpus()
public Corpus(java.lang.String inFile)
inFile
- corpus file including all normalized termspublic Corpus(java.lang.String inFile, boolean verboseFlag, int lineNum)
inFile
- corpus file including all normalized termsverboseFlag
- verbose flag to show loading statuslineNum
- loading status of line number to be displayedpublic Corpus(java.util.Vector<java.lang.String> terms)
terms
- the list of all normalized terms from the corpuspublic Corpus(java.util.Vector<java.lang.String> terms, boolean verboseFlag, int lineNum)
terms
- the list of all normalized terms from the corpusverboseFlag
- verbose flag to show loading statuslineNum
- loading status of line number to be displayedpublic TreeNode GetRoot()
public void LoadCorpusFromFile(java.lang.String inFile)
inFile
- corpus file including all normalized termspublic void LoadCorpusFromFile(java.lang.String inFile, boolean verboseFlag, int lineNum)
inFile
- corpus file including all normalized termsverboseFlag
- verbose flag to show loading statuslineNum
- loading status of line number to be displayedpublic void LoadCorpus(java.util.Vector<java.lang.String> terms, boolean verboseFlag, int lineNum)
terms
- the list of all normalized terms of the corpuspublic static java.lang.String GetTreeString(Corpus corpus)
corpus
- the corpus to be convert to stringpublic static int GetTotalTermNo(Corpus corpus)
corpus
- the corpus to be convert to stringpublic static int GetTotalPathNo(Corpus corpus)
corpus
- the corpus to be convert to stringpublic static int GetTotalNodeNo(Corpus corpus)
corpus
- the corpus to be convert to stringpublic static int GetMaxChildrenNoForLevel(java.util.Collection<TreeNode> nodeList, int level)
nodeList
- a collection of tree nodeslevel
- the level of interestspublic static int GetMaxLevel(java.util.Collection<TreeNode> nodeList)
nodeList
- a collection of tree nodespublic static java.util.Collection<java.lang.String> GetPathList(Corpus corpus)
corpus
- the corpus to be convert to stringpublic static java.util.Collection<java.lang.String> GetPathListForNode(TreeNode inNode, java.util.Collection<java.lang.String> inPathList, java.lang.String inPath)
inNode
- the tree node of interestsinPathList
- the pathlist passing ininPath
- the path passing inpublic static java.util.Collection<TreeNode> GetNodeList(Corpus corpus)
corpus
- the corpus of interestspublic static java.util.Collection<TreeNode> GetNodeListForNode(TreeNode inNode, java.util.Collection<TreeNode> inNodeList)
inNode
- the tree node of interestsinNodeList
- the collection of tree nodes of interestspublic static java.lang.String GetTreeStringForNode(TreeNode node, java.lang.String inStr)
node
- the tree node of interestsinStr
- the parents tree string passing inpublic static void main(java.lang.String[] args)
args
- arguments of the test friver program Submit a bug or feature
Copyright © 2014 National Library of Medicine