本项目提供超过100种中文词向量,其中包括不同的表示方式(稠密和稀疏)、不同的上下文特征(词、N元组、字等等)、以及不同的训练语料。获取预训练词向量非常方便,下载后即可用于下游任务。
此外,我们还提供了中文词类比任务数据集CA8和配套的评测工具,以便对中文词向量进行评估。
如果使用了本项目的词向量和CA8数据集请进行如下引用:
Shen Li, Zhe Zhao, Renfen Hu, Wensi Li, Tao Liu, Xiaoyong Du, Analogical Reasoning on Chinese Morphological and Semantic Relations, ACL 2018.
@InProceedings{P18-2023,
author = "Li, Shen
and Zhao, Zhe
and Hu, Renfen
and Li, Wensi
and Liu, Tao
and Du, Xiaoyong",
title = "Analogical Reasoning on Chinese Morphological and Semantic Relations",
booktitle = "Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)",
year = "2018",
publisher = "Association for Computational Linguistics",
pages = "138--143",
location = "Melbourne, Australia",
url = "http://aclweb.org/anthology/P18-2023"
}
我们对中文词向量的内部和外部评估任务做了一个非常详尽的分析和对比,参见:
Yuanyuan Qiu, Hongzheng Li, Shen Li, Yingdi Jiang, Renfen Hu, Lijiao Yang. Revisiting Correlations between Intrinsic and Extrinsic Evaluations of Word Embeddings. Chinese Computational Linguistics and Natural Language Processing Based on Naturally Annotated Big Data. Springer, Cham, 2018. 209-221. (CCL & NLP-NABD 2018 Best Paper)
@incollection{qiu2018revisiting,
title={Revisiting Correlations between Intrinsic and Extrinsic Evaluations of Word Embeddings},
author={Qiu, Yuanyuan and Li, Hongzheng and Li, Shen and Jiang, Yingdi and Hu, Renfen and Yang, Lijiao},
booktitle={Chinese Computational Linguistics and Natural Language Processing Based on Naturally Annotated Big Data},
pages={209--221},
year={2018},
publisher={Springer}
}
所有的预训练词向量文件均为文本格式。每一行都包括一个词和它对应的词向量。所有的值均用空格分开。每个文件的第一行记录了基本信息:第一个数值是文件中总词数,第二个数值是向量维度。
除了稠密的词向量(用SGNS方式训练的),我们也提供了稀疏的词向量(用PPMI方式训练的)。稀疏的词向量格式同liblinear中的一样,以“位置:数值”的方式存储。
| 窗口大小 | 动态窗口 | 子采样 | 低频词阈值 | 迭代次数 | 负采样* |
| 5 | 是 | 1e-5 | 10 | 5 | 5 |
*仅适用于SGNS.
下列词向量基于不同的表示方式、不同的上下文特征以及不同领域的语料训练而成。
| Word2vec / Skip-Gram with Negative Sampling (SGNS) | ||||
| 语料 | 上下文特征 | |||
| 词 | 词 + N元组 | 词 + 字 | 词 + 字 + N元组 | |
| Baidu Encyclopedia 百度百科 | 300d | 300d | 300d | 300d / PWD: 5555 |
| Wikipedia_zh 中文维基百科 | 300d | 300d | 300d | 300d |
| People's Daily News 人民日报 | 300d | 300d | 300d | 300d |
| Sogou News 搜狗新闻 | 300d | 300d | 300d | 300d |
| Financial News 金融新闻 | 300d | 300d | 300d | 300d |
| Zhihu_QA 知乎问答 | 300d | 300d | 300d | 300d |
| Weibo 微博 | 300d | 300d | 300d | 300d |
| Literature 文学作品 | 300d | 300d / PWD: z5b4 | 300d | 300d / PWD: yenb |
| Complete Library in Four Sections 四库全书* | 300d | 300d | NAN | NAN |
| Mixed-large 综合 Baidu Netdisk / Google Drive | 300d 300d | 300d 300d | 300d 300d | 300d 300d |
| Positive Pointwise Mutual Information (PPMI) | ||||
| 语料 | 上下文特征 | |||
| 词 | 词 + N元组 | 词 + 字 | 词 + 字 + N元组 | |
| Baidu Encyclopedia 百度百科 | Sparse | Sparse | Sparse | Sparse |
| Wikipedia_zh 中文维基百科 | Sparse | Sparse | Sparse | Sparse |
| People's Daily News 人民日报 | Sparse | Sparse | Sparse | Sparse |
| Sogou News 搜狗新闻 | Sparse | Sparse | Sparse | Sparse |
| Financial News 金融新闻 | Sparse | Sparse | Sparse | Sparse |
| Zhihu_QA 知乎问答 | Sparse | Sparse | Sparse | Sparse |
| Weibo 微博 | Sparse | Sparse | Sparse | Sparse |
| Literature 文学作品 | Sparse | Sparse | Sparse | Sparse |
| Complete Library in Four Sections 四库全书* | Sparse | Sparse | NAN | NAN |
| Mixed-large 综合 | Sparse | Sparse | Sparse | Sparse |
*由于古汉语中绝大部份词均为单字词,因此只需字向量。
我们提供了基于不同共现信息训练而成的词向量。下述提到的中心向量和上下文向量在类似的论文中也被称为输入和输出向量。
这个部分中的向量不仅仅是词向量,还有其它的语言单位对应的向量。比如,在上下文是“词-字”的条件下,上下文向量会包含字向量。
所有的向量均采用SGNS在百度百科语料上训练而成。
| 特征 | 共现信息 | 中心向量 | 上下文向量 |
| 词 | 词 → 词 | 300d | 300d |
| N元组 | 词 → N元组 (1-2) | 300d | 300d |
| 词 → N元组 (1-3) | 300d | 300d | |
| N元组 (1-2) → N元组 (1-2) | 300d | 300d | |
| 字 | 词 → 字 (1) | 300d | 300d |
| 词 → 字 (1-2) | 300d | 300d | |
| 词 → 字 (1-4) | 300d | 300d | |
| 偏旁部首 | 偏旁部首 | 300d | 300d |
| 位置 | 词 → 词 (左/右) | 300d | 300d |
| 词 → 词 (距离) | 300d | 300d | |
| 全局信息 |
$ claude mcp add Chinese-Word-Vectors \
-- python -m otcore.mcp_server <graph>