UniTok 3.1.4__tar.gz → 3.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {UniTok-3.1.4 → UniTok-3.1.6}/PKG-INFO +3 -1
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/column.py +1 -1
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/bert_tok.py +0 -4
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/number_tok.py +1 -1
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/tok.py +3 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/vocab.py +9 -4
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok.egg-info/PKG-INFO +3 -1
- {UniTok-3.1.4 → UniTok-3.1.6}/setup.py +1 -1
- {UniTok-3.1.4 → UniTok-3.1.6}/README.md +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/__init__.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/analysis/__init__.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/analysis/lengths.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/analysis/plot.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/cols.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/global_setting.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/meta.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/__init__.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/ent_tok.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/id_tok.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/seq_tok.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/tok/split_tok.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/unidep.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/unitok.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok/vocabs.py +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok.egg-info/SOURCES.txt +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok.egg-info/dependency_links.txt +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok.egg-info/requires.txt +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/UniTok.egg-info/top_level.txt +0 -0
- {UniTok-3.1.4 → UniTok-3.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: UniTok
|
3
|
-
Version: 3.1.
|
3
|
+
Version: 3.1.6
|
4
4
|
Summary: Unified Tokenizer
|
5
5
|
Home-page: https://github.com/Jyonn/UnifiedTokenizer
|
6
6
|
Author: Jyonn Liu
|
@@ -138,3 +138,5 @@ news_dep = UniDep('data/news') # 读取分词结果
|
|
138
138
|
print(len(news_dep))
|
139
139
|
print(news_dep[0])
|
140
140
|
```
|
141
|
+
|
142
|
+
|
@@ -65,7 +65,7 @@ class Column:
|
|
65
65
|
pad=kwargs.get('pad', 0),
|
66
66
|
)
|
67
67
|
|
68
|
-
self.list = bool(operator) or tok.return_list is True # whether the column is a list-element column
|
68
|
+
self.list = bool(self.operator) or tok.return_list is True # whether the column is a list-element column
|
69
69
|
|
70
70
|
self.data = []
|
71
71
|
self.lengths = Lengths()
|
@@ -40,5 +40,5 @@ class NumberTok(BaseTok):
|
|
40
40
|
if o >= len(self.vocab):
|
41
41
|
if self.vocab_size is not None:
|
42
42
|
raise ValueError('vocab_size is {}, but {} is given'.format(self.vocab_size, o))
|
43
|
-
self.vocab.extend([str(i) for i in range(len(self.vocab), o + 1)])
|
43
|
+
self.vocab.extend([str(i) for i in range(len(self.vocab), o + 1)], count=False)
|
44
44
|
return obj
|
@@ -44,6 +44,9 @@ class BaseTok:
|
|
44
44
|
wrapped tokenize method, filter out unknown token
|
45
45
|
"""
|
46
46
|
ids = self.t(obj)
|
47
|
+
|
48
|
+
self.vocab.counts(ids if isinstance(ids, list) else [ids])
|
49
|
+
|
47
50
|
if isinstance(ids, list):
|
48
51
|
return list(filter(lambda index: index > -1, ids))
|
49
52
|
if ids == -1:
|
@@ -63,12 +63,17 @@ class Vocab:
|
|
63
63
|
|
64
64
|
def append(self, obj):
|
65
65
|
index = self._append(obj)
|
66
|
-
self.count(index)
|
67
66
|
return index
|
68
67
|
|
69
|
-
def
|
70
|
-
if self._count_mode
|
71
|
-
|
68
|
+
def counts(self, indexes):
|
69
|
+
if self._count_mode:
|
70
|
+
for index in indexes:
|
71
|
+
if index > -1:
|
72
|
+
self._counter[index] = self._counter.get(index, 0) + 1
|
73
|
+
|
74
|
+
# def count(self, index):
|
75
|
+
# if self._count_mode and index > -1:
|
76
|
+
# self._counter[index] = self._counter.get(index, 0) + 1
|
72
77
|
|
73
78
|
def _append(self, obj):
|
74
79
|
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: UniTok
|
3
|
-
Version: 3.1.
|
3
|
+
Version: 3.1.6
|
4
4
|
Summary: Unified Tokenizer
|
5
5
|
Home-page: https://github.com/Jyonn/UnifiedTokenizer
|
6
6
|
Author: Jyonn Liu
|
@@ -138,3 +138,5 @@ news_dep = UniDep('data/news') # 读取分词结果
|
|
138
138
|
print(len(news_dep))
|
139
139
|
print(news_dep[0])
|
140
140
|
```
|
141
|
+
|
142
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|