Skip to content

fix stop_words conversion to set #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions torchtext/data/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,10 @@ def __init__(self, sequential=True, use_vocab=True, init_token=None,
self.pad_token = pad_token if self.sequential else None
self.pad_first = pad_first
self.truncate_first = truncate_first
if stop_words is not None:
try:
self.stop_words = set(stop_words)
except TypeError:
raise ValueError("Stop words must be convertible to a set")
else:
self.stop_words = stop_words
self.stop_words = stop_words
try:
self.stop_words = set(stop_words) if stop_words is not None else None
except TypeError:
raise ValueError("Stop words must be convertible to a set")
self.is_target = is_target

def __getstate__(self):
Expand Down