mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-24 18:01:38 +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
|
This will classify symbols, including emoji, as punctuation; callers that
|
||||||
want to treat emoji separately should filter them out first.
|
want to treat emoji separately should filter them out first.
|
||||||
"""
|
"""
|
||||||
|
non_punct = DATA_PATH / 'non_punct.txt'
|
||||||
try:
|
try:
|
||||||
with open('wordfreq/data/non_punct.txt') as file:
|
with non_punct.open() as file:
|
||||||
return file.read()
|
return file.read()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
non_punct = [x for x in range(0x110000)
|
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))
|
out = '[%s]' % ''.join("%s-%s" % (chr(start), chr(end))
|
||||||
for start, end in non_punct_ranges)
|
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)
|
file.write(out)
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
Loading…
Reference in New Issue
Block a user