41 lines
886 B
Plaintext
41 lines
886 B
Plaintext
>>> from sentence_gen import Sentence
|
|
>>> s = Sentence('The time has come')
|
|
>>> s
|
|
Sentence('The time has come')
|
|
>>> list(s)
|
|
['The', 'time', 'has', 'come']
|
|
>>> it = iter(s)
|
|
>>> next(it)
|
|
'The'
|
|
>>> next(it)
|
|
'time'
|
|
>>> next(it)
|
|
'has'
|
|
>>> next(it)
|
|
'come'
|
|
>>> next(it)
|
|
Traceback (most recent call last):
|
|
...
|
|
StopIteration
|
|
|
|
>>> s = Sentence('"The time has come," the Walrus said,')
|
|
>>> s
|
|
Sentence('"The time ha... Walrus said,')
|
|
>>> list(s)
|
|
['The', 'time', 'has', 'come', 'the', 'Walrus', 'said']
|
|
|
|
|
|
>>> s = Sentence('''"The time has come," the Walrus said,
|
|
... "To talk of many things:"''')
|
|
>>> s
|
|
Sentence('"The time ha...many things:"')
|
|
>>> list(s)
|
|
['The', 'time', 'has', 'come', 'the', 'Walrus', 'said', 'To', 'talk', 'of', 'many', 'things']
|
|
|
|
|
|
>>> s = Sentence('Agora vou-me. Ou me vão?')
|
|
>>> s
|
|
Sentence('Agora vou-me. Ou me vão?')
|
|
>>> list(s)
|
|
['Agora', 'vou', 'me', 'Ou', 'me', 'vão']
|