MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / unicode_cpt_is_han

Function unicode_cpt_is_han

external/llama_tokenizer/unicode.cpp:1051–1081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1049}
1050
1051bool unicode_cpt_is_han(uint32_t cpt) {
1052 // Han character ranges (Chinese/CJK characters)
1053 // CJK Unified Ideographs (most common)
1054 if (cpt >= 0x4E00 && cpt <= 0x9FFF) return true;
1055
1056 // CJK Extension A
1057 if (cpt >= 0x3400 && cpt <= 0x4DBF) return true;
1058
1059 // CJK Extension B
1060 if (cpt >= 0x20000 && cpt <= 0x2A6DF) return true;
1061
1062 // CJK Extension C
1063 if (cpt >= 0x2A700 && cpt <= 0x2B73F) return true;
1064
1065 // CJK Extension D
1066 if (cpt >= 0x2B740 && cpt <= 0x2B81F) return true;
1067
1068 // CJK Extension E
1069 if (cpt >= 0x2B820 && cpt <= 0x2CEAF) return true;
1070
1071 // CJK Extension F
1072 if (cpt >= 0x2CEB0 && cpt <= 0x2EBEF) return true;
1073
1074 // CJK Compatibility Ideographs
1075 if (cpt >= 0xF900 && cpt <= 0xFAFF) return true;
1076
1077 // CJK Compatibility Ideographs Supplement
1078 if (cpt >= 0x2F800 && cpt <= 0x2FA1F) return true;
1079
1080 return false;
1081}
1082
1083std::vector<std::string> unicode_regex_split(const std::string & text, const std::vector<std::string> & regex_exprs, bool byte_encode) {
1084 // unicode categories

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected