From 5a000eb325b79b6cd4387a5b46fb94dfe9654de8 Mon Sep 17 00:00:00 2001 From: Leonard Lausen Date: Mon, 3 Jun 2019 10:22:02 +0200 Subject: [PATCH] Explicitly test filter_fn against None --- src/gluonnlp/data/dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gluonnlp/data/dataset.py b/src/gluonnlp/data/dataset.py index 6189a97378..6a7a2735fa 100644 --- a/src/gluonnlp/data/dataset.py +++ b/src/gluonnlp/data/dataset.py @@ -192,7 +192,7 @@ def __init__(self, filename, encoding='utf8', filter_fn=None): for idx, line in enumerate(in_file): line = line.strip() # check if the line should be filtered out - if filter_fn and not filter_fn(idx, line): + if filter_fn is not None and not filter_fn(idx, line): continue lines.append(line) super(TextLineDataset, self).__init__(lines)