def outputid_to_word(id_, vocab, article_oovs):
    """
    Maps output ids to words, including mapping in-article OOVs from their temporary ids to the
    original OOV string (applicable in pointer-generator mode).
  
    Args:
        id_: integer
        vocab: Vocabulary object
        article_oovs: list of OOV words (strings) in the order corresponding to their temporary
            article OOV ids
  
    Returns:
        word: string
    """
    try:
        # might be unknown
        w = vocab.id2word(id_)
    except ValueError:
        # w is OOV
        article_oov_idx = id_ - vocab.size
        w = article_oovs[article_oov_idx]

    return w