Copilot commented on code in PR #1105: URL: https://github.com/apache/opennlp/pull/1105#discussion_r3449582502
########## opennlp-api/src/main/java/opennlp/tools/namefind/OffsetMappingNameFinder.java: ########## @@ -0,0 +1,44 @@ +/* + * 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.namefind; + +import opennlp.tools.util.Span; + +/** + * A {@link TokenNameFinder} that can additionally report detected spans in the character coordinates + * of the original input, mapping back through any text normalization applied before detection. + * + * <p>An implementation that normalizes input before detection (for example an ONNX model that folds + * Unicode whitespace or dashes) returns spans from {@link #find(String[])} in the coordinates of the + * normalized text, which no longer line up with the caller's input when a fold changes the length. + * {@link #findInOriginal(String[])} maps those spans back to original-input coordinates. This is a + * separate capability interface rather than a method on {@link TokenNameFinder} because the classic + * contract reports token-index spans, for which an original-character mapping is not meaningful; an + * interface-typed caller tests for the capability ({@code finder instanceof OffsetMappingNameFinder}) + * instead of depending on a concrete implementation.</p> + */ Review Comment: The interface Javadoc has multiple lines exceeding the 110-char Checkstyle `LineLength` limit (e.g., the first summary line). Please wrap the Javadoc lines to avoid build failures. ########## opennlp-core/opennlp-ml/opennlp-dl/src/main/java/opennlp/dl/namefinder/NameFinderDL.java: ########## @@ -41,9 +40,12 @@ import opennlp.dl.InferenceOptions; import opennlp.dl.Tokens; import opennlp.tools.commons.ThreadSafe; +import opennlp.tools.namefind.OffsetMappingNameFinder; import opennlp.tools.namefind.TokenNameFinder; import opennlp.tools.sentdetect.SentenceDetector; Review Comment: `TokenNameFinder` is imported but no longer referenced in code (only in Javadoc). With the repo's Checkstyle `UnusedImports` rule, this will fail the build; remove the unused import (and consider fully-qualifying the Javadoc links if you still want them to resolve). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
