mawiesne commented on code in PR #562:
URL: https://github.com/apache/opennlp/pull/562#discussion_r1422554680
##########
opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerME.java:
##########
@@ -258,4 +274,24 @@ public boolean useAlphaNumericOptimization() {
return useAlphaNumericOptimization;
}
+ /**
+ * Allows checking a token abbreviation candidate for acceptability.
+ *
+ * <p>Note: The implementation always returns {@code false} if no
+ * abbreviation dictionary is available for the underlying model.</p>
+ *
+ * @param s the {@link CharSequence} in which the break occurred.
+ * @return {@code true} if the candidate is acceptable, {@code false}
otherwise.
+ */
+ protected boolean isAcceptableAbbreviation(CharSequence s) {
+ if (abbDict == null)
+ return false;
+
+ for (String abb : abbDict.asStringSet()) {
Review Comment:
Thx @jzonthemtn for the pointer. It can be used to keep the code cleaner.
Will push an improved version.
--
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]