Skip to content
Open
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
3 changes: 2 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from tqdm import tqdm
import time
from datetime import timedelta
import jieba


MAX_VOCAB_SIZE = 10000 # 词表长度限制
Expand All @@ -30,7 +31,7 @@ def build_vocab(file_path, tokenizer, max_size, min_freq):

def build_dataset(config, ues_word):
if ues_word:
tokenizer = lambda x: x.split(' ') # 以空格隔开,word-level
tokenizer = lambda x: list(jieba.cut(x))
else:
tokenizer = lambda x: [y for y in x] # char-level
if os.path.exists(config.vocab_path):
Expand Down
3 changes: 2 additions & 1 deletion utils_fasttext.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from tqdm import tqdm
import time
from datetime import timedelta
import jieba


MAX_VOCAB_SIZE = 10000
Expand All @@ -30,7 +31,7 @@ def build_vocab(file_path, tokenizer, max_size, min_freq):

def build_dataset(config, ues_word):
if ues_word:
tokenizer = lambda x: x.split(' ') # 以空格隔开,word-level
tokenizer = lambda x: list(jieba.cut(x))
else:
tokenizer = lambda x: [y for y in x] # char-level
if os.path.exists(config.vocab_path):
Expand Down