Kyubyong / g2p

g2p: English Grapheme To Phoneme Conversion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File ('homographs.en' ) is not closed after opening by construct_homograph_dictionary

antimora opened this issue · comments

File ('homographs.en' ) remains open after using it. Please consider using context manager to auto close as in this example: https://book.pythontips.com/en/latest/context_managers.html

The actual warning:

  File "/home/dev/.local/lib/python3.8/site-packages/g2p_en/g2p.py", line 35, in construct_homograph_dictionary
    for line in codecs.open(f, 'r', 'utf8').read().splitlines():
ResourceWarning: unclosed file <_io.BufferedReader name='/home/dev/.local/lib/python3.8/site-packages/g2p_en/homographs.en'>