This website works better with JavaScript.
Home
Issues
Pull Requests
Milestones
AI流水线
Repositories
Datasets
Forum
实训
竞赛
大数据
Register
Sign In
hummingbird
/
fastNLP
Not watched
Unwatch
Watch all
Watch but not notify
2
Star
0
Fork
0
Code
Releases
13
Wiki
Activity
Issues
0
Pull Requests
0
Datasets
Model
Cloudbrain
Browse Source
增加vocab的clear方法
tags/v0.4.10
yh
6 years ago
parent
4ac4cda049
commit
aabbdb4df5
1 changed files
with
12 additions
and
1 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+12
-1
fastNLP/core/vocabulary.py
+ 12
- 1
fastNLP/core/vocabulary.py
View File
@@ -322,7 +322,18 @@ class Vocabulary(object):
:return str word: the word
"""
return self.idx2word[idx]
def clear(self):
"""
删除Vocabulary中的词表数据。相当于重新初始化一下。
:return:
"""
self.word_count.clear()
self.word2idx = None
self.idx2word = None
self.rebuild = True
def __getstate__(self):
"""Use to prepare data for pickle.
Write
Preview
Loading…
Cancel
Save