2
special_chars = (" ", "\n", ".", ":", ",", "'",
3
'"', "(", ")", "{", "}", "[", "]")
6
i1 = b.get_start_iter()
13
while i2.get_offset() <> i1.get_offset():
20
def buffer_wordlist(b):
21
i1 = b.get_start_iter()
28
i1, i2 = b.get_bounds()
30
text = b.get_text(i1, i2)
32
text = text.replace("\n", " ")
33
text = text.replace(",", " ")
34
text = text.replace(".", " ")
35
text = text.replace(":", " ")
36
text = text.replace("(", " ")
37
text = text.replace(")", " ")
38
text = text.replace("'", " ")
39
text = text.replace('"', " ")
43
i1 = b.get_start_iter()
48
while i2.get_offset() <> i1.get_offset():
52
word = b.get_text(i1, i2).strip()
64
def text_wordlist(text):
66
for i in special_chars:
67
text = text.replace(i, " ")
70
wl = [x for x in wl if x != '']
74
if __name__ == "__main__":
78
print text_wordlist("veo un marciano sentado en el ala de un vuelo de taca en un dia como el de hoy")