mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-23 17:31:41 +00:00
uses DATA_PATH instead of explicit path
This commit is contained in:
parent
f3a365fda9
commit
35a80e5f50
@ -46,8 +46,9 @@ def _non_punct_class():
|
||||
This will classify symbols, including emoji, as punctuation; callers that
|
||||
want to treat emoji separately should filter them out first.
|
||||
"""
|
||||
non_punct = DATA_PATH / 'non_punct.txt'
|
||||
try:
|
||||
with open('wordfreq/data/non_punct.txt') as file:
|
||||
with non_punct.open() as file:
|
||||
return file.read()
|
||||
except FileNotFoundError:
|
||||
non_punct = [x for x in range(0x110000)
|
||||
@ -58,7 +59,7 @@ def _non_punct_class():
|
||||
out = '[%s]' % ''.join("%s-%s" % (chr(start), chr(end))
|
||||
for start, end in non_punct_ranges)
|
||||
|
||||
with open('wordfreq/data/non_punct.txt', mode='w') as file:
|
||||
with non_punct.open(mode='w') as file:
|
||||
file.write(out)
|
||||
|
||||
return out
|
||||
|
Loading…
Reference in New Issue
Block a user