(abstract_words, vocab, article_oovs)
return ids
Map the abstract words to their ids. In-article OOVs are mapped to their temporary OOV numbers.

  Args:
    abstract_words: list of words (strings)
    vocab: Vocabulary object
    article_oovs: list of in-article OOV words (strings), in the order corresponding to their temporary article OOV numbers

  Returns:
    ids: List of ids (integers). In-article OOV words are mapped to their temporary OOV numbers. Out-of-article OOV words are mapped to the UNK token id.
Map the abstract words to their ids. In-article OOVs are mapped to their temporary OOV numbers.
Map the abstract words to their ids . In - article OOVs are mapped to their temporary OOV numbers .
def abstract2ids(abstract_words, vocab, article_oovs):
  """Map the abstract words to their ids. In-article OOVs are mapped to their temporary OOV numbers.

  Args:
    abstract_words: list of words (strings)
    vocab: Vocabulary object
    article_oovs: list of in-article OOV words (strings), in the order corresponding to their temporary article OOV numbers

  Returns:
    ids: List of ids (integers). In-article OOV words are mapped to their temporary OOV numbers. Out-of-article OOV words are mapped to the UNK token id."""
  ids = []
  unk_id = vocab.word2id(UNKNOWN_TOKEN)
  for w in abstract_words:
    i = vocab.word2id(w)
    if i == unk_id: # If w is an OOV word
      if w in article_oovs: # If w is an in-article OOV
        vocab_idx = vocab.size() + article_oovs.index(w) # Map to its temporary article OOV number
        ids.append(vocab_idx)
      else: # If w is an out-of-article OOV
        ids.append(unk_id) # Map to the UNK token id
    else:
      ids.append(i)
  return ids
def abstract2ids ( abstract_words , vocab , article_oovs ) : ids = [ ] unk_id = vocab . word2id ( UNKNOWN_TOKEN ) for w in abstract_words : i = vocab . word2id ( w ) if i == unk_id : # If w is an OOV word if w in article_oovs : # If w is an in-article OOV vocab_idx = vocab . size ( ) + article_oovs . index ( w ) # Map to its temporary article OOV number ids . append ( vocab_idx ) else : # If w is an out-of-article OOV ids . append ( unk_id ) # Map to the UNK token id else : ids . append ( i ) return ids