edu.stanford.nlp.trees.international.pennchinese
Class ChineseGrammaticalStructure
java.lang.Object
edu.stanford.nlp.trees.TreeGraph
edu.stanford.nlp.trees.GrammaticalStructure
edu.stanford.nlp.trees.international.pennchinese.ChineseGrammaticalStructure
- All Implemented Interfaces:
- java.io.Serializable
public class ChineseGrammaticalStructure
- extends GrammaticalStructure
A GrammaticalStructure for Chinese.
- Author:
- Galen Andrew, Pi-Chuan Chang, Daniel Cer - support for printing CoNLL-X format, encoding update,
and preliminary changes to make
ChineseGrammaticalStructure behave more like
EnglishGrammaticalStructure on the command line
(ultimately, both classes should probably use the same
abstract main method).
- See Also:
- Serialized Form
Fields inherited from class edu.stanford.nlp.trees.TreeGraph |
root |
Methods inherited from class edu.stanford.nlp.trees.GrammaticalStructure |
allTypedDependencies, buildCoNLLXGrammaticalStructure, collapseDependenciesTree, correctDependencies, dependencies, dependenciesToString, extraTreeDepFilter, fromStringReps, getDependencyPath, getDependents, getExtras, getGovernor, getGrammaticalRelation, getGrammaticalRelation, getListGrammaticalRelation, getNodeInRelation, getRoots, isConnected, postProcessDependencies, printDependencies, readCoNLLXGrammaticalStructureCollection, typedDependencies, typedDependencies, typedDependenciesCCprocessed, typedDependenciesCCprocessed, typedDependenciesCollapsed, typedDependenciesCollapsed, typedDependenciesCollapsedTree |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ChineseGrammaticalStructure
public ChineseGrammaticalStructure(Tree t)
- Construct a new
GrammaticalStructure
from an
existing parse tree. The new GrammaticalStructure
has the same tree structure and label values as the given tree
(but no shared storage). As part of construction, the parse tree
is analyzed using definitions from GrammaticalRelation
to populate the new
GrammaticalStructure
with as many labeled
grammatical relations as it can.
- Parameters:
t
- Tree to process
ChineseGrammaticalStructure
public ChineseGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter)
ChineseGrammaticalStructure
public ChineseGrammaticalStructure(Tree t,
HeadFinder hf)
ChineseGrammaticalStructure
public ChineseGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter,
HeadFinder hf)
ChineseGrammaticalStructure
public ChineseGrammaticalStructure(java.util.List<TypedDependency> projectiveDependencies,
TreeGraphNode root)
- Used for postprocessing CoNLL X dependencies
collapseDependencies
protected void collapseDependencies(java.util.List<TypedDependency> list,
boolean CCprocess,
boolean includeExtras)
- Description copied from class:
GrammaticalStructure
- Destructively modify the
Collection<TypedDependency>
to collapse
language-dependent transitive dependencies.
Default is no-op; to be over-ridden in subclasses.
- Overrides:
collapseDependencies
in class GrammaticalStructure
- Parameters:
list
- A list of dependencies to process for possible collapsingCCprocess
- apply CC process?
main
public static void main(java.lang.String[] args)
- Tests generation of Chinese grammatical relations from a file.
Default encoding is utf-8.
TODO: remove this main method and use the one in the abstract class GrammaticalStructure. Making this
change is non-trivial due to some of the English specific assumptions in the code currently invoked by
GrammaticalStructure#main.
Usage:
java edu.stanford.nlp.trees.international.pennchinese.ChineseGrammaticalStructure -treeFile [treeFile]
java edu.stanford.nlp.trees.international.pennchinese.ChineseGrammaticalStructure -sentFile [sentenceFile]
- Parameters:
args
- Command line args as above
readCoNLLXGrammaticalStructureCollection
public static java.util.List<GrammaticalStructure> readCoNLLXGrammaticalStructureCollection(java.lang.String fileName)
throws java.io.IOException
- Throws:
java.io.IOException
buildCoNLLXGrammaticalStructure
public static ChineseGrammaticalStructure buildCoNLLXGrammaticalStructure(java.util.List<java.util.List<java.lang.String>> tokenFields)
Stanford NLP Group