class_docstr: Compute words embedding features for mentions
docstr: Get span (averaged) and word (single) embeddings of a mention 
docstr_tok: ["Get","span","(","averaged",")","and","word","(","single",")","embeddings","of","a","mention"]
code: def get_mention_embeddings(self, mention, doc_embedding):
      """Get span (averaged) and word (single) embeddings of a mention"""
      st = mention.sent
      mention_lefts = mention.doc[
          max(mention.start - 5, st.start) : mention.start
      ]
      mention_rights = mention.doc[
          mention.end : min(mention.end + 5, st.end)
      ]
      head = mention.root.head
      spans = [
          self.get_average_embedding(mention),
          self.get_average_embedding(mention_lefts),
          self.get_average_embedding(mention_rights),
          self.get_average_embedding(st),
          (unicode_(doc_embedding[0:8]) + "...", doc_embedding),
      ]
      words = [
          self.get_word_embedding(mention.root),
          self.get_word_embedding(mention[0]),
          self.get_word_embedding(mention[-1]),
          self.get_word_in_sentence(mention.start - 1, st),
          self.get_word_in_sentence(mention.end, st),
          self.get_word_in_sentence(mention.start - 2, st),
          self.get_word_in_sentence(mention.end + 1, st),
          self.get_word_embedding(head),
      ]
      spans_embeddings_ = {
          "00_Mention": spans[0][0],
          "01_MentionLeft": spans[1][0],
          "02_MentionRight": spans[2][0],
          "03_Sentence": spans[3][0],
          "04_Doc": spans[4][0],
      }
      words_embeddings_ = {
          "00_MentionHead": words[0][0],
          "01_MentionFirstWord": words[1][0],
          "02_MentionLastWord": words[2][0],
          "03_PreviousWord": words[3][0],
          "04_NextWord": words[4][0],
          "05_SecondPreviousWord": words[5][0],
          "06_SecondNextWord": words[6][0],
          "07_MentionRootHead": words[7][0],
      }
      return (
          spans_embeddings_,
          words_embeddings_,
          np.concatenate([em[1] for em in spans], axis=0),
          np.concatenate([em[1] for em in words], axis=0),
      )
  
imports: import re
  import io
  from six import string_types, integer_types
  from spacy.tokens import Span, Token
  from neuralcoref.train.compat import unicode_
  from neuralcoref.train.utils import encode_distance, parallel_process
  import spacy
  import numpy
label_desc: Use image node_id 9 for calling the EmbeddingExtractor obj's underlying member method code with example usage: obj.get_mention_embeddings(mention, doc_embedding) and returns: spans_embeddings_,  words_embeddings_,  np,  np