在Python Text Processing with NLTK 2.0 Cookbook的第203页中有一个导入模块remote_tag
的示例。但我没有找到任何网站可以下载该模块。如何在Python中获取模块remote_tag
?你知道吗
>>> import execnet, remote_tag, nltk.tag, nltk.data
>>> from nltk.corpus import treebank
>>> import cPickle as pickle
>>> tagger = pickle.dumps(nltk.data.load(nltk.tag._POS_TAGGER))
>>> gw = execnet.makegateway()
>>> channel = gw.remote_exec(remote_tag)
>>> channel.send(tagger)
>>> channel.send(treebank.sents()[0])
>>> tagged_sentence = channel.receive()
>>> tagged_sentence == treebank.tagged_sents()[0]
True
>>> gw.exit()
创建我们自己的远程_标签.py模块,按照Python文本处理的第204页的五行代码,使用NLTK 2.0 Cookbook将其放入与我们导入的程序相同的目录中。你知道吗
相关问题 更多 >
编程相关推荐