class_docstr: Bi-LSTM NER model with CRF classification layer (tf.keras model)
  
  Args:
      use_cudnn (bool, optional): use cudnn LSTM cells
docstr: Build a NERCRF model
  
  Args:
      word_length (int): max word length in characters
      target_label_dims (int): number of entity labels (for classification)
      word_vocab_size (int): word vocabulary size
      char_vocab_size (int): character vocabulary size
      word_embedding_dims (int): word embedding dimensions
      char_embedding_dims (int): character embedding dimensions
      tagger_lstm_dims (int): word tagger LSTM output dimensions
      dropout (float): dropout rate
docstr_tok: ["Build","a","NERCRF","model","Args",":","word_length","(","int",")",":","max","word","length","in","characters","target_label_dims","(","int",")",":","number","of","entity","labels","(","for","classification",")","word_vocab_size","(","int",")",":","word","vocabulary","size","char_vocab_size","(","int",")",":","character","vocabulary","size","word_embedding_dims","(","int",")",":","word","embedding","dimensions","char_embedding_dims","(","int",")",":","character","embedding","dimensions","tagger_lstm_dims","(","int",")",":","word","tagger","LSTM","output","dimensions","dropout","(","float",")",":","dropout","rate"]
code: def build(
      self,
      word_length,
      target_label_dims,
      word_vocab_size,
      char_vocab_size,
      word_embedding_dims=100,
      char_embedding_dims=16,
      tagger_lstm_dims=200,
      dropout=0.5,
  ):
      """
      Build a NERCRF model
  
      Args:
          word_length (int): max word length in characters
          target_label_dims (int): number of entity labels (for classification)
          word_vocab_size (int): word vocabulary size
          char_vocab_size (int): character vocabulary size
          word_embedding_dims (int): word embedding dimensions
          char_embedding_dims (int): character embedding dimensions
          tagger_lstm_dims (int): word tagger LSTM output dimensions
          dropout (float): dropout rate
      """
      self.word_length = word_length
      self.target_label_dims = target_label_dims
      self.word_vocab_size = word_vocab_size
      self.char_vocab_size = char_vocab_size
      self.word_embedding_dims = word_embedding_dims
      self.char_embedding_dims = char_embedding_dims
      self.tagger_lstm_dims = tagger_lstm_dims
      self.dropout = dropout
  
      # build word input
      words_input = tf.keras.layers.Input(
          shape=(None,), name="words_input"
      )
      embedding_layer = tf.keras.layers.Embedding(
          self.word_vocab_size,
          self.word_embedding_dims,
          name="word_embedding",
      )
      word_embeddings = embedding_layer(words_input)
  
      # create word character embeddings
      word_chars_input = tf.keras.layers.Input(
          shape=(None, self.word_length), name="word_chars_input"
      )
      char_embedding_layer = tf.keras.layers.Embedding(
          self.char_vocab_size,
          self.char_embedding_dims,
          name="char_embedding",
      )(word_chars_input)
      char_embeddings = tf.keras.layers.TimeDistributed(
          tf.keras.layers.Conv1D(
              128, 3, padding="same", activation="relu"
          )
      )(char_embedding_layer)
      char_embeddings = tf.keras.layers.TimeDistributed(
          tf.keras.layers.GlobalMaxPooling1D()
      )(char_embeddings)
  
      # create the final feature vectors
      features = tf.keras.layers.concatenate(
          [word_embeddings, char_embeddings], axis=-1
      )
  
      # encode using a bi-LSTM
      features = tf.keras.layers.Dropout(self.dropout)(features)
      bilstm = tf.keras.layers.Bidirectional(
          self._rnn_cell(self.tagger_lstm_dims, return_sequences=True)
      )(features)
      bilstm = tf.keras.layers.Bidirectional(
          self._rnn_cell(self.tagger_lstm_dims, return_sequences=True)
      )(bilstm)
      bilstm = tf.keras.layers.Dropout(self.dropout)(bilstm)
      bilstm = tf.keras.layers.Dense(self.target_label_dims)(bilstm)
  
      inputs = [words_input, word_chars_input]
  
      sequence_lengths = tf.keras.layers.Input(
          shape=(1,), dtype="int32", name="seq_lens"
      )
      inputs.append(sequence_lengths)
      crf = CRF(self.target_label_dims, name="ner_crf")
      predictions = crf(
          inputs=bilstm, sequence_lengths=sequence_lengths
      )
  
      # compile the model
      model = tf.keras.Model(inputs=inputs, outputs=predictions)
      model.compile(
          loss={"ner_crf": crf.loss},
          optimizer=tf.keras.optimizers.Adam(0.001, clipnorm=5.0),
      )
  
      self.model = model
  
file_path: nlp-architect/nlp_architect/models/ner_crf.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import tensorflow
  from nlp_architect.nn.tensorflow.python.keras.layers.crf import CRF
  from nlp_architect.nn.tensorflow.python.keras.utils import load_model, save_model
label_desc: Use image node_id 2 for calling the NERCRF obj's underlying member method code with example usage: obj.build(word_length, target_label_dims, word_vocab_size, char_vocab_size, word_embedding_dims, char_embedding_dims, tagger_lstm_dims, dropout) without return types