dependency_parsing_model#

class BiAffineParser(encoding_model, n_rels, n_words, pad_index, bos_index, eos_index, n_mlp_arc=500, n_mlp_rel=100)[source]#

DDParser

forward(words, wp)[source]#

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters:
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments

class MLP(n_in, n_out)[source]#
forward(x)[source]#

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters:
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments

class BiAffine(n_in, n_out=1, bias_x=True, bias_y=True)[source]#
forward(x, y)[source]#

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters:
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments

class ErnieEncoder(pad_index, pretrained_model)[source]#
forward(words, wp)[source]#

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters:
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments

class LSTMByWPEncoder(n_words, pad_index, lstm_by_wp_embed_size=200, n_embed=300, n_lstm_hidden=300, n_lstm_layers=3)[source]#
forward(words, wp)[source]#

Defines the computation performed at every call. Should be overridden by all subclasses.

Parameters:
  • *inputs (tuple) – unpacked tuple arguments

  • **kwargs (dict) – unpacked dict arguments

index_sample(x, index)[source]#

Select input value according to index

Arags:

input: input matrix index: index matrix

Returns:

output

>>> input
[
    [1, 2, 3],
    [4, 5, 6]
]
>>> index
[
    [1, 2],
    [0, 1]
]
>>> index_sample(input, index)
[
    [2, 3],
    [4, 5]
]