Skip to content

biaffine_dependency_parser

allennlp_models.structured_prediction.predictors.biaffine_dependency_parser

[SOURCE]


NODE_TYPE_TO_STYLE#

NODE_TYPE_TO_STYLE = {}

NODE_TYPE_TO_STYLE["root"]#

NODE_TYPE_TO_STYLE["root"] = ["color5", "strong"]

NODE_TYPE_TO_STYLE["dep"]#

NODE_TYPE_TO_STYLE["dep"] = ["color5", "strong"]

NODE_TYPE_TO_STYLE["nsubj"]#

NODE_TYPE_TO_STYLE["nsubj"] = ["color1"]

NODE_TYPE_TO_STYLE["nsubjpass"]#

NODE_TYPE_TO_STYLE["nsubjpass"] = ["color1"]

NODE_TYPE_TO_STYLE["csubj"]#

NODE_TYPE_TO_STYLE["csubj"] = ["color1"]

NODE_TYPE_TO_STYLE["csubjpass"]#

NODE_TYPE_TO_STYLE["csubjpass"] = ["color1"]

NODE_TYPE_TO_STYLE["pobj"]#

NODE_TYPE_TO_STYLE["pobj"] = ["color2"]

NODE_TYPE_TO_STYLE["dobj"]#

NODE_TYPE_TO_STYLE["dobj"] = ["color2"]

NODE_TYPE_TO_STYLE["iobj"]#

NODE_TYPE_TO_STYLE["iobj"] = ["color2"]

NODE_TYPE_TO_STYLE["mark"]#

NODE_TYPE_TO_STYLE["mark"] = ["color2"]

NODE_TYPE_TO_STYLE["pcomp"]#

NODE_TYPE_TO_STYLE["pcomp"] = ["color2"]

NODE_TYPE_TO_STYLE["xcomp"]#

NODE_TYPE_TO_STYLE["xcomp"] = ["color2"]

NODE_TYPE_TO_STYLE["ccomp"]#

NODE_TYPE_TO_STYLE["ccomp"] = ["color2"]

NODE_TYPE_TO_STYLE["acomp"]#

NODE_TYPE_TO_STYLE["acomp"] = ["color2"]

NODE_TYPE_TO_STYLE["aux"]#

NODE_TYPE_TO_STYLE["aux"] = ["color3"]

NODE_TYPE_TO_STYLE["cop"]#

NODE_TYPE_TO_STYLE["cop"] = ["color3"]

NODE_TYPE_TO_STYLE["det"]#

NODE_TYPE_TO_STYLE["det"] = ["color3"]

NODE_TYPE_TO_STYLE["conj"]#

NODE_TYPE_TO_STYLE["conj"] = ["color3"]

NODE_TYPE_TO_STYLE["cc"]#

NODE_TYPE_TO_STYLE["cc"] = ["color3"]

NODE_TYPE_TO_STYLE["prep"]#

NODE_TYPE_TO_STYLE["prep"] = ["color3"]

NODE_TYPE_TO_STYLE["number"]#

NODE_TYPE_TO_STYLE["number"] = ["color3"]

NODE_TYPE_TO_STYLE["possesive"]#

NODE_TYPE_TO_STYLE["possesive"] = ["color3"]

NODE_TYPE_TO_STYLE["poss"]#

NODE_TYPE_TO_STYLE["poss"] = ["color3"]

NODE_TYPE_TO_STYLE["discourse"]#

NODE_TYPE_TO_STYLE["discourse"] = ["color3"]

NODE_TYPE_TO_STYLE["expletive"]#

NODE_TYPE_TO_STYLE["expletive"] = ["color3"]

NODE_TYPE_TO_STYLE["prt"]#

NODE_TYPE_TO_STYLE["prt"] = ["color3"]

NODE_TYPE_TO_STYLE["advcl"]#

NODE_TYPE_TO_STYLE["advcl"] = ["color3"]

NODE_TYPE_TO_STYLE["mod"]#

NODE_TYPE_TO_STYLE["mod"] = ["color4"]

NODE_TYPE_TO_STYLE["amod"]#

NODE_TYPE_TO_STYLE["amod"] = ["color4"]

NODE_TYPE_TO_STYLE["tmod"]#

NODE_TYPE_TO_STYLE["tmod"] = ["color4"]

NODE_TYPE_TO_STYLE["quantmod"]#

NODE_TYPE_TO_STYLE["quantmod"] = ["color4"]

NODE_TYPE_TO_STYLE["npadvmod"]#

NODE_TYPE_TO_STYLE["npadvmod"] = ["color4"]

NODE_TYPE_TO_STYLE["infmod"]#

NODE_TYPE_TO_STYLE["infmod"] = ["color4"]

NODE_TYPE_TO_STYLE["advmod"]#

NODE_TYPE_TO_STYLE["advmod"] = ["color4"]

NODE_TYPE_TO_STYLE["appos"]#

NODE_TYPE_TO_STYLE["appos"] = ["color4"]

NODE_TYPE_TO_STYLE["nn"]#

NODE_TYPE_TO_STYLE["nn"] = ["color4"]

NODE_TYPE_TO_STYLE["neg"]#

NODE_TYPE_TO_STYLE["neg"] = ["color0"]

NODE_TYPE_TO_STYLE["punct"]#

NODE_TYPE_TO_STYLE["punct"] = ["color0"]

LINK_TO_POSITION = {}

LINK_TO_POSITION["nsubj"] = "left"

LINK_TO_POSITION["nsubjpass"] = "left"

LINK_TO_POSITION["csubj"] = "left"

LINK_TO_POSITION["csubjpass"] = "left"

LINK_TO_POSITION["pobj"] = "right"

LINK_TO_POSITION["dobj"] = "right"

LINK_TO_POSITION["iobj"] = "right"

LINK_TO_POSITION["pcomp"] = "right"

LINK_TO_POSITION["xcomp"] = "right"

LINK_TO_POSITION["ccomp"] = "right"

LINK_TO_POSITION["acomp"] = "right"

BiaffineDependencyParserPredictor#

@Predictor.register("biaffine_dependency_parser", exist_ok=True)
class BiaffineDependencyParserPredictor(Predictor):
 | def __init__(
 |     self,
 |     model: Model,
 |     dataset_reader: DatasetReader,
 |     language: str = "en_core_web_sm"
 | ) -> None

Predictor for the BiaffineDependencyParser model.

predict#

class BiaffineDependencyParserPredictor(Predictor):
 | ...
 | def predict(self, sentence: str) -> JsonDict

Predict a dependency parse for the given sentence.

Parameters

sentence The sentence to parse.

Returns

  • A dictionary representation of the dependency tree.

predict_instance#

class BiaffineDependencyParserPredictor(Predictor):
 | ...
 | @overrides
 | def predict_instance(self, instance: Instance) -> JsonDict

predict_batch_instance#

class BiaffineDependencyParserPredictor(Predictor):
 | ...
 | @overrides
 | def predict_batch_instance(
 |     self,
 |     instances: List[Instance]
 | ) -> List[JsonDict]