[ https://issues.apache.org/jira/browse/OPENNLP-509?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Zowalla closed OPENNLP-509. ----------------------------------- Fix Version/s: 2.2.0 Resolution: Fixed > opennlp.tools.parser.Parse.getParent() returning incorrect object > ----------------------------------------------------------------- > > Key: OPENNLP-509 > URL: https://issues.apache.org/jira/browse/OPENNLP-509 > Project: OpenNLP > Issue Type: Bug > 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 > Assignee: Martin Wiesner > Priority: Major > Fix For: 2.2.0 > > > 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 was sent by Atlassian Jira (v8.20.10#820010)