You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@opennlp.apache.org by "Ofer Tal (JIRA)" <ji...@apache.org> on 2012/05/16 20:13:07 UTC

[jira] [Created] (OPENNLP-509) opennlp.tools.parser.Parse.getParent() returning incorrect object

Ofer Tal created OPENNLP-509:
--------------------------------

             Summary: opennlp.tools.parser.Parse.getParent() returning incorrect object
                 Key: OPENNLP-509
                 URL: https://issues.apache.org/jira/browse/OPENNLP-509
             Project: OpenNLP
          Issue Type: Improvement
          Components: Parser
    Affects Versions: tools-1.5.2-incubating
         Environment: OpenNLP invoked from C# (.Net 4) via IKVM ikvm-7.0.4335.0
OpenNLP library dll created using the command: ikvmc -target:library -assembly:opennlp %OPENNLP_LIB_PATH%\opennlp-maxent-3.0.2-incubating.jar %OPENNLP_LIB_PATH%\jwnl-1.3.3.jar %OPENNLP_LIB_PATH%\opennlp-tools-1.5.2-incubating.jar
            Reporter: Ofer Tal


After parsing a sentence with opennlp.tools.parser.Parse.parse() some (many) Parse children do not have the correct parent set.

Details:
given a Parse node in the tree (let's assume it is in a variable named p)
When iterating over the Parse[] returned by p.getChildren(), checking p.equals(children[i].getParent()) returns false in many, if not all of the nodes.

More background --
to create the parse tree, I used the code:
{code}
opennlp.tools.parser.Parse p = new opennlp.tools.parser.Parse(parseSentence, new opennlp.tools.util.Span(0, parseSentence.Length), opennlp.tools.parser.AbstractBottomUpParser.INC_NODE, 1, null);

            // create a parse object for each token and add it to the parent
            int start = 0;
            foreach (string token in tokenizedSentence)
            {
                {
                    opennlp.tools.parser.Parse tokenParse = new opennlp.tools.parser.Parse(parseSentence,
                                                            new opennlp.tools.util.Span(start, start + token.Length),
                                                            opennlp.tools.parser.AbstractBottomUpParser.TOK_NODE,
                                                            0,
                                                            0);                    
                    p.insert(tokenParse);
                    start += token.Length + 1;
                }
            }

            // fetch 1 possible parse trees
            opennlp.tools.parser.Parse[] parses = parser.parse(p, 1);
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira