-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop_list.py
50 lines (41 loc) · 1.28 KB
/
stop_list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'''
------------------------------------------------------------
Created on Oct 2015 by
Name = Gerardo Roa Dabike
University ID = acp15gr
Regitration Number = 150105918
------------------------------------------------------------
'''
from stemmator import Stemmator
import string
class StopList():
'''
This class load a stoplist file and return a SET with the list
'''
def __init__(self, file,stem):
'''
Constructor
'''
self.__stem = stem
self.stops=set()
self.__addStringPuntuation()
if file != None:
self.__readStopList(file)
def __addStringPuntuation(self):
for s in string.punctuation:
self.stops.add(s)
def __readStopList(self,file):
'''
Method that load the stoplist into
the stop SET
'''
print 'Loading StopList...'
f = open(file,'r')
for line in f:
self.stops.add(line.strip())
#self.stops.add(Stemmator(line.strip(),self.__stem).toStem())
print 'StopList Loaded...'
if __name__=='__main__':
stop = StopList('../files/stop_list.txt')
for s in stop.stops:
print s