Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipapy behaves strangely when modifing ipachar properties #4

Open
uzytkownik opened this issue Jul 11, 2019 · 0 comments
Open

ipapy behaves strangely when modifing ipachar properties #4

uzytkownik opened this issue Jul 11, 2019 · 0 comments

Comments

@uzytkownik
Copy link

Ipapy by default shares the representation of the characters which leads to strange behaviours:

s = IPAString(unicode_string=r"pæk")
s[0].voicing = 'voiced'
print(s[0].voicing) # voiced
print(s[0].canonical_representation) # bilabial consonant plosive voiceless
print(str(s)) # p
s[2].descriptors = list(map(lambda d: 'voiced' if d in DG_C_VOICING else d, s[2].descriptors))
print(s[2].voicing) # voiced
print(s[2].canonical_representation) # consonant plosive velar voiced
print(str(s)) # k
s = IPAString(unicode_string=r"pæk")
print(s[0].voicing) # voiced

It can be workaround by copying and double-lookup of characters:

s = IPAString(unicode_string=r"pæk")
s[0] = UNICODE_TO_IPA[IPA_TO_UNICODE[IPAChar(descriptors=list(map(lambda d: 'voiced' if d in DG_C_VOICING else d, s[0].descriptors))).canonical_representation]]
print(str(s)) # bæk

But this is very verbose operation for changing a single letter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant