human
Complete the below
def get_or_generate_tabbed_vocab(data_dir, tmp_dir, source_filename, index, vocab_filename, vocab_size):

    ''''Generate a vocabulary from a tabbed source file.
    The source is a file of source, target pairs, where each line contains
    a source string and a target string, separated by a tab (\'\t\') character.
    The index parameter specifies 0 for the source or 1 for the target.
    Args:
    data_dir: path to the data directory.
    tmp_dir: path to the temporary directory.
    source_filename: the name of the tab-separated source file.
    index: index.
    vocab_filename: the name of the vocabulary file.
    vocab_size: vocabulary size.
    Returns:
    The vocabulary.'
    '''
assistant
#Here is the Python program you requested.
    def generate():
        filepath = os.path.join(tmp_dir, source_filename)
        tf.logging.info('Generating    vocab    from    %s', filepath)
        with tf.gfile.GFile(filepath, mode='r') as source_file:
            for line in source_file:
                line = line.strip()
                if (line and (' DCTB ' in line)):
                    parts = line.split(' DCTB ', maxsplit=1)
                    part = parts[index].strip()
                    (yield part)
    return get_or_generate_vocab_inner(data_dir, vocab_filename, vocab_size, generator_fn=generate)