-
Notifications
You must be signed in to change notification settings - Fork 26
Description
What is the minimum working example of a code that I feed in a string and gives me the named entities?
from ccg_nlpy import local_pipeline
pipeline = local_pipeline.LocalPipeline()
d = "RT @HuffingtonPost BREAKING: Hillary Clinton wins #NVCaucus https://t.co/ZVCgIDvrX1"
doc = pipeline.doc(d)
if doc is not None:
# do sth with it
ner_view = doc.get_ner_conll
For above code, I get the following error:
$ python ccg_ner.py
WARNING:ccg_nlpy.pipeline_config:Models not found. To use pipeline locally, please refer the documentation for downloading models.
INFO:ccg_nlpy.pipeline_config:Using local pipeline
ERROR:ccg_nlpy.local_pipeline:Fail to load models, please check if your Java version is up to date.
Traceback (most recent call last):
File "ccg_ner.py", line 7, in <module>
doc = pipeline.doc(d)
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/ccg_nlpy/pipeline_base.py", line 36, in doc
response = self.call_server(text, "TOKENS")
File "/scratch/sjn/anaconda/lib/python3.6/site-packages/ccg_nlpy/local_pipeline.py", line 63, in call_server
text_annotation = self.pipeline.createBasicTextAnnotation("", "", text)
AttributeError: 'NoneType' object has no attribute 'createBasicTextAnnotation'
My server is running on 02:13:57 INFO LabeledChuLiuEdmondsDecoder:72 - Loading cached PoS-to-dep dictionary from deprels.dict
Reading POS tagger model from edu/stanford/nlp/models/pos-tagger/english-left3words/english-left3words-distsim.tagger ... done [1.4 sec].
Loading parser from serialized file edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz ... done [0.7 sec].
02:14:01 INFO MainServer:67 - Done with loading the pipeline . . .
02:14:01 INFO MainServer:227 - ##### Used Memory[MB]:1532
02:14:01 INFO MainServer:230 - / Free Memory[MB]:1027
02:14:01 INFO MainServer:233 - / Total Memory[MB]:2560
02:14:01 INFO MainServer:236 - / Max Memory[MB]:31858
02:14:01 INFO log:186 - Logging initialized @120702ms
02:14:01 INFO EmbeddedJettyServer:126 - == Spark has ignited ...
02:14:01 INFO EmbeddedJettyServer:127 - >> Listening on 0.0.0.0:8080
02:14:01 INFO Server:345 - jetty-9.3.6.v20151106
02:14:01 INFO ServerConnector:270 - Started ServerConnector@67e0a155{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
02:14:01 INFO Server:397 - Started @120785ms