Skip to content

Commit

Permalink
fix(crafter): change class name
Browse files Browse the repository at this point in the history
  • Loading branch information
xiong-ma committed Apr 25, 2020
1 parent c63b4cd commit fa04366
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions jina/executors/crafters/nlp/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def craft(self, raw_bytes: bytes, doc_id: int, *args, **kwargs) -> List[Dict]:
dict(doc_id=doc_id, text=s, offset=idx, weight=1.0, length=len(sents)))
return results

class JiebaCrafter(BaseSegmenter):
class JiebaSegmenter(BaseSegmenter):
"""
:class:`JiebaCrafter` split the chinese text on the doc-level into words on the chunk-level with `jieba`.
:class:`JiebaSegmenter` split the chinese text on the doc-level into words on the chunk-level with `jieba`.
"""

def __init__(self, mode: str='accurate', *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions tests/executors/crafters/nlp/split.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from tests import JinaTestCase
from jina.executors.crafters.nlp.split import Sentencizer, JiebaCrafter
from jina.executors.crafters.nlp.split import Sentencizer, JiebaSegmenter


class MyTestCase(JinaTestCase):
Expand All @@ -17,7 +17,7 @@ def test_sentencier_cn(self):
self.assertEqual(len(crafted_chunk_list), 2)

def test_jieba_crafter(self):
jieba_crafter = JiebaCrafter(mode='accurate')
jieba_crafter = JiebaSegmenter(mode='accurate')
raw_bytes = '今天是个大晴天!安迪回来以后,我们准备去动物园。'.encode('utf-8')
crafted_chunk_list = jieba_crafter.craft(raw_bytes, 0)
self.assertEqual(len(crafted_chunk_list), 14)
Expand Down

0 comments on commit fa04366

Please sign in to comment.