def score_application(self, wordpiece_encodings, application_span_begin,
                        application_span_end, application_rule_idx):
    """Computes scores for a single anchored rule applications.

    Args:
      wordpiece_encodings: <float>[max_num_wordpieces, bert_dims]
      application_span_begin: <int>[1]
      application_span_end: <int>[1]
      application_rule_idx: <int>[1]

    Returns:
      application_score: <float>[1]
    """
    # <float>[bert_dims]
    span_begin_encoding = tf.gather(wordpiece_encodings, application_span_begin)
    span_end_encoding = tf.gather(wordpiece_encodings, application_span_end)
    # <float>[bert_dims * 2]
    span_encoding = tf.concat([span_begin_encoding, span_end_encoding], axis=0)
    # <float>[1, bert_dims * 2]
    span_encoding = tf.expand_dims(span_encoding, 0)
    # <float>[1, model_dims]
    span_ffn_encoding = self.feed_forward(span_encoding)

    # <float>[model_dims]
    application_rule_embedddings = self.rule_embeddings(application_rule_idx)
    # <float>[model_dims, 1]
    application_rule_embedddings = tf.expand_dims(application_rule_embedddings,
                                                  1)

    # <float>[1, 1]
    application_score = tf.matmul(span_ffn_encoding,
                                  application_rule_embedddings)
    # <float>[]
    application_score = tf.squeeze(application_score, [0, 1])

    # <float>[1, 1]
    span_score = self.span_feed_forward(span_encoding)
    # <float>[]
    span_score = tf.squeeze(span_score, [0, 1])

    return application_score + span_score
Computes scores for a single anchored rule applications.

    Args:
      wordpiece_encodings: <float>[max_num_wordpieces, bert_dims]
      application_span_begin: <int>[1]
      application_span_end: <int>[1]
      application_rule_idx: <int>[1]

    Returns:
      application_score: <float>[1]
    
language/compgen/nqg/model/parser/nqg_model.py