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
2 changes: 2 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@

[Meikai Bao](https://github.com/BAOOOOOM)

[Yuting Ning](https://github.com/nnnyt)


The stared contributors are the corresponding authors.
6 changes: 6 additions & 0 deletions EduNLP/Tokenizer/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class TextTokenizer(Tokenizer):
>>> tokens = tokenizer(items)
>>> next(tokens)[:10]
['公式', '[FORMULA]', '如图', '[FIGURE]', 'x', ',', 'y', '约束条件', '公式', '[FORMULA]']
>>> items = ["$\\SIFTag{stem_begin}$若复数$z=1+2 i+i^{3}$,则$|z|=$$\\SIFTag{stem_end}$\
... $\\SIFTag{options_begin}$$\\SIFTag{list_0}$0$\\SIFTag{list_1}$1$\\SIFTag{list_2}$$\\sqrt{2}$\
... $\\SIFTag{list_3}$2$\\SIFTag{options_end}$"]
>>> tokens = tokenizer(items)
>>> next(tokens)[:10]
['[TAG]', '复数', 'z', '=', '1', '+', '2', 'i', '+', 'i']
"""

def __init__(self, *args, **kwargs):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_sif/test_tokenization.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest
from EduNLP.SIF.constants import Symbol
from EduNLP.SIF.segment.segment import SegmentList
from EduNLP.SIF.segment.segment import SegmentList, LatexFormulaSegment
from EduNLP.SIF.tokenization import text
from EduNLP.SIF.tokenization import formula
from EduNLP.SIF.tokenization.tokenization import TokenList
Expand Down Expand Up @@ -32,3 +32,5 @@ def test_tokenization():

with pytest.raises(TypeError):
tl.append("[Unknown]")

tl.append(LatexFormulaSegment('x+y'), False)