Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
age_to_tones[age] = Counter()
for tagged_word in tagged_words:
# jyutping should be like "gaa1jau2" (two syllables), "ngo5" (one syllable) etc
mor = tagged_word[2]
jyutping, _, _ = mor.partition('-')
jyutping, _, _ = jyutping.partition('&')
if not jyutping:
continue
# use PyCantonese to parse the "jyutping" str
try:
jyutping_parsed_list = pc.parse_jyutping(jyutping)
except:
continue
for jyutping_parsed in jyutping_parsed_list:
_, _, _, tone = jyutping_parsed # (onset, nucleus, coda, tone)
age_to_tones[age][tone] += 1
# Creating the dataframe for plotting the desired heatmap
# ---------------------------------------------------------------
#
# The dataframe has three columns and is created by `data_dict`.
# In[17]:
data_dict = {'MHZ\'s age in months': list(),