google app engine - POS tagging on GAE -
i trying part of string tagging pull out nouns of sentence in python on google app engine. far have tried use nltk library. unable nltk working in gae. error message complains missing numpy module.
this person has had same problem: https://groups.google.com/forum/?fromgroups#!topic/nltk-users/2nwztlgfyvi
i cannot find clear instructions on how nltk running on gae or alternative pos tagger runs on gae
edit:
my steps trying nltk working (i'm on osx 10.7):
- install nltk via terminal "easy_install nltk"
- copy nltk root of appengine project /library/python/2.7/site-packages/nltk-2.0.1-py2.7.egg/nltk/
add following settings app.yaml:
runtime: python27 threadsafe: false libraries: name: numpy version: "latest"
write test.py
import nltk
in it- deploy, run , following error (the numpy error solved, new one):
traceback (most recent call last): file "/base/data/home/apps/s~domain/1.359540170137090086/dynamic/test.py", line 4, in import nltk file "/base/data/home/apps/s~domain/1.359540170137090086/nltk/init.py", line 116, in import ccg file "/base/data/home/apps/s~domain/1.359540170137090086/nltk/ccg/init.py", line 14, in nltk.ccg.combinator import (undirectedbinarycombinator, directedbinarycombinator, file "/base/data/home/apps/s~domain/1.359540170137090086/nltk/ccg/combinator.py", line 8, in nltk.parse import parseri file "/base/data/home/apps/s~domain/1.359540170137090086/nltk/parse/init.py", line 68, in nltk.parse.util import load_parser, testgrammar, extract_test_sentences file "/base/data/home/apps/s~domain/1.359540170137090086/nltk/parse/util.py", line 15, in nltk.data import load file "/base/data/home/apps/s~domain/1.359540170137090086/nltk/data.py", line 75, in if os.path.expanduser('~/') != '~/': path += [ file "/base/python27_runtime/python27_dist/lib/python2.7/posixpath.py", line 259, in expanduser import pwd importerror: no module named pwd
the following nltk/data.py (around line 75):
###################################################################### # search path ###################################################################### path = [] """a list of directories nltk data package might reside. these directories checked in order when looking resource in data package. note allows users substitute in own versions of resources, if have them (e.g., in home directory under ~/nltk_data).""" # user-specified locations: path += [d d in os.environ.get('nltk_data', '').split(os.pathsep) if d] if os.path.expanduser('~/') != '~/': path += [ os.path.expanduser('~/nltk_data')] # common locations on windows: if sys.platform.startswith('win'): path += [ r'c:\nltk_data', r'd:\nltk_data', r'e:\nltk_data', os.path.join(sys.prefix, 'nltk_data'), os.path.join(sys.prefix, 'lib', 'nltk_data'), os.path.join(os.environ.get('appdata', 'c:\\'), 'nltk_data')] # common locations on unix & os x: else: path += [ '/usr/share/nltk_data', '/usr/local/share/nltk_data', '/usr/lib/nltk_data', '/usr/local/lib/nltk_data']
gae python27 supports numpy 1.6.1. specifying
runtime: python27
in app.yaml
? link gave pre-dates python 2.7 support, i'm guessing not.
Comments
Post a Comment