Browse Source

出现非法格式catch住的时候,应该将sample清空

出现非法格式catch住的时候,应该将sample清空,不然会一直报warning,sample也会一直累积新的内容得不到正确的更新。
tags/v0.5.5
Gosicfly GitHub 5 years ago
parent
commit
baf009fe5c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions
  1. +1
    -0
      fastNLP/io/file_reader.py

+ 1
- 0
fastNLP/io/file_reader.py View File

@@ -117,6 +117,7 @@ def _read_conll(path, encoding='utf-8', indexes=None, dropna=True):
except Exception as e:
if dropna:
logger.warning('Invalid instance which ends at line: {} has been dropped.'.format(line_idx))
sample = []
continue
raise ValueError('Invalid instance which ends at line: {}'.format(line_idx))
elif line.startswith('#'):


Loading…
Cancel
Save