python - Does anyone know how to configure the hunpos wrapper class on nltk? -


i've tried following code , installed http://code.google.com/p/hunpos/downloads/list

english-wsj-1.0

hunpos-1.0-linux.tgz

i've extracted file onto '~/' directory

and when tried following python code:

import nltk nltk.tag import hunpos nltk.tag.hunpos import hunpostagger import os, sys, re, glob cwd = os.getcwd()  infile in glob.glob(os.path.join(cwd, '*.txt')):     (path, filename) = os.path.split(infile)     read = open(infile)     ht = hunpostagger('english.model')     ht.tag(read.readline()) 

i following error

traceback (most recent call last):   file "<stdin>", line 4, in <module>   file "/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/tag/hunpos.py", line 46, in __init__     verbose=verbose)   file "/usr/local/lib/python2.6/dist-packages/nltk-2.0b9-py2.6.egg/nltk/internals.py", line 503, in find_binary     raise lookuperror('\n\n%s\n%s\n%s' % (div, msg, div)) lookuperror:   ===========================================================================   nltk unable find hunpos-tag executable!  use   config_hunpos-tag() or set hunpos environment variable.      >>> config_hunpos-tag('/path/to/hunpos-tag')    searched in:     - .     - /usr/bin     - /usr/local/bin     - /opt/local/bin     - /applications/bin     - /home/ubi/bin     - /home/ubi/applications/bin    more information, on hunpos-tag, see:     <http://code.google.com/p/hunpos/> =========================================================================== >>> config_hunpos-tag('~/') traceback (most recent call last):   file "<stdin>", line 1, in <module> nameerror: name 'config_hunpos' not defined 

how configure hunpos in python? python command need enter?

you're close solution. move hunpos-tag executable /home/ubi/bin , should able find then. caused me trouble when first trying use hunpos.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -