Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if initial:
onset = initial
# determine jp_search_tuple
if jyutping:
try:
jp_search_list = parse_jyutping(jyutping)
except ValueError:
raise ValueError("invalid jyutping -- %s" % (repr(jyutping)))
if len(jp_search_list) > 1:
raise ValueError("only jyutping for one character is allowed")
else:
jp_search_tuple = jp_search_list[0]
else:
if final:
nucleus, coda = parse_final(final)
jp_search_tuple = (onset, nucleus, coda, tone)
fn_to_results = {}
for fn, tagged_sents in fn_to_tagged_sents.items():
sent_word_index_pairs = []
for i_sent, tagged_sent in enumerate(tagged_sents):
for i_word, tagged_word in enumerate(tagged_sent):
c_characters, c_pos, c_mor, _ = tagged_word # c = current
c_jyutping = get_jyutping_from_mor(c_mor)
# determine character_search and pos_search
if character_search:
character_match = character in c_characters