Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions EduNLP/Formula/Formula.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ class Formula(object):
"""
The part transform a formula to the parsed abstracted syntax tree.

Attributes
------------
ast
show all ast details
elements
just show elements' id, type, text and role
ast_graph
draw a ast graph
to_str
resetable
return bool

Parameters
----------
formula: str or List[Dict]
Expand All @@ -54,6 +42,17 @@ class Formula(object):
>>> f.elements
[{'id': 0, 'type': 'mathord', 'text': 'x', 'role': None, 'var': 0}]

Attributes
------------
ast
show all ast details
elements
just show elements' id, type, text and role
ast_graph
draw a ast graph
to_str
resetable
return bool
"""
def __init__(self, formula: (str, List[Dict]), variable_standardization=False, const_mathord=None,
init=True, *args, **kwargs):
Expand Down
32 changes: 16 additions & 16 deletions EduNLP/SIF/segment/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ class SepSegment(str):
class SegmentList(object):
"""

Parameters
----------
item
figures:dict

Returns
----------
list
tokenizated item

Examples
--------
>>> test_item = "如图所示,则三角形$ABC$的面积是$\\SIFBlank$。$\\FigureID{1}$"
>>> SegmentList(test_item)
['如图所示,则三角形', 'ABC', '的面积是', '\\\\SIFBlank', '。', \\FigureID{1}]

Attributes
----------
segments
Expand All @@ -98,22 +114,6 @@ class SegmentList(object):
show tag segments
describe
show number of each elements

Parameters
----------
item
figures:dict

Returns
----------
list
tokenizated item

Examples
--------
>>> test_item = "如图所示,则三角形$ABC$的面积是$\\SIFBlank$。$\\FigureID{1}$"
>>> SegmentList(test_item)
['如图所示,则三角形', 'ABC', '的面积是', '\\\\SIFBlank', '。', \\FigureID{1}]
"""
def __init__(self, item, figures: dict = None):
self._segments = []
Expand Down