Skip to content

Commit

Permalink
Merge pull request mchaput#19 from Sygil-Dev/sweep/jieba-tests
Browse files Browse the repository at this point in the history
Add unit tests for 'jieba' dependency
  • Loading branch information
ZeroCool940711 authored Jan 3, 2024
2 parents f8e9a1c + 2b5b560 commit ad9dc66
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_jieba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import jieba
import pytest


def test_jieba_segmentation():
text = "我爱自然语言处理"
seg_list = jieba.cut(text, cut_all=False)
assert list(seg_list) == ['我', '爱', '自然语言处理']

def test_jieba_import():
assert jieba is not None

def test_jieba_tokenization():
text = "我爱自然语言处理"
tokens = jieba.tokenize(text)
assert list(tokens) == [('我', 0, 1), ('爱', 1, 2), ('自然语言处理', 2, 8)]

0 comments on commit ad9dc66

Please sign in to comment.