updated contents from Atlas repo

This commit is contained in:
Luciano Ramalho
2014-10-14 14:26:55 -03:00
parent 40688c038d
commit 981d5bc473
157 changed files with 71134 additions and 1 deletions

21
sequences/sentence.py Normal file
View File

@@ -0,0 +1,21 @@
"""
Sentence: access words by index
"""
import re
import reprlib
RE_WORD = re.compile('\w+')
class Sentence:
def __init__(self, text):
self.text = text
self.words = RE_WORD.findall(text) #<1>
def __getitem__(self, index):
return self.words[index] #<2>
def __repr__(self):
return 'Sentence(%s)' % reprlib.repr(self.text) #<3>