def process_pdfs(corpus_path, ignore=['.json','.log','.err','.pickle','.npz']):
    from topicexplorer.lib import pdf
    if os.path.isfile(corpus_path):
        print "PDF file detected, extracting plaintext to",\
            corpus_path.replace('.pdf','.txt')
        pdf.main(corpus_path)
        corpus_path = corpus_path.replace('.pdf','.txt')
    elif os.path.isdir(corpus_path):
        print "PDF files detected, extracting plaintext to", corpus_path + '-txt'

        if corpus_path.endswith('/'):
            corpus_path = corpus_path[:-1]

        # TODO: Add processing of collections
        contents = listdir_nohidden(corpus_path)
        contents = [os.path.join(corpus_path,obj) for obj in contents 
            if not any([obj.endswith(suffix) for suffix in ignore])]
        count_dirs = len(filter(os.path.isdir, contents))
        count_files = len(filter(os.path.isfile, contents))

        if count_files > 0 and count_dirs == 0:
            # process all files
            pdf.main(corpus_path, corpus_path + '-txt')
        elif count_dirs > 0 and count_files == 0:
            # process each subdirectoryV
            for directory in contents:
                pdf.main(directory, 
                         directory.replace(corpus_path, corpus_path+'-txt'))
        else:
            raise IOError("Invalid Path: empty directory")
        
        corpus_path += '-txt'
    return corpus_path
dataset/ETHPy150Open inpho/topic-explorer/topicexplorer/init.py/process_pdfs/original