edu.stanford.nlp.trees
Class TypedDependencyList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<TypedDependency>
              extended by edu.stanford.nlp.trees.TypedDependencyList
All Implemented Interfaces:
Serializable, Cloneable, Iterable<TypedDependency>, Collection<TypedDependency>, List<TypedDependency>, RandomAccess

public class TypedDependencyList
extends ArrayList<TypedDependency>

A TypedDependencyList represents a complete list of typed dependencies for a GrammaticalStructure, with special methods for printing in different formats.

Author:
Bill MacCartney, Galen Andrew (refactoring English-specific stuff)
See Also:
GrammaticalStructure, GrammaticalRelation, EnglishGrammaticalStructure, Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
TypedDependencyList()
           
TypedDependencyList(GrammaticalStructure gs)
          The constructor builds a list of typed dependencies using information from a GrammaticalStructure.
 
Method Summary
 void print()
          Prints this set of typed dependencies to stdout.
 void print(PrintWriter pw)
          Prints this set of typed dependencies to the specified PrintWriter.
 void print(String format)
          Prints this set of typed dependencies to stdout in the specified format.
 void print(String format, PrintWriter pw)
          Prints this set of typed dependencies to the specified PrintWriter in the specified format.
 void sort()
           
 String toString()
          Returns a String representation of this set of typed dependencies as exemplified by the following:
 String toString(String format)
          Returns a String representation of the result of this set of typed dependencies in a user-specified format.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

TypedDependencyList

public TypedDependencyList()

TypedDependencyList

public TypedDependencyList(GrammaticalStructure gs)
The constructor builds a list of typed dependencies using information from a GrammaticalStructure.

Method Detail

sort

public void sort()

toString

public String toString(String format)
Returns a String representation of the result of this set of typed dependencies in a user-specified format. Currently, three formats are supported:
"plain"
(Default.) Formats the dependencies as logical relations, as exemplified by the following:
  nsubj(died-1, Sam-0)
  tmod(died-1, today-2)
  
"readable"
Formats the dependencies as a table with columns dependent, relation, and governor, as exemplified by the following:
  Sam-0               nsubj               died-1
  today-2             tmod                died-1
  
"xml"
Formats the dependencies as XML, as exemplified by the following:
  <dependencies>
    <dep type="nsubj">
      <governor idx="1">died</governor>
      <dependent idx="0">Sam</dependent>
    </dep>
    <dep type="tmod">
      <governor idx="1">died</governor>
      <dependent idx="2">today</dependent>
    </dep>
  </dependencies>
  

Parameters:
format - a String specifying the desired format
Returns:
a String representation of the typed dependencies in this GrammaticalStructure

toString

public String toString()
Returns a String representation of this set of typed dependencies as exemplified by the following:
  tmod(died-6, today-9)
  nsubj(died-6, Sam-3)
  

Overrides:
toString in class AbstractCollection<TypedDependency>
Returns:
a String representation of this set of typed dependencies

print

public void print()
Prints this set of typed dependencies to stdout.


print

public void print(PrintWriter pw)
Prints this set of typed dependencies to the specified PrintWriter.


print

public void print(String format)
Prints this set of typed dependencies to stdout in the specified format.


print

public void print(String format,
                  PrintWriter pw)
Prints this set of typed dependencies to the specified PrintWriter in the specified format.



Stanford NLP Group