lexical_analysis_model

lexical_analysis_model#

class BiGruCrf(word_emb_dim, hidden_size, vocab_size, num_labels, emb_lr=2.0, crf_lr=0.2, with_start_stop_tag=True)[源代码]#

The network for lexical analysis, based on two layers of BiGRU and one layer of CRF. More details see https://arxiv.org/abs/1807.01882 :param word_emb_dim: The dimension in which a word is embedded. :type word_emb_dim: int :param hidden_size: The number of hidden nodes in the GRU layer. :type hidden_size: int :param vocab_size: the word vocab size. :type vocab_size: int :param num_labels: the labels amount. :type num_labels: int :param emb_lr: The scaling of the learning rate of the embedding layer. Defaults to 2.0. :type emb_lr: float, optional :param crf_lr: The scaling of the learning rate of the crf layer. Defaults to 0.2. :type crf_lr: float, optional

forward(inputs, lengths, labels=None)[源代码]#

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

参数:
  • *inputs (tuple) -- unpacked tuple arguments

  • **kwargs (dict) -- unpacked dict arguments