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

Character escapes for XML ids are incorrect for some characters #39

Closed
goodmami opened this issue Oct 18, 2024 · 0 comments · Fixed by #40
Closed

Character escapes for XML ids are incorrect for some characters #39

goodmami opened this issue Oct 18, 2024 · 0 comments · Fixed by #40
Labels
bug Something isn't working
Milestone

Comments

@goodmami
Copy link
Collaborator

This came up in globalwordnet/english-wordnet#1107 (comment)

The buggy code is here:

omw-data/scripts/util.py

Lines 67 to 68 in 0a94425

elif codepoint in codepoint2name:
chars.append(codepoint2name[codepoint])

The custom mapping already has the dash escapes (e.g., -apos-), but those that are looked up from Python's html.entities.codepoint2name do not get the dashes. The fix is essentially:

         elif codepoint in codepoint2name:
-            chars.append({codepoint2name[codepoint]})
+            chars.append(f"-{codepoint2name[codepoint]}-")

A second thing is that underscores are not escaped and spaces are replaced with underscores, resulting in a conflation of the two characters. The fix here is to add it to the escape patterns: -lowbar-

@goodmami goodmami added the bug Something isn't working label Oct 18, 2024
@goodmami goodmami added this to the Release 1.5 milestone Oct 18, 2024
goodmami added a commit that referenced this issue Oct 18, 2024
goodmami added a commit that referenced this issue Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant