Skip to content

Instantly share code, notes, and snippets.

@Sirsirious
Last active February 4, 2020 18:52
Show Gist options
  • Save Sirsirious/15fccfd6112e6360b6cd38b6d9e71023 to your computer and use it in GitHub Desktop.
Save Sirsirious/15fccfd6112e6360b6cd38b6d9e71023 to your computer and use it in GitHub Desktop.
How to make our DummySentencizer iterable.
def __iter__(self):
return self
def __next__(self):
if self._index < len(self.sentences):
result = self.sentences[self._index]
self._index+=1
return result
raise StopIteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment