Browse Source

Merge pull request #264 from Gosicfly/master

出现非法格式catch住的时候,应该将sample清空
tags/v0.5.5
Yunfan Shao GitHub 5 years ago
parent
commit
1b377ef851
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: except Exception as e:
if dropna: if dropna:
logger.warning('Invalid instance which ends at line: {} has been dropped.'.format(line_idx)) logger.warning('Invalid instance which ends at line: {} has been dropped.'.format(line_idx))
sample = []
continue continue
raise ValueError('Invalid instance which ends at line: {}'.format(line_idx)) raise ValueError('Invalid instance which ends at line: {}'.format(line_idx))
elif line.startswith('#'): elif line.startswith('#'):


Loading…
Cancel
Save