krickert commented on code in PR #1105:
URL: https://github.com/apache/opennlp/pull/1105#discussion_r3473240361


##########
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 `LineLength` limit in `checkstyle.xml` is 110, and the longest Javadoc 
line in this file is 102 characters, so every line is within the limit — 
`checkstyle:check` passes in the full build. No change needed.



-- 
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]

Reply via email to