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, ArcLabel)]]) 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, ArcLabel)]])

    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], ArcLabel]

    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, ArcLabel)]]

    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[ArcLabel]

    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[Neighborhood]

    The "families" of the parse tree.

    The "families" of the parse tree. The kth element of this sequence is the family of the kth token.

    The family of a token is defined as the neighborhood consisting of itself, followed its directed children (in order of their appearance in the tokens field).

  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. def marbleBlock: MarbleBlock

    Definition Classes
    PolytreeParseSculpture
  24. final def ne(arg0: AnyRef): Boolean

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

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

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

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

  28. def printFamily(tokenIndex: Int): String

    Returns a token's "family" as a human-interpretable string.

    Returns a token's "family" as a human-interpretable string.

    tokenIndex

    the token whose family we want to look at

    returns

    a human-interpretable string describe the token's family

  29. def printToken(tokenIndex: Int): String

    Returns a token as a human-interpretable string.

    Returns a token as a human-interpretable string.

    tokenIndex

    the token we want to look at

    returns

    a human-interpretable string that describes the token

  30. val sentence: Sentence

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

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

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

    Definition Classes
    AnyRef
  33. def toString(): String

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

  35. final def wait(): Unit

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. 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