Commit dd35dd2
refactor: Migrate Python tools from bin/ to modern curation/ package (openvanilla#698)
* refactor: Migrate Python tools from bin/ to curation/ package structure
This commit reorganizes 13+ years of Python dictionary tools (2012-2025)
from flat bin/ directory into a modern package structure with centralized
path configuration.
Changes:
- Rename bin/ → bin_legacy/ (preserve all historical tools)
- Create curation/ package with organized submodules:
- builders/: frequency_builder, phrase_deriver
- compilers/: main_compiler, plain_bpmf_compiler, compiler_utils
- validators/: score_validator
- utils/: text_filter
- Move CLI-only scripts to scripts/ directory
- Add centralized path configuration via PROJECT_ROOT, CONFIG_FILE exports
- Move textpool.rc to Data/ root
- Update all documentation (AGENTS.md, README, algorithm.md)
Benefits:
- Modern Python package structure with proper organization
- PEP-8 compliant naming conventions
- Centralized path configuration (no more relative path calculations)
- Installable via pip (pyproject.toml with console script entry points)
- Clear separation: library modules vs CLI scripts
- Zero code loss: all tools preserved in bin_legacy/
Historical Context:
- 2012-08-06: cook.py created (replaced Ruby)
- 2012-09-16: buildFreq.py created (replaced bash)
- 2013-01-21: C version moved to subdirectory
- 2024-03-15: derive_associated_phrases.py added (v2 system)
- 2024-2025: Modern Python practices (argparse, Black, pathlib)
Breaking Changes:
- bin/ paths no longer work (use curation.* imports instead)
- Old: bin/cook.py → New: curation.compilers.main_compiler
- Configuration moved: bin/textpool.rc → textpool.rc
Migration Guide:
See Source/Data/bin_legacy/DEPRECATED.md for complete migration map,
tool history, and usage instructions for legacy tools.
Contributors:
- Mengjuei Hsieh: Original Python implementation (2012-2013)
- Lukhnos Liu: Modernization and v2 features (2024-2025)
- zonble: Encoding audit tool (2024)
Files changed: ~70 files
- Moved: 30+ bin/ files → bin_legacy/
- Created: 12 curation/*.py modules, 3 scripts/*.py, bin_legacy/DEPRECATED.md
- Updated: 5 documentation files, pyproject.toml, Makefile
- Deleted: 1 duplicate file
Build verified: ✅
- data.txt: 158,967 lines
- data-plain-bpmf.txt: 15,189 lines
- associated-phrases-v2.txt: 93,474 lines
* fix: add main() wrapper to frequency_builder
Wrap module-level code in main() function to fix mcbpmf-build-freq
console script entry point defined in pyproject.toml.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: add main() wrapper to plain_bpmf_compiler
Wrap module-level code in main() function to fix mcbpmf-compile-plain
console script entry point defined in pyproject.toml.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: correct main() signature in phrase_deriver
Change main() signature from accepting parameters to no arguments,
moving argument parsing inside the function. This fixes the
mcbpmf-derive-phrases console script entry point compatibility with
setuptools entry point mechanism.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: add main() wrapper to main_compiler
Add main() function wrapper to fix mcbpmf-compile console script
entry point defined in pyproject.toml.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: fix console script names in README
Update console script names to match pyproject.toml entry points
and remove non-entry-point scripts from the list.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: update __init__ docstring to match structure
Remove references to moved scripts (occurrence_counter, data_analyzer,
bpmf_mapper) that are now in scripts/ directory. Update docstring to
reflect actual package organization.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: fix code example in AGENTS.md
Make code example valid and syntactically correct by providing a
complete, working implementation without undefined references.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: simplify DEPRECATED.md maintenance info
Remove timestamp columns (Created, Last Updated) to reduce maintenance
burden. Keep only essential migration mapping information as suggested
by maintainer review.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: remove emojis from markdown files
Remove all emojis from AGENTS.md and DEPRECATED.md to comply with
coding convention defined in AGENTS.md:128 which prohibits emoji use
in documentation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 7e10804 commit dd35dd2
67 files changed
Lines changed: 2720 additions & 941 deletions
File tree
- Source
- Data
- bin_legacy
- C_Version
- Sample_Prep
- disabled
- curation
- builders
- compilers
- curation
- notebooks
- tests
- utils
- validators
- scripts
- term_score_verification
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
165 | 176 | | |
166 | 177 | | |
167 | 178 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
177 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
178 | 410 | | |
179 | 411 | | |
180 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
20 | 52 | | |
21 | 53 | | |
22 | 54 | | |
| |||
File renamed without changes.
File renamed without changes.
File renamed without changes.
0 commit comments