Closed liangnet closed 6 years ago
Pronouncing converts all the words in the CMU dictionary to lowercase when reading it in, but then assumes searched words are lower case.
So you'll need to use .lower()
on your input.
Python 3.6.5 (default, Apr 25 2018, 14:23:58)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pronouncing
>>> word = "A"
>>> pronouncing.phones_for_word(word)
[]
>>> pronouncing.phones_for_word(word.lower())
['AH0', 'EY1']
>>>
Please see PR https://github.com/aparrish/pronouncingpy/pull/42 to allow uppercase letters.
fixed in repo and in version on pypi.
In this page, http://www.speech.cs.cmu.edu/cgi-bin/cmudict?in=A, I can search for an alphabet such as 'A'. But for this python package, I cannot search for alphabet 'A' even for 'ABT' listed in the cmu dictionary 0.7d
I known why I cannot search for 'A'. 'A' should be search by 'a'