c_NlpCharGraph: 分析一篇文章,建立字与字的关系

c_NlpNgramGraph: 基于 n 个已经出现的词,预估后续可能出现的词
c_NlpLanguageModel: 如果有的词组合形式没有出现过,找到之前学习过最长类似的词句进行预测
This commit is contained in:
2026-08-10 03:12:45 +08:00
parent e45398991f
commit e6a29bcdfd
10 changed files with 1560 additions and 0 deletions
+16
View File
@@ -5,6 +5,14 @@
#include <c_Base.h>
#endif /*INCLUDED_C_BASE_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
#ifndef C_UNICODE_MAX
#define C_UNICODE_MAX 0x10FFFFU
#endif
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
@@ -15,6 +23,14 @@ typedef uint16_t c_uint16_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
C_STATIC_FORCE_INLINE
bool c_is_valid_unicode(uint32_t code) {
// Unicode 码点不能超过 0x10FFFF,且必须排除 UTF-16 代理对范围 (0xD800 ~ 0xDFFF)
if (code > C_UNICODE_MAX) return false;
if (code >= 0xD800 && code <= 0xDFFF) return false;
return true;
}
/**
* @brief 获取一个 UTF-8 字符在当前指针位置所占用的实际字节数 (1 ~ 4 字节)
*/