You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@opennlp.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/03/04 21:02:00 UTC
[jira] [Commented] (OPENNLP-509) opennlp.tools.parser.Parse.getParent() returning incorrect object
[ https://issues.apache.org/jira/browse/OPENNLP-509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17696488#comment-17696488 ]
ASF GitHub Bot commented on OPENNLP-509:
----------------------------------------
mawiesne opened a new pull request, #517:
URL: https://github.com/apache/opennlp/pull/517
Change
-
- adds `setParents(..)` calls in `AbstractBottomUpParser#parse(Parse tokens, int numParses)` which now set the hierarchical (back) references that were missing before
- adds test to verify that a processed Parse instance's parent references are populated and _not_ `null`
Notes
-
- [OpenNLP-509](https://issues.apache.org/jira/projects/OPENNLP/issues/OPENNLP-509) was open for 10+ years.
Tasks
-
Thank you for contributing to Apache OpenNLP.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with OPENNLP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target branch (typically main)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [x] Have you ensured that the full suite of tests is executed via mvn clean install at the root opennlp folder?
- [x] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file in opennlp folder?
- [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found in opennlp folder?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check GitHub Actions for build issues and submit an update to your PR as soon as possible.
> 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
> Priority: Major
>
> 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)