You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by "rzo1 (via GitHub)" <gi...@apache.org> on 2026/10/03 20:31:33 UTC
Re: [PR] (fix) GH-1379: Morpheme accepts a surface that does not match its span (opennlp)
rzo1 commented on code in PR #1384:
URL: https://github.com/apache/opennlp/pull/1384#discussion_r4174736487
##########
opennlp-core/opennlp-runtime/src/main/java/opennlp/tools/tokenize/lattice/Morpheme.java:
##########
@@ -46,19 +48,31 @@ public record Morpheme(Span span, String surface, List<String> features,
/**
* Validates the morpheme.
*
- * @throws IllegalArgumentException Thrown if {@code span}, {@code surface}, or
- * {@code features} is {@code null}, or {@code surface} is empty.
+ * @throws IllegalArgumentException Thrown if {@code span}, {@code surface},
+ * {@code features}, or a feature is {@code null}; {@code surface} is empty;
+ * or the surface and span lengths differ.
*/
public Morpheme {
if (span == null) {
throw new IllegalArgumentException("span must not be null");
}
- if (surface == null || surface.isEmpty()) {
- throw new IllegalArgumentException("surface must not be null or empty");
+ if (surface == null) {
Review Comment:
Use ArgumentsChecker
--
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: commits-unsubscribe@opennlp.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org