def trp(doc,n,pad=['@PAD@']):
    """
    Truncates and pads input doc
    
    Arguments:
        doc: interable object containing text.
        pad: pad sequence e.g. @PAD@
    Returns:
        truncated and padded document 
    """
    l=[token  for token in doc if token.has_vector]
    pad_trunc=list(l[:n])+list(pad)*(n-len(l))
    return(pad_trunc)