Core natural language processing primitives: text and stop-word helpers, a Porter stemmer, bigram extraction and TF-IDF document weighting, together with the shared document utilities that the BM25, LDA and tokenizer sub-namespaces build on.
Microsoft.VisualBasic.Data.NLP 1.0.9762.11310.
01 Namespaces
Microsoft.VisualBasic.Data.NLP
Microsoft.VisualBasic.Data.NLP.BM25
Okapi BM25 ranked retrieval engine: indexes documents with per-term contributions and selectable IDF variants, then scores and returns the best matching documents for a query.
| Type | Summary | Members |
|---|---|---|
| BM25Engine | BM25 引擎。 使用方式: Dim engine As New BM25Engine(k1:=1.2, b:=0.75) engine.AddDocument(0, {"苹果", "是", "一种", "水果"}) engine.AddDocument(1, {"苹果", "公司", "发布", "手机"}) engine.Bu… | 27 |
| Document | 文档表示:ID + 分词后的词元列表。 | 4 |
| IdfVariant | IDF 计算方式。 | 4 |
| SearchResult | 单条检索结果。 | 4 |
| TermContribution | 单个查询词的贡献明细。 | 6 |
Microsoft.VisualBasic.Data.NLP.ChineseTokenizer
Chinese word segmentation tokenizers: dictionary based maximum matching and HMM based segmentation, together with the word dictionary and trie index that back them.
| Type | Summary | Members |
|---|---|---|
| HmmModel | 基于 HMM(隐马尔可夫模型)的未登录词识别模块。 采用 BMES 四态标注体系: - B — 词首字符(Begin) - M — 词中字符(Middle) - E — 词尾字符(End) - S — 单字成词(Single) 模型参数: - 初始概率 π — 句子首字符处于各状态的概率 - 转移概率 A — 状态 i 到状态 j 的转移概率… | 8 |
| MaxMatchTokenizer | 基于词典的最大匹配分词算法集合,包含: - FMM — 正向最大匹配(Forward Maximum Matching) - BMM — 逆向最大匹配(Backward Maximum Matching) - BiMM — 双向最大匹配(Bidirectional Maximum Matching),取切分歧义较少者 这类算法实现简单、效率高,适合… | 4 |
| SegmentAlgorithm | 分词算法枚举,供 Tokenizer 选择内部策略。 | 8 |
| Tokenizer | 中文分词器主入口,整合词典、最大匹配算法与 HMM 模型。 工作流程(Hybrid 模式): 1. | 10 |
| WordDictionary | 基于 Trie(前缀树)的中文词典实现。 支持快速前缀查询、整词查询以及词频统计。 该结构在最大匹配算法中用于 O(L) 复度的最长词查找, 其中 L 为待匹配子串的最大长度。 | 12 |
Microsoft.VisualBasic.Data.NLP.ChineseTokenizer.HuggingFace
HuggingFace compatible tokenizer implementation: BPE, WordPiece and Unigram models with the normalizer, pre-tokenizer, post-processor and decoder pipeline, plus the tokenizer JSON configuration reader.
| Type | Summary | Members |
|---|---|---|
| AddedTokenInfo | tokenizer.json 中 added_tokens 数组的元素。 | 8 |
| AddedVocabulary | 追加词表:在归一化与预分词之前优先命中的 token 集合。 | 6 |
| BertNormalizer | BERT 的归一化器:清理控制字符、可选地在 CJK 字符两侧补空格、去变音符号与小写化。 | 2 |
| BertPostProcessor | BERT 的后处理器:在序列两端补上 [CLS] 与 [SEP]。 | 1 |
| BpeModel | 字节对编码(Byte Pair Encoding)子词模型。 | 9 |
| ByteFallbackDecoder | 字节回退解码器:把 <0xXX> 形式的 token 还原为原始字节。 | 1 |
| ByteLevelAlphabet | GPT-2 的 bytes_to_unicode 字节-字符双向映射表。 | 7 |
| ByteLevelDecoder | ByteLevel 解码器:把映射字符还原为字节序列之后按 UTF-8 解码。 | 1 |
| ByteLevelPostProcessor | ByteLevel 后处理器。 | 1 |
| ByteLevelPreTokenizer | ByteLevel 预分词器:把分片按 UTF-8 编码后逐字节映射为可见字符。 | 1 |
| DigitsPreTokenizer | 数字切分预分词器。 | 1 |
| Encoding | 编码结果,等价于 HuggingFace 中的 Encoding 对象。 | 7 |
| FixedLengthPreTokenizer | 定长切分预分词器。 | 0 |
| FuseDecoder | 熔合解码器:直接拼接全部 token。 | 1 |
| HuggingFaceTokenizer | 与 Hugging Face transformers / tokenizers 兼容的子词分词器。 | 17 |
| IDecoder | 解码器契约,对应 tokenizer.json 中的 decoder 段。 | 1 |
| INormalizer | 文本归一化器契约,对应 tokenizer.json 中的 normalizer 段。 | 1 |
| IPostProcessor | 后处理器契约,对应 tokenizer.json 中的 post_processor 段。 | 1 |
| IPreTokenizer | 预分词器契约,对应 tokenizer.json 中的 pre_tokenizer 段。 | 1 |
| ITokenizerModel | 子词模型契约:BPE / WordPiece / Unigram 均实现该接口。 | 4 |
| JsonNode | 一个轻量级的 json 文档对象模型。 | 13 |
| JsonNodeType | json 节点的数据类型。 | 6 |
| JsonReader | 供 HuggingFace 分词器模型文件使用的轻量级 json 解析器。 | 3 |
| LowercaseNormalizer | 小写化归一化器。 | 1 |
| MetaspaceDecoder | Metaspace 解码器:把 ▁ 还原为空格。 | 1 |
| MetaspacePreTokenizer | Metaspace 预分词器:把空格替换为 ▁(U+2581),SentencePiece 系列专用。 | 3 |
| ModelSection | tokenizer.json 中 model 段的强类型描述。 | 13 |
| NmtNormalizer | NMT 归一化器:把若干不可见的控制字符剔除,并把各类空白统一为普通空格。 | 1 |
| NullDecoder | 空解码器:直接把 token 首尾相接。 | 2 |
| NullNormalizer | 空归一化器:原样返回输入文本。 | 2 |
| NullPostProcessor | 空后处理器:不对 token 序列做任何改动。 | 2 |
| PrecompiledNormalizer | SentencePiece 的 Precompiled 归一化器。 | 2 |
| PrependNormalizer | 前缀追加归一化器,常见于 Llama 系列模型(在句首补一个 ▁)。 | 1 |
| PreTokenizerBase | 预分词器的抽象基类,负责处理"逐分片应用 + 跳过特殊分片"这一通用逻辑。 | 2 |
| PunctuationPreTokenizer | 按标点符号切分的预分词器。 | 1 |
| ReplaceDecoder | 替换解码器。 | 1 |
| ReplaceNormalizer | 字符串/正则替换归一化器。 | 2 |
| RobertaPostProcessor | RoBERTa 的后处理器:在序列两端补上 <s> 与 </s>。 | 1 |
| SequenceDecoder | 组合解码器:按顺序依次应用子解码器。 | 1 |
| SequenceNormalizer | 组合归一化器:按顺序依次应用子归一化器。 | 1 |
| SequencePostProcessor | 组合后处理器:按顺序依次应用子后处理器。 | 1 |
| SequencePreTokenizer | 组合预分词器:把上一级产出的分片依次交给子预分词器继续细分。 | 1 |
| Split | 预分词之后产生的文本分片。 | 6 |
| SplitBehavior | Split 预分词器对匹配片段的处理方式。 | 10 |
| SplitPreTokenizer | 基于正则表达式的 Split 预分词器。 | 2 |
| StripAccentsNormalizer | 去除变音符号的归一化器。 | 1 |
| StripDecoder | 首尾裁剪解码器。 | 1 |
| StripNormalizer | 去除首尾空白字符的归一化器。 | 1 |
| TemplatePostProcessor | 模板后处理器,对应 TemplateProcessing。 | 1 |
| Token | 单个 token 的切分结果。 | 9 |
| TokenizerConfig | tokenizer_config.json 的强类型描述。 | 12 |
| TokenizerFactory | 依据 tokenizer.json 中各配置节点的 type 字段构造流水线组件。 | 10 |
| TokenizerJson | tokenizer.json 的强类型描述。 | 11 |
| UnicodeNormalizer | Unicode 标准化归一化器:NFC / NFD / NFKC / NFKD。 | 1 |
| UnigramModel | Unigram 语言模型子词切分(SentencePiece)。 | 6 |
| WhitespacePreTokenizer | 按单词/标点边界切分的预分词器(BERT 的 Whitespace)。 | 0 |
| WhitespaceSplitPreTokenizer | 仅按空白字符切分的预分词器(WhitespaceSplit)。 | 0 |
| WordPieceDecoder | WordPiece 解码器:去除续接前缀并以空格连接。 | 2 |
| WordPieceModel | WordPiece 子词模型(BERT 系列)。 | 5 |
Microsoft.VisualBasic.Data.NLP.ChineseTokenizer.HuggingFace.AddedVocabulary
| Type | Summary | Members |
|---|---|---|
| TrieNode | 字典树节点。 | 1 |
Microsoft.VisualBasic.Data.NLP.ChineseTokenizer.HuggingFace.TemplatePostProcessor
| Type | Summary | Members |
|---|---|---|
| TemplatePiece | 模板片段:TemplatePiece.IsSequence 为真时表示序列占位符。 | 3 |
Microsoft.VisualBasic.Data.NLP.ChineseTokenizer.HuggingFace.UnigramModel
| Type | Summary | Members |
|---|---|---|
| TrieNode | 字典树节点。 | 1 |
Microsoft.VisualBasic.Data.NLP.LDA
Latent Dirichlet Allocation topic modelling: corpus and vocabulary containers, a Gibbs sampled LDA trainer, and helpers that load documents and interpret or persist the trained topic model.
| Type | Summary | Members |
|---|---|---|
| Corpus | a set of documents 语料库,也就是文档集合 @author hankcs | 8 |
| Debugger | 3 | |
| DocumentLoader | 2 | |
| GibbsSamplingTask | 1 | |
| LdaGibbsSampler | Gibbs sampler for estimating the best assignments of topics for words and documents in a corpus. | 26 |
| LdaInterpreter | @author hankcs | 3 |
| Vocabulary | a word set mapping between the word and its index id value @author hankcs | 6 |
Microsoft.VisualBasic.Data.NLP.Model
Lightweight text document model used by the NLP toolkit: paragraph, sentence, character walker and token counter abstractions for iterating over and measuring natural language text.
| Type | Summary | Members |
|---|---|---|
| Counter | counter for a specific token string | 6 |
| Paragraph | a collection of the text Sentence. | 5 |
| Sentence | a collection of the Word | 5 |
| SentenceCharWalker | Parse a line of sentence to a set of the word tokens | 1 |
| TokenCounter | 计数器 最初代码来自Ansj的tree-split包中的love.cq.util; @author fangy | 7 |