Skip to content

Commit

Permalink
fix dict generator expression for 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
nidak21 committed Mar 11, 2019
1 parent 18497ce commit f9274a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Configuration
*.pyc
*.swp
*~
8 changes: 6 additions & 2 deletions extractedTextSplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ def initMatchResults(self):
"""
Initialize matchesByType and allMatches to empty lists
"""
self.matchesByType = { t: [] for t in self.regexTypes }
self.matchesByType = {}
for t in self.regexTypes:
self.matchesByType[t] = []
self.allMatches = []
# ----------------------------------

Expand Down Expand Up @@ -598,6 +600,8 @@ def getRegexTypes(self): return self.regexTypes
# -----------------------
if __name__ == "__main__": # some ad hoc tests

print "Running ad hoc tests - modify these as needed"

if False: # TypedRegexMatcher tests
PARA_BOUNDARY = '\n\n'
regexDict = {
Expand Down Expand Up @@ -654,7 +658,7 @@ def runSectionTest(sp, doc):
"\n1234567890" + \
'\n' + SUPP_DATA_TAG + \
"\n1234567890"
doc = open('6114980.txt', 'r').read()
#doc = open('6114980.txt', 'r').read()
sp = ExtTextSplitter(maxFraction=0.79, minFraction=.05)
#print sp.getRegexMatcher().getRegexStr()
runSectionTest(sp, doc)
Expand Down

0 comments on commit f9274a3

Please sign in to comment.