EduNLP.Formula

EduNLP.Formula.ast.ast(formula: (<class 'str'>, typing.List[typing.Dict]), index=0, forest_begin=0, father_tree=None, is_str=False)[source]

The origin code author is https://github.com/hxwujinze

Parameters
  • formula (str or List[Dict]) – 公式字符串或通过katex解析得到的结构体

  • index (int) – 本子树在树上的位置

  • forest_begin (int) – 本树在森林中的起始位置

  • father_tree (List[Dict]) – 父亲树

  • is_str (bool) –

Returns

  • tree (List[Dict]) – 重新解析形成的特征树

  • todo (finish all types)

Notes

Some functions are not supportd in katex e.g.,

  1. tag
    • \begin{equation} \tag{tagName} F=ma \end{equation}

    • \begin{align} \tag{1} y=x+z \end{align}

    • \tag*{hi} x+y^{2x}

  2. dddot
    • \frac{ \dddot y }{ x }

For more information, refer to katex support table

EduNLP.Formula.ast.get_edges(forest)[source]

构造边集合

Parameters

forest (List[Dict]) – 森林

Returns

edges – 边集合

Return type

list of tuple(src,dst,type)

建森林

Parameters

forest (List[Dict]) –

Returns

trees

Return type

List[Dict]