Repository navigation
fix(dataset): the mojibake repair keeps text that srcML read right - #105
Merged
Merged
Conversation
Step 10 undoes the srcML 1.1.0 mojibake: 1.1.0 reads UTF-8 as Latin-1, so a token holds "café" where the source holds "café". srcML develop (#104) reads UTF-8 right. The repair then changes correct text. Example: the literal u8"// café naïve" in srcML's test_srcml_unit_parse_encoding.cpp became "café naïve". This also moved the walk, because the token became shorter. Step 10 gets no tokenizer identity. blobExec keeps it in the blob map as an opaque digest, and sharded mode keeps none. Thus the gate uses the source file. The repair now runs only when the source does not hold the token text as is. A 1.1.0 token with non-ASCII text never matches strict UTF-8 source, so 1.1.0 data gets the same repair as before. A correct token always matches, so the gate needs no flag and works on mixed data. Measured on the 721-file sweep (/tmp/srcml-pin/out), through process_blame_file: - 1.1.0 tokens: 26 tokens in 10 files repaired, as before. All 10 files now give the same rows as develop (before: 9 of 10). - develop tokens: 0 tokens changed (before: 1).
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.
Problem
Step 10 undoes the srcML 1.1.0 mojibake (#97). srcML 1.1.0 reads UTF-8 as Latin-1, so a token holds
caféwhere the source holdscafé. srcML develop (#104) reads UTF-8 right. After #104, the repair changes correct text. Example: the literalu8"// café naïve"in srcML'stest_srcml_unit_parse_encoding.cppbecomescafé naïve. The token gets shorter, so the walk moves.Step 10 gets no tokenizer identity. blobExec keeps the identity in the blob map as an opaque digest. Sharded mode keeps none. The digest does not name the srcML version.
Change
SourceReader.holds_next,misread_by_srcml). The comparison skips whitespace, as the walk does.DATASET.mddescribes the gate.Not changed
corpus-c100-2026-10) and the repair of 1.1.0 tokens..rsexclusion. The Rust tokenizer reads strict UTF-8 (read_to_string), so it is correct. The gate also protects Rust.Tests
Höas is, and the token stays as is.caféand the literalu8"café". Develop tokens and 1.1.0 tokens give the same rows and positions.holds_nextunit tests.devenv shell -- pytest -q --junitxml=...: 82 passed (74 before), 0 failures, 0 errors.process_blame_file. With 1.1.0 tokens, the repair changes 26 tokens in 10 files, as before, and all 10 files now give the same rows as develop (before: 9). With develop tokens, the repair changes 0 tokens (before: 1).