Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError when trying to transcribe any text #38

Open
COOLIRON2311 opened this issue Sep 14, 2019 · 12 comments
Open

KeyError when trying to transcribe any text #38

COOLIRON2311 opened this issue Sep 14, 2019 · 12 comments

Comments

@COOLIRON2311
Copy link

Traceback (most recent call last):
  File "d:/tcritp/tcript.py", line 3, in <module>
    tr.transliterate(u'spark')
  File "D:\Python3\lib\site-packages\epitran\_epitran.py", line 62, in transliterate
    return self.epi.transliterate(word, normpunc, ligatures)
  File "D:\Python3\lib\site-packages\epitran\flite.py", line 92, in transliterate
    acc.append(self.english_g2p(chunk))
  File "D:\Python3\lib\site-packages\epitran\flite.py", line 211, in english_g2p
    return self.arpa_to_ipa(arpa_text)
  File "D:\Python3\lib\site-packages\epitran\flite.py", line 76, in arpa_to_ipa
    text = ''.join(ipa_list)
  File "D:\Python3\lib\site-packages\epitran\flite.py", line 75, in <lambda>
    ipa_list = map(lambda d: self.arpa_map[d], arpa_list)
KeyError: ''

Source:

from epitran import Epitran
tr = Epitran('eng-Latn', cedict_file='cedict_1_0_ts_utf-8_mdbg.txt')
tr.transliterate('test')

Note: Changing 'test' to u'test' does not help.

@COOLIRON2311 COOLIRON2311 changed the title Key Error when trying to transcribe any text KeyError when trying to transcribe any text Sep 14, 2019
@WhiteFu
Copy link

WhiteFu commented Sep 19, 2019

I also encountered the same problem

@dmort27
Copy link
Owner

dmort27 commented Sep 21, 2019

I am not able to replicate this bug. @WhiteFu and @COOLIRON2311, were you both running on Windows? What is the output of the following command on your systems:

lex_lookup 'test'

@dmort27
Copy link
Owner

dmort27 commented Sep 21, 2019

I discovered the source of the problem: Windows line endings. I have pushed a change to GitHub which I think may resolve the problem (no release on PyPI yet). Please let me know if it works.

@COOLIRON2311
Copy link
Author

I am not able to replicate this bug. @WhiteFu and @COOLIRON2311, were you both running on Windows? What is the output of the following command on your systems:

lex_lookup 'test'

Sorry for the late reply, tz difference.
There is no output from this command on my system because i don't have this utility installed.
Does it has to be installed from pip, or from (linux) repo? If the second, than it is bad for Windows users. Bthw, I tried epitran on my Mac, it gives me the same error.

@dmort27
Copy link
Owner

dmort27 commented Sep 22, 2019

As is detailed in the README, English support in Epitran doesn't work without lex_lookup installed (from flite). You have to compile it from source. Please install lex_lookup and then let me know whether you still get the same error.

@COOLIRON2311
Copy link
Author

There is no 'lex_lookup' target in flite Makefile. At least cygwin is unable to make it.
The same problem is described in #5

@dmort27
Copy link
Owner

dmort27 commented Sep 22, 2019 via email

@COOLIRON2311
Copy link
Author

From the link in the readme

@dmort27
Copy link
Owner

dmort27 commented Sep 22, 2019 via email

@dmort27
Copy link
Owner

dmort27 commented Sep 22, 2019

I have installed before on Cygwin, but I do not currently have access to a Windows machine, so I cannot test the current version of flite and lex_lookup.

@dmort27
Copy link
Owner

dmort27 commented Sep 26, 2019

I should have access to a windows machine soon. I'll try to get everything working on Cygwin and let you know what I find out.

@dmort27
Copy link
Owner

dmort27 commented Nov 2, 2019

I'm experiencing the same problem under Cygwin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants