3 ms·
Agree. I think reversing in non-ascii should always be thought of as "per-token", where English is character-as-token. So the reverse of what you gave would be:
by rlayton2 7y ago
Agree. I think reversing in non-ascii should always be thought of as "per-token", where English is character-as-token. So the reverse of what you gave would be:
":medium light skintone: :Man facepalming: lol"
(with the lol reversed). In this problem, it is a much harder problem than, say in python, mystring[::-1]. Therefore, it is a different problem "reverse a string" than to "reverse an array".
Accented characters would be kept as is in my scenario.
- PeCaN 7y agoThe "tokens" you're thinking of are "grapheme clusters" in Unicode. Unfortunately just reversing by grapheme clusters doesn't solve the problem because of directional formatting codes; if you have e.g. a right-to-left embedding followed by a pop directional formatting you can't naively reverse them.
- naniwaduni 7y agoGrapheme clusters are a poor approximation of the vaguely-defined linguistic-level concept you're groping for.
- PeCaN 7y agoWell, yes, but we gotta stop somewhere or just give up any hope of computers operating on text. Although I think grapheme clusters are a pretty good approximation in that it's usually what you want to backspace in a word processor.
- diegoperini 7y agoIs there a better approximation?