Skip to content

Add nfc nfd comparison scripts for opus100#863

Open
klei22 wants to merge 2 commits into
ReaLLMASIC:masterfrom
klei22:add-nfc-nfd-comparison-scripts-for-opus100
Open

Add nfc nfd comparison scripts for opus100#863
klei22 wants to merge 2 commits into
ReaLLMASIC:masterfrom
klei22:add-nfc-nfd-comparison-scripts-for-opus100

Conversation

@klei22

@klei22 klei22 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds tooling under data/opus-100/ to generate NFC/NFD dataset splits, convert Hangul NFC→NFD (Hangul-only), run tokenization comparisons, and inspect resulting vocabularies; also updates the KoCommercial dataset downloader to use a single Parquet shard URL.

Changes:

  • Add Hangul-only NFC→NFD conversion script and dataset split helper for Opus100.
  • Add scripts for running NFC vs NFD tokenization/vocab comparisons (including a Textual-based TUI for meta.pkl inspection).
  • Simplify KoCommercial Parquet shard list from 8 URLs to 1 URL.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
data/opus-100/prepare_nfc_and_nfd_dataset_splits.sh Creates 90/10 splits and generates NFD versions for comparison.
data/opus-100/hangul_nfc_to_nfd.py Implements Hangul-only NFC→NFD conversion with file/stdin modes.
data/opus-100/compare_nfc_nfd.sh Automates running prepare.py across NFC/NFD and vocab sizes.
data/opus-100/compare_meta_vocab_tui.py Adds a Textual TUI to compare vocab entries from two meta.pkl files.
data/ko_commercial/get_dataset.py Updates KoCommercial download list to a single Parquet shard.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +18
#!/bin/bash

FILE="$1"

NFC_90="p90_nfc.txt"
NFC_10="p10_nfc.txt"

NFD_90="p90_nfd.txt"
NFD_10="p10_nfd.txt"

TOTAL=$(wc -l < "$FILE")
PCT=$((TOTAL * 10 / 100))
head -n -$PCT "$FILE" > "$NFC_90"
tail -n $PCT "$FILE" > "$NFC_10"

python3 hangul_nfc_to_nfd.py "$NFC_90" "$NFD_90"
python3 hangul_nfc_to_nfd.py "$NFC_10" "$NFD_10"

Comment on lines +1 to +12
#!/bin/bash

# bash prepare_nfc_and_nfd_dataset_splits.sh input.txt

for tokenization in "char_bpe"; do
for type in "nfc" "nfd"; do
for vocab_size in "2000" "3000" "4000" "5000"; do
python3 prepare.py -t p90_"$type".txt -v p10_"$type".txt --method "$tokenization" --vocab_size "$vocab_size" -s -S "$type"_"$vocab_size" -T
mv char_bpe_vocab.json "${tokenization}_${type}_${vocab_size}/"
done
done
done
Comment on lines +71 to +74
try:
with os.fdopen(fd, "wb") as tmp:
tmp.write(converted)
os.replace(tmp_name, path)
Comment on lines +2 to +6
"""compare_meta_vocab_tui.py

Textual TUI to compare vocabularies stored in two meta.pkl files.
Supports sorting both vocab lists by byte length or frequency.
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants