How to use the pycantonese.jyutping function in pycantonese

To help you get started, we’ve selected a few pycantonese examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jacksonllee / pycantonese / test_corpus.py View on Github external
ngo5 = pc.character(currentCorpus, '我', 'type')
print 'There are %d matching words, e.g.:' % (len(ngo5))
printListUTF8(ngo5[: 5]) # 5 results

print '\nFind all words with a specific character (e.g., \'我\'),'
print 'each instance with a range -- -2 characters and +3 characters:'
ngo5_range = pc.character_range(currentCorpus, '我', 2, 3)
print 'There are %d instances of \'我\', e.g.:' % (len(ngo5_range))
for i in range(3): # 3 results
    printListUTF8(ngo5_range[i])
    print

# parsing jyutping from string input
for i in range(2):
    what_jp = raw_input('\nType jyutping string: ')
    print pc.jyutping(what_jp)