Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The format of 'root_tree' #3

Open
aurora1625 opened this issue Jul 16, 2016 · 2 comments
Open

The format of 'root_tree' #3

aurora1625 opened this issue Jul 16, 2016 · 2 comments

Comments

@aurora1625
Copy link

Hi,

I am trying to run your program to get the SVO structure of a sentence. No matter what I have tried, I continue to get the following error:

OSError: Java command failed : [u'/usr/bin/java', u'-mx1000m', '-cp', '/Users/sean/GDrive/stanford-parser-full-2015-12-09/stanford-parser.jar:/Users/sean/GDrive/stanford-parser-full-2015-12-09/stanford-parser-3.6.0-models.jar', u'edu.stanford.nlp.parser.lexparser.LexicalizedParser', u'-model', u'edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz', u'-sentences', u'newline', u'-outputFormat', u'penn', u'-encoding', u'utf8', '/var/folders/8m/xs71_j2x20b00g42c470pck00000gn/T/tmpdkJzfr']

So I use pycorenlp https://github.com/smilli/py-corenlp package to generate the parse tree and try to pass it back to your package. An example of the output parse tree is like this:

(ROOT
(S
(NP (DT The) (JJ third) (NN conflict))
(VP (VBZ has)
(VP (VBN been)
(VP (VBN caused)
(PP (IN by)
(NP
(NP (DT the)
(ADJP (RB highly) (JJ polluted))
(NN wastewater))
(PP (IN from)
(NP (DT the) (JJ industrial) (NN park)))))
(PP (IN around)
(NP
(NP (DT the) (NN town))
(PP (IN of)
(NP (NN Kemalpasha))))))))
(. .)))

which is a unicode.

Then I got the following error:

Traceback (most recent call last):
File "svo.py", line 213, in
tre = svo.process_parse_tree(next(root_tree))
TypeError: unicode object is not an iterator

So could you tell me what is the format is the root_tree, so I can transform my other output into your format and continue to run the program, thanks!

@klintan
Copy link
Owner

klintan commented Aug 10, 2016

Hi,
It's an iterator object. But I'll see if i might extend it to be able to parse raw trees as well, however I'll see if I can find which format which is most widely used.

@yashchoubey
Copy link

Try removing "next" keyword. It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants