org.allenai.nlpstack.parse.poly.polyparser

PolytreeParse

Related Docs: object PolytreeParse | package polyparser

case class PolytreeParse(sentence: Sentence, breadcrumb: Vector[Int], children: Vector[Set[Int]], arclabels: Vector[Set[(Int, Symbol)]]) extends MarbleBlock with Sculpture with Product with Serializable

A PolytreeParse is a polytree-structured dependency parse. A polytree is a directed graph whose undirected structure is a tree. The nodes of this graph will correspond to an indexed sequence of tokens (think the words from a sentence), whose zeroth element is a reserved 'nexus' token which does not correspond to a word in the original sentence. The nexus must be one of the roots of the directed graph (i.e. it cannot be the child of any node).

Since the undirected structure is a tree, every node (other than the nexus) has a unique neighbor which is one step closer to the nexus than itself (this may be the nexus itself). This neighbor is referred to as the node's 'breadcrumb'.

It has four major fields: - tokens is a vector of Token objects (in the order that they appear in the associated sentence). The zeroth element is assumed to be the nexus. - breadcrumb tells you the unique neighbor that is closer to the nexus in the undirected tree (this can be the nexus itself); for instance, if breadcrumb(5) = 3, then token 3 is one step closer to the nexus from token 5. The breadcrumb of the nexus should be -1. - children tells you the set of children of a node in the polytree; for instance, if children(5) = Set(3,6,7), then token 5 has three children: tokens 3, 6, and 7 - arclabels tells you the labeled neighbors of a node in the undirected tree; for instance, if arclabels(5) = Set((4, 'det), (7, 'amod)), then token 5 has two neighbors, reached with arcs labeled 'det and 'amod (the labels are scala Symbol objects)

sentence

the parsed sentence (the zeroth token of which should be the nexus)

breadcrumb

the breadcrumb of each token (see above definition)

children

the set of children of each token in the polytree

arclabels

the set of labeled neighbors of each token in the undirected tree

Linear Supertypes
Serializable, Serializable, Product, Equals, Sculpture, MarbleBlock, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. PolytreeParse
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Sculpture
  7. MarbleBlock
  8. AnyRef
  9. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new PolytreeParse(sentence: Sentence, breadcrumb: Vector[Int], children: Vector[Set[Int]], arclabels: Vector[Set[(Int, Symbol)]])

    sentence

    the parsed sentence (the zeroth token of which should be the nexus)

    breadcrumb

    the breadcrumb of each token (see above definition)

    children

    the set of children of each token in the polytree

    arclabels

    the set of labeled neighbors of each token in the undirected tree

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. val arcLabelByEndNodes: Map[Set[Int], Symbol]

    Maps a set of token indices (the set should contain exactly two elements) to the label of the arc that connects them (regardless of directionality).

  5. val arclabels: Vector[Set[(Int, Symbol)]]

    the set of labeled neighbors of each token in the undirected tree

  6. def areNeighbors(tokenIndex1: Int, tokenIndex2: Int): Boolean

    Returns whether the two argument token indices have a connecting arc (regardless of directionality) in the polytree.

    Returns whether the two argument token indices have a connecting arc (regardless of directionality) in the polytree.

    tokenIndex1

    the first token index

    tokenIndex2

    the second token index

    returns

    true iff the argument token indices have a connecting arc in the polytree

  7. lazy val asConllX: String

  8. lazy val asConstituencyParse: PositionTree

    Converts the dependency parse into a constituency parse (i.e.

    Converts the dependency parse into a constituency parse (i.e. a tree for which the leaves, rather than the entire node set, are labeled with the words of a sentence).

    It does so by making each node sprout a child. This child is labeled with its parent's word. Then its parent is relabeled with the label of the arc leading to its breadcrumb.

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. val breadcrumb: Vector[Int]

    the breadcrumb of each token (see above definition)

  11. lazy val breadcrumbArcLabel: Vector[Symbol]

    Maps each token index to the arclabel between itself and its breadcrumb.

  12. val children: Vector[Set[Int]]

    the set of children of each token in the polytree

  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. lazy val depthFirstPreorder: Iterable[Int]

  15. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. lazy val families: Seq[Seq[Int]]

  17. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  19. def getGretels(token: Int): Set[Int]

    Return the set of gretels for a particular token.

    Return the set of gretels for a particular token.

    Definition: if x is the breadcrumb of y, then y is a gretel of x.

    token

    the token (index) for which we want to identify the gretels

    returns

    the gretels of the specified token

  20. def getParents(): Map[Int, Seq[Int]]

  21. lazy val gretels: Map[Int, Vector[Int]]

    If x is the breadcrumb of y, then y is a gretel of x.

  22. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  23. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. final def notify(): Unit

    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  26. lazy val paths: Vector[Seq[Int]]

    The nth element of this vector is the "path" of the nth node (see getPath()).

  27. lazy val relativeCposMap: Map[Int, ((Boolean, Symbol), Int)]

  28. val sentence: Sentence

    the parsed sentence (the zeroth token of which should be the nexus)

  29. lazy val siblings: Vector[Set[Int]]

  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  31. def toString(): String

    Definition Classes
    PolytreeParse → AnyRef → Any
  32. val tokens: Seq[Token]

  33. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Sculpture

Inherited from MarbleBlock

Inherited from AnyRef

Inherited from Any

Ungrouped