MCPcopy Create free account
hub / github.com/clab/dynet / __iter__

Method __iter__

examples/python-utils/util.py:25–35  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
37class CorpusReader:
38 def __init__(self, fname):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected