<jupyter_start><jupyter_text>formula<jupyter_code>import matplotlib.pyplot as plt
from EduNLP.Formula import Formula
from EduNLP.Formula import FormulaGroup
from EduNLP.Formula.viz import ForestPlotter

Formula("x^2 + 1 = y")
f = Formula("x^2 + 1 = y", variable_standardization=True)
f.ast.nodes
f.ast.edges
ForestPlotter().export(
    f.ast, root_list=[node["val"]["id"] for node in f.element if node["structure"]["father"] is None],
)
plt.show()
f.ast.edges
f.variable_standardization()
fs = FormulaGroup([
    "x^2 = y",
    "x^3 = y^2",
    "x + y = \pi"
])
fs
fs.variable_standardization()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15047021943573669, 'fraction_numerical': 0.0109717868338558, 'mean_word_length': 4.705357142857143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '91488', 'license': 'Apache-2.0', 'n_tokens_mistral': 250, 'n_tokens_neox': 248, 'n_words': 51, 'path': 'examples/formula/formula.ipynb', 'repo_name': 'test2021413/doc_dev', 'size': '638'}