Use the whole alphabet and Greek alphabet for variables
The variable pool was 14 Latin letters plus 10 Greek ones, so w, v, q, g, epsilon, rho, tau, ... were unknown to the model and got spelled out letter by letter. 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 free for dx and future derivatives. Fixes #4
This commit is contained in:
1 parent
473a9358d6
commit
0651c7533e
3 files changed
+50
-4
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user