def get_n_positions_from_options(opt):
    """
    Determine n_positions from options dict.
    """
    if opt.get('n_positions'):
        n_positions = opt['n_positions']
    else:
        n_positions = max(opt.get('truncate') or 0, opt.get('text_truncate'
            ) or 0, opt.get('label_truncate') or 0)
        if n_positions == 0:
            n_positions = 1024
    return n_positions
