Friday, 15 May 2015

nltk - How can I get module "remote_tag" in Python? -


An example of that example in page 203 is the module remote_tag . But I could not find a site that could download the module. How do I get the module remote_tag in Python?

  & gt; & Gt; & Gt; Import execnet, remote_tag, nltk.tag, nltk.data & gt; & Gt; & Gt; Nltk.corpus Import & Export Patebank & gt; & Gt; & Gt; Import as pickle cPickle & gt; & Gt; & Gt; Tagger = Pikaldenps (nltk.data.load (nltk.tag._POS_TAGGER)) gt; & Gt; & Gt; Gw = execnet.makegateway ()> & gt; & Gt; & Gt; Channel = gw.remote_exec (Remote_tag) & gt; & Gt; & Gt; Channel.send (Tagger) & gt; & Gt; & Gt; Channel.send (treebank.sents () [0]) & gt; & Gt; & Gt; Tag_sentens = channel. Receive ()> gt; & Gt; & Gt; Tag_centence == treebank Tagged_seent () [0] true & gt; & Gt; & Gt; Gw.exit ()  

create your own remote_tag.py Module according to the code of the five lines, which is from page 204 of Python text processing with the NLTK 2.0 cookbook and keep it in the same directory as the program that we import it. Import CeClique as Import

  Import if __name__ == '__channelexec__': tag ger = pickle.loads for channel in sentence (channel.receive ()): channel.send (tagger.tag (Sentence))  

No comments:

Post a Comment