本文整理汇总了Python中preprocessor.Preprocessor.prep_text方法的典型用法代码示例。如果您正苦于以下问题:Python Preprocessor.prep_text方法的具体用法?Python Preprocessor.prep_text怎么用?Python Preprocessor.prep_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类preprocessor.Preprocessor
的用法示例。
在下文中一共展示了Preprocessor.prep_text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from preprocessor import Preprocessor [as 别名]
# 或者: from preprocessor.Preprocessor import prep_text [as 别名]
if( check == 9 ):
return True
else:
return False
if __name__ == '__main__':
import sys, os
logging.basicConfig(format='%(asctime)s : %(threadName)s : %(levelname)s : %(message)s', level=logging.INFO)
logging.info("running %s" % " ".join(sys.argv))
# check and process cmdline input
program = os.path.basename(sys.argv[0])
if len(sys.argv) < 5:
print "Usage: python preprocessor.py -infile -synset_list -vocab_filename -outputfilename "
sys.exit(1)
infile = sys.argv[1]
#synset filename
S = sys.argv[2]
#vocab filename
F = sys.argv[3]
outfile = sys.argv[4]
from preprocessor import Preprocessor # for pickle
#from gensim.models import Preprocessor # for pickle
from gensim.models.word2vec import Text8Corpus
sentences = Text8Corpus(infile)
prep = Preprocessor(sentences,F,S)
prep.prep_text(8,sentences,outfile)