[jira] [Commented] (OPENNLP-941) Add eval support to detokenizer
[ https://issues.apache.org/jira/browse/OPENNLP-941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16439514#comment-16439514 ] ASF GitHub Bot commented on OPENNLP-941: kottmann closed pull request #308: [OPENNLP-941] Added eval support to detokenizer URL: https://github.com/apache/opennlp/pull/308 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenEvaluationErrorListener.java b/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenEvaluationErrorListener.java new file mode 100644 index 0..4e313328c --- /dev/null +++ b/opennlp-tools/src/main/java/opennlp/tools/cmdline/tokenizer/DetokenEvaluationErrorListener.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package opennlp.tools.cmdline.tokenizer; + +import java.io.OutputStream; + +import opennlp.tools.cmdline.EvaluationErrorPrinter; +import opennlp.tools.tokenize.TokenSample; +import opennlp.tools.tokenize.TokenizerEvaluationMonitor; +import opennlp.tools.util.eval.EvaluationMonitor; + +/** + * A default implementation of {@link EvaluationMonitor} that prints + * to an output stream. + */ +public class DetokenEvaluationErrorListener extends +EvaluationErrorPrinter implements TokenizerEvaluationMonitor { + + /** + * Creates a listener that will print to System.err + */ + public DetokenEvaluationErrorListener() { +super(System.err); + } + + /** + * Creates a listener that will print to a given {@link OutputStream} + */ + public DetokenEvaluationErrorListener(OutputStream outputStream) { +super(outputStream); + } + + @Override + public void missclassified(TokenSample reference, TokenSample prediction) { +printError(reference, prediction); + } + +} diff --git a/opennlp-tools/src/main/java/opennlp/tools/tokenize/DetokenizerEvaluator.java b/opennlp-tools/src/main/java/opennlp/tools/tokenize/DetokenizerEvaluator.java new file mode 100644 index 0..7d9df4fc6 --- /dev/null +++ b/opennlp-tools/src/main/java/opennlp/tools/tokenize/DetokenizerEvaluator.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package opennlp.tools.tokenize; + + +import java.util.ArrayList; + +import opennlp.tools.cmdline.tokenizer.DetokenEvaluationErrorListener; +import opennlp.tools.util.Span; +import opennlp.tools.util.eval.Evaluator; +import opennlp.tools.util.eval.FMeasure; + +/** + * The {@link DetokenizerEvaluator} measures the performance of + * the given {@link Detokenizer} with the provided reference + * {@link TokenSample}s. + * + * @see DetokenizerEvaluator + * @see Detokenizer + * @see TokenSample + */ + +public class DetokenizerEvaluator extends Evaluator { + private FMeasure fmeasure = new FMeasure(); + + /** + * The {@link Detokenizer} used to create the + * predicted tokens. + */ + private Detokenizer detokenizer; + + /** + * Initializes the current instance with the + * given {@link Detokenizer}. + * + * @param detokenizer the {@link Detokenizer} to evaluate. + * @param listeners evaluation sample listeners + */ + public DetokenizerEvaluator(D
[jira] [Commented] (OPENNLP-941) Add eval support to detokenizer
[ https://issues.apache.org/jira/browse/OPENNLP-941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16433798#comment-16433798 ] ASF GitHub Bot commented on OPENNLP-941: skrcode commented on issue #308: [OPENNLP-941] Added eval support to detokenizer URL: https://github.com/apache/opennlp/pull/308#issuecomment-380428351 @kottmann Done ! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add eval support to detokenizer > --- > > Key: OPENNLP-941 > URL: https://issues.apache.org/jira/browse/OPENNLP-941 > Project: OpenNLP > Issue Type: Improvement > Components: Tokenizer >Reporter: Joern Kottmann >Priority: Major > Labels: help-wanted > > It would be nice to be able to evaluate a detokenizer on tokenizer training > data. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENNLP-941) Add eval support to detokenizer
[ https://issues.apache.org/jira/browse/OPENNLP-941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16433616#comment-16433616 ] ASF GitHub Bot commented on OPENNLP-941: kottmann commented on issue #308: [OPENNLP-941] Added eval support to detokenizer URL: https://github.com/apache/opennlp/pull/308#issuecomment-38032 Sorry the delays here! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add eval support to detokenizer > --- > > Key: OPENNLP-941 > URL: https://issues.apache.org/jira/browse/OPENNLP-941 > Project: OpenNLP > Issue Type: Improvement > Components: Tokenizer >Reporter: Joern Kottmann >Priority: Major > Labels: help-wanted > > It would be nice to be able to evaluate a detokenizer on tokenizer training > data. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENNLP-941) Add eval support to detokenizer
[ https://issues.apache.org/jira/browse/OPENNLP-941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16433614#comment-16433614 ] ASF GitHub Bot commented on OPENNLP-941: kottmann commented on issue #308: [OPENNLP-941] Added eval support to detokenizer URL: https://github.com/apache/opennlp/pull/308#issuecomment-380388251 - Could you please rebase this and solve the conflicts. - And squash the commits. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add eval support to detokenizer > --- > > Key: OPENNLP-941 > URL: https://issues.apache.org/jira/browse/OPENNLP-941 > Project: OpenNLP > Issue Type: Improvement > Components: Tokenizer >Reporter: Joern Kottmann >Priority: Major > Labels: help-wanted > > It would be nice to be able to evaluate a detokenizer on tokenizer training > data. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (OPENNLP-941) Add eval support to detokenizer
[ https://issues.apache.org/jira/browse/OPENNLP-941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16405081#comment-16405081 ] ASF GitHub Bot commented on OPENNLP-941: skrcode opened a new pull request #308: [OPENNLP-941] Added eval support to detokenizer URL: https://github.com/apache/opennlp/pull/308 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: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Does your PR title start with OPENNLP- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn clean install at the root opennlp folder? - [ ] 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 travis-ci for build issues and submit an update to your PR as soon as possible. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add eval support to detokenizer > --- > > Key: OPENNLP-941 > URL: https://issues.apache.org/jira/browse/OPENNLP-941 > Project: OpenNLP > Issue Type: Improvement > Components: Tokenizer >Reporter: Joern Kottmann >Priority: Major > Labels: help-wanted > > It would be nice to be able to evaluate a detokenizer on tokenizer training > data. -- This message was sent by Atlassian JIRA (v7.6.3#76005)