OPENNLP-1975: Regex removal (9/10): Correct the output of TokenSampleStream, ParserTool, ConlluStream, DownloadUtil and FeatureGeneratorUtil - #1314
Draft
rzo1 wants to merge 1 commit into
Conversation
This was referenced Sep 18, 2026
rzo1
marked this pull request as draft
September 18, 2026 10:12
rzo1
force-pushed
the
OPENNLP-1975-regex-removal-output-fixes
branch
from
September 18, 2026 11:17
a6fd65a to
596cf58
Compare
rzo1
force-pushed
the
OPENNLP-1928-regex-removal-scans
branch
from
September 18, 2026 11:17
1d1b66a to
33581d0
Compare
rzo1
force-pushed
the
OPENNLP-1975-regex-removal-output-fixes
branch
2 times, most recently
from
September 18, 2026 13:29
4b26964 to
6297884
Compare
TokenSampleStream splits tokens on Unicode whitespace and treats letters and digits of any script as words, ParserTool separates brackets that follow each other, ConlluStream rejects malformed multiword ids with an InvalidFormatException, DownloadUtil reports a blank checksum file and FeatureGeneratorUtil's cp class requires one capital and one period. Each corrected case is pinned by a test and documented in the manual.
rzo1
force-pushed
the
OPENNLP-1975-regex-removal-output-fixes
branch
from
September 18, 2026 17:07
6297884 to
bbcce4a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 9 of the regex removal (OPENNLP-1926). Split out of #1275. Based on main; part 1 (#1311, OPENNLP-1928) is merged.
These sites lose their regular expressions like the rest of the epic, but the scans follow what the code was meant to do instead of copying the regex quirks, so the output changes. Each corrected case is pinned by a test.
Behavior changes
TokenSampleStream (English). Tokens are split on runs of Unicode White_Space (
StringUtil.splitOnUnicodeWhitespace), independent of the whitespace mode; before,split("\\s+")split on ASCII whitespace only. A leading space no longer yields an empty first token with the span (0,0). A line without a token resets the open-quote state. A token holding a letter or digit of any script is a word; before,[A-Za-z0-9]made non-ASCII words attach to the previous token as punctuation.ParserTool. Brackets that follow each other are each separated:
a))bgivesa ) ) b, beforea ) )b. A line without a bracket is returned unchanged. Whitespace follows the toolkit whitespace mode. Documented in the parser chapter.ConlluStream. A multiword token id must be two runs of ASCII digits without a leading zero, joined by one hyphen, with the end not smaller than the start. Any other id fails with an
InvalidFormatExceptionnaming the id. Before,3-threwArrayIndexOutOfBoundsException,-4and3--4threwNumberFormatException, and4-3and1-2-3were read without an error. Thetext_xxlanguage code is read with a scan, same output. New CoNLL-U section in the corpora chapter.DownloadUtil. A blank checksum file is an
IOExceptionsaying so; before, the model was rejected with "Expected: null". The index page links are read with a scan, same output.FeatureGeneratorUtil. The
cpclass needs one capital and one period and no other character.A.\nwascpand isicnow. No other token changes class.Before merge
TokenSampleStream.Commits by @krickert from #1275, regrouped.