开发者

Locale-specific lookup table

开发者 https://www.devze.com 2023-04-07 08:43 出处:网络
I\'m using a lookup table for optimizing an algorithm that works on single characters. Currently I\'m adding a..z, A..Z, 0..9 to the lookup table. This works fine in european countries, but in asian c

I'm using a lookup table for optimizing an algorithm that works on single characters. Currently I'm adding a..z, A..Z, 0..9 to the lookup table. This works fine in european countries, but in asian countries it doesn't make much sense.

My idea was that I could perhaps use the characters i开发者_如何学JAVAn the windows default code page as an alphabet for the lookup table.

Pseudocode:

for Ch in DefaultCodePage.Characters do
  LookupTable.Add (Ch, ComputeValue (Ch)); 

What do you think and how could this be achieved? Any alternative suggestions?


As you mentioned, it does not make much sense for different scripts. It may only make some sense for alphabet-based languages.
BTW. A-Z is not enough for most of European languages.

I don't quite know what you are doing and what you need this look-up table for but it seems that what you are looking for are Index Characters. You could find such information in CLDR – look for indexCharacters. The resources for various languages are available here.
The only problem you'll face that in fact for some languages Index Characters tend to be Latin based. That is just because these languages do not actually have them... In that case you might want to use so called Exemplar Characters instead but please be warned that it might be just not enough for some use cases.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号