You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
modify text by moving old_accent from its current position to the preceding syllable's vowel or yogavaaha (a semi-vowel or special character that behaves like a vowel) in the form of new_accent. See test cases for example use.
10
+
11
+
:param scheme:
12
+
:param text:
13
+
:param old_accent:
14
+
:param new_accent:
15
+
:param drop_at_first_syllable: Should text like "ॗसैषा᳘" be produced?
# If a syllable has both sannatara and svarita signs (like वो॒॑), replace it's accents with udAtta, remove the predecessor's sannatara, and temporarily keep the sannatara in itself.
146
+
ifis_kampa:
147
+
out_letters[index] =letter+UDATTA
148
+
# Kampa rule: also remove the predecessor's sannatara.
# If a syllable has svarita, mark all preceeding syllables until a sannatara or svarita_new accent or a pause is reached with udAtta; at which point remove any preceding sannatara. Remove the triggering svarita. After this is done for all syllables, there should be no svarita left.
155
+
forindex, letterinenumerate(out_letters):
156
+
# --- Backward "painting" from a Svarita ---
157
+
ifnotSVARITAinletter:
158
+
continue
159
+
# Remove the source accent(s) from the syllable.
160
+
# For Kampa, also add an Udatta to the syllable itself.
161
+
out_letters[index] =letter.replace(SVARITA, "")
162
+
163
+
# Scan backwards and mark preceding syllables with Udatta.
# If a syllable has sannatara, mark all succeeding syllables with udAtta until a svarita is reached or a pause is reached. Remove the triggering sannatara. After this is done for all syllables, there should be no sannatara left.
180
+
forindex, letterinenumerate(out_letters):
181
+
182
+
# --- Forward "painting" from a Sannatara ---
183
+
# This applies to simple sannatara only. Kampa's effect is handled above.
184
+
ifSANNATARAinletter:
185
+
# Remove the triggering sannatara.
186
+
out_letters[index] =letter.replace(SANNATARA, "")
187
+
188
+
# Scan forwards and mark succeeding syllables with Udatta.
0 commit comments