Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
b = pc.onset(currentCorpus, 'b', 'type') # the function initial() is the same
print 'There are %d matching words, e.g.:' % (len(b))
printListUTF8(b[: 5]) # 5 results
print '\nFind all words with a specific nucleus (e.g., \'aa\'):'
aa = pc.nucleus(currentCorpus, 'aa', 'type')
print 'There are %d matching words, e.g.:' % (len(aa))
printListUTF8(aa[: 5]) # 5 results
print '\nFind all words with a specific coda (e.g., \'ng\'):'
ng = pc.coda(currentCorpus, 'ng', 'type')
print 'There are %d matching words, e.g.:' % (len(ng))
printListUTF8(ng[: 5]) # 5 results
print '\nFind all words with a specific final (e.g., \'aan\'):'
aan = pc.final(currentCorpus, 'aan', 'type')
print 'There are %d matching words, e.g.:' % (len(aan))
printListUTF8(aan[: 5]) # 5 results
print '\n*** using a customized function not from PyCantonese ***\n' + \
'Find all words with a specific coda plus a tone (e.g., \'t\' and \'3\'):'
t3 = final_tone(currentCorpus, 't3')
print 'There are %d matching words, e.g.:' % (len(t3))
printListUTF8(t3[: 5]) # 5 results
print '\nFind all words with a specific character (e.g., \'我\'):'
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:'