Use the whole alphabet and Greek alphabet for variables (#14)

Variables are now x/y (45%), any lowercase letter except e and d (35%), any lowercase Greek letter except pi and omicron (15%), or a common uppercase letter like N, F, A (5%). e stays a constant and d is kept for dx and future derivatives.

Hand-test exact 41.2% -> 56.9% (trained without #2), variables category 0% -> 87.5%.

Fixes #4

Co-authored-by: Paul Tal <[email protected]>
This commit was merged in pull request #14.
This commit is contained in:
paultal authored and paultal committed 2026-11-27 02:40:48 +02:00
1 parent c661773c30
commit 4fb7726e4b
3 files changed
+50 -4

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
import random
from isotope_typst.ast import GREEK, LATIN, UPPER
from isotope_typst.generate import TreeGen
def test_variable_pool_covers_alphabet():
"""#4: any letter the model never saw gets spelled out letter by letter, so all of them must show up."""
gen = TreeGen(random.Random(0))
seen = {gen.var().name for _ in range(20000)}
assert set(LATIN) | set(GREEK) | set(UPPER) <= seen
assert "d" not in seen and "e" not in seen