vpekar / stanford-parser-in-jython Goto Github PK
View Code? Open in Web Editor NEWA Jython interface to the Stanford parser. Includes various utilities to manipulate parsed sentences.
A Jython interface to the Stanford parser. Includes various utilities to manipulate parsed sentences.
This looks great, but when I run I get the following:
Traceback (most recent call last):
File "/home/gavin/dev/spyder-workspace/monotonicityMarker/stanfordParserInterface.py", line 317, in
sp = StanfordParser(r'englishPCFG.ser.gz')
File "/home/gavin/dev/spyder-workspace/monotonicityMarker/stanfordParserInterface.py", line 271, in init
self.lp = LexicalizedParser(parser_file)
TypeError: edu.stanford.nlp.parser.lexparser.LexicalizedParser(): expected 8 args; got 1
Any tips are appreciated.
Hi,
the unittests (4/5) throw an error when trying to parse over the nodes of a GrammaticalStructure. Maybe the specification of the EnglishGrammaticalStructure has changed? According to the doc on http://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/trees/EnglishGrammaticalStructure.html neither EnglishGrammaticalStructure nor the class it's derived from has this method.
As a quick fix one could use the root() method and parse the tree to return all it's nodes. Is it intendend to be like this?
$ jython -Dpython.path=/Users/Lyssa/Software/stanford-parser-full-2014-08-27/stanford-parser.jar test_stanford.py
Loading parser from serialized file englishPCFG.ser ... done [1.2 sec].
EEEE.
======================================================================
ERROR: test_get_least_common_node (__main__.TestPySentence)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_stanford.py", line 15, in setUp
self.sentence = PARSER.parse_xml(input)
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 385, in parse_xml
return PySentence(self, parse, xml_tags)
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 114, in __init__
self.populate_indices()
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 152, in populate_indices
for node_i in self.gs.getNodes():
AttributeError: 'edu.stanford.nlp.trees.EnglishGrammaticalStructure' object has no attribute 'getNodes'
======================================================================
ERROR: test_get_most_probable_parses_check_nonzero (__main__.TestStanfordParser)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_stanford.py", line 44, in test_get_most_probable_parses_check_nonzero
parses = [x for x in PARSER.get_most_probable_parses(input, kbest=expected)]
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 344, in get_most_probable_parses
py_sentence = PySentence(self, candidate_tree.object())
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 114, in __init__
self.populate_indices()
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 152, in populate_indices
for node_i in self.gs.getNodes():
AttributeError: 'edu.stanford.nlp.trees.EnglishGrammaticalStructure' object has no attribute 'getNodes'
======================================================================
ERROR: test_get_most_probable_parses_check_types (__main__.TestStanfordParser)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_stanford.py", line 34, in test_get_most_probable_parses_check_types
for s, prob in PARSER.get_most_probable_parses(input, kbest=2):
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 344, in get_most_probable_parses
py_sentence = PySentence(self, candidate_tree.object())
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 114, in __init__
self.populate_indices()
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 152, in populate_indices
for node_i in self.gs.getNodes():
AttributeError: 'edu.stanford.nlp.trees.EnglishGrammaticalStructure' object has no attribute 'getNodes'
======================================================================
ERROR: test_parse_xml (__main__.TestStanfordParser)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_stanford.py", line 52, in test_parse_xml
sentence = PARSER.parse_xml(input)
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 385, in parse_xml
return PySentence(self, parse, xml_tags)
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 114, in __init__
self.populate_indices()
File "/Users/Lyssa/PycharmProjects/graphkernel/stanford.py", line 152, in populate_indices
for node_i in self.gs.getNodes():
AttributeError: 'edu.stanford.nlp.trees.EnglishGrammaticalStructure' object has no attribute 'getNodes'
----------------------------------------------------------------------
Ran 5 tests in 0.871s
headTagNode seems to have been removed in version 3.5.2 resulting in the error:
'edu.stanford.nlp.trees.TreeGraphNode' object has no attribute 'headTagNode'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.