Browse Source

Merge branch 'feature/preprocess' of https://github.com/fastnlp/fastNLP

tags/v0.1.0
FengZiYjun 6 years ago
parent
commit
eab9473bd4
2 changed files with 3 additions and 1 deletions
  1. +2
    -1
      fastNLP/action/metrics.py
  2. +1
    -0
      fastNLP/loader/preprocess.py

+ 2
- 1
fastNLP/action/metrics.py View File

@@ -1,7 +1,8 @@
""" """
To do: To do:
设计评判结果的各种指标。如果涉及向量,使用numpy。
参考http://scikit-learn.org/stable/modules/classes.html#classification-metrics 参考http://scikit-learn.org/stable/modules/classes.html#classification-metrics
建议是每种metric写成一个函数 (由Tester的evaluate函数调用) 建议是每种metric写成一个函数 (由Tester的evaluate函数调用)
参数表里只需考虑基本的参数即可,可以没有像它那么多的参数配置 参数表里只需考虑基本的参数即可,可以没有像它那么多的参数配置
""" """

+ 1
- 0
fastNLP/loader/preprocess.py View File

@@ -66,6 +66,7 @@ class POSPreprocess(BasePreprocess):
else: else:
with open(os.path.join(self.pickle_path, "class2id.pkl"), "wb") as f: with open(os.path.join(self.pickle_path, "class2id.pkl"), "wb") as f:
_pickle.dump(self.label2index, f) _pickle.dump(self.label2index, f)
#something will be wrong if word2id.pkl is found but class2id.pkl is not found
if not self.pickle_exist("id2word.pkl"): if not self.pickle_exist("id2word.pkl"):
index2word = self.build_reverse_dict(self.word2index) index2word = self.build_reverse_dict(self.word2index)


Loading…
Cancel
Save