From 3465d2a08f3cc8c3ebf27797d314f2255f0b32f3 Mon Sep 17 00:00:00 2001 From: ChenXin Date: Sun, 28 Apr 2019 20:13:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=20dataset=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86get=5Ffield=5Fnames?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastNLP/core/dataset.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fastNLP/core/dataset.py b/fastNLP/core/dataset.py index 00f8ce04..82288221 100644 --- a/fastNLP/core/dataset.py +++ b/fastNLP/core/dataset.py @@ -501,6 +501,14 @@ class DataSet(object): """ return self.field_arrays + + def get_field_names(self)->list: + """返回一个list,包含所有 field 的名字 + + :return: list: + """ + return sorted(self.field_arrays.keys()) + def get_length(self): """获取DataSet的元素数量