(self)
| 23 | self.fname = fname |
| 24 | self.f = open(fname, 'rb') |
| 25 | def __iter__(self): |
| 26 | #This usage of mmap is for a Linux\OS-X |
| 27 | #For Windows replace prot=mmap.PROT_READ with access=mmap.ACCESS_READ |
| 28 | m = mmap.mmap(self.f.fileno(), 0, prot=mmap.PROT_READ) |
| 29 | data = m.readline() |
| 30 | while data: |
| 31 | line = data |
| 32 | data = m.readline() |
| 33 | line = line.lower() |
| 34 | line = line.strip().split() |
| 35 | yield line |
| 36 | |
| 37 | class CorpusReader: |
| 38 | def __init__(self, fname): |
nothing calls this directly
no outgoing calls
no test coverage detected