提交 1dc188db 编写于 作者: W wizardforcel

2019-01-31 12:17:05

上级 edd362a0
......@@ -8,6 +8,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
......@@ -23,7 +24,6 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
......@@ -45,7 +45,6 @@ nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
......@@ -54,7 +53,6 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
......@@ -81,14 +79,13 @@ celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
# dotenv
.env
# virtualenv
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
......@@ -102,3 +99,20 @@ venv.bak/
# mypy
.mypy_cache/
.DS_Store
# gitbook
_book
# node.js
node_modules
# windows
Thumbs.db
# word
~$*.docx
~$*.doc
# custom
docs/README.md
---
permalink: /404.html
---
<script>window.location.href = '/';</script>
gensim.apachecn.org
\ No newline at end of file
# gensim 中文文档
# Gensim 中文文档
* [ApacheCN 组织资源](https://github.com/apachecn/home): https://github.com/apachecn/home
> **欢迎任何人参与和完善:一个人可以走的很快,但是一群人却可以走的更远**
* 原文:[gensim 文档](https://radimrehurek.com/gensim/index.html)
* 原文:[Gensim 文档](https://radimrehurek.com/gensim/index.html)
* **[ApacheCN - 学习机器学习群【629470233】](http://shang.qq.com/wpa/qunwpa?idkey=30e5f1123a79867570f665aa3a483ca404b1c3f77737bc01ec520ed5f078ddef)**
* **[Machine Learning in Action(机器学习实战)](https://github.com/apachecn/MachineLearning)| [ApacheCN(apache 中文网)](http://www.apachecn.org/)**
## 目录
这些教程被组织为一系列示例,突出了gensim的各种功能。假设读者熟悉[Python语言](https://www.python.org/)[安装了gensim](/blog/Install/README.md) 并阅读了[介绍](/blog/Introduction/README.md)
这些例子分为以下部分:
* [语料库和向量空间](/blog/tutorial/1.md)
* [从字符串到向量](https://radimrehurek.com/gensim/tut1.html#from-strings-to-vectors)
* [语料库流 - 一次一个文档](https://radimrehurek.com/gensim/tut1.html#corpus-streaming-one-document-at-a-time)
* [语料库格式](https://radimrehurek.com/gensim/tut1.html#corpus-formats)
* [与NumPy和SciPy的兼容性](https://radimrehurek.com/gensim/tut1.html#compatibility-with-numpy-and-scipy)
* [主题和转换](/blog/tutorial/2.md)
* [转换界面](https://radimrehurek.com/gensim/tut2.html#transformation-interface)
* [可用的转换](https://radimrehurek.com/gensim/tut2.html#available-transformations)
* [相似性查询](/blog/tutorial/3.md)
* [相似界面](https://radimrehurek.com/gensim/tut3.html#similarity-interface)
* [下一个在哪里](https://radimrehurek.com/gensim/tut3.html#where-next)
* [英语维基百科上的实验](/blog/tutorial/4.md)
* [准备语料库](https://radimrehurek.com/gensim/wiki.html#preparing-the-corpus)
* [潜在语义分析](https://radimrehurek.com/gensim/wiki.html#latent-semantic-analysis)
* [潜在的Dirichlet分配](https://radimrehurek.com/gensim/wiki.html#latent-dirichlet-allocation)
* [分布式计算](/blog/tutorial/5.md)
* [为何分布式计算?](https://radimrehurek.com/gensim/distributed.html#why-distributed-computing)
* [先决条件](https://radimrehurek.com/gensim/distributed.html#prerequisites)
* [核心概念](https://radimrehurek.com/gensim/distributed.html#core-concepts)
* [可用分布式算法](https://radimrehurek.com/gensim/distributed.html#available-distributed-algorithms)
## [预赛](https://radimrehurek.com/gensim/tutorial.html#preliminaries "永久链接到这个标题")
所有示例都可以直接复制到Python解释器shell。[IPython](http://ipython.scipy.org/)`cpaste` 命令对于复制代码片段(包括主要 `>>>>` 字符)特别方便。
Gensim使用Python的标准 `logging` 模块来记录各种优先级的各种东西; 要激活日志记录(这是可选的),请运行
```
>>> import logging
>>> logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
```
## [快速示例](https://radimrehurek.com/gensim/tutorial.html#quick-example "永久链接到这个标题")
首先,让我们导入gensim并创建一个包含九个文档和十二个特征的小型语料库[[1]](https://radimrehurek.com/gensim/tutorial.html#id2)
```
>>> from gensim import corpora, models, similarities
>>>
>>> corpus = [[(0, 1.0), (1, 1.0), (2, 1.0)],
>>> [(2, 1.0), (3, 1.0), (4, 1.0), (5, 1.0), (6, 1.0), (8, 1.0)],
>>> [(1, 1.0), (3, 1.0), (4, 1.0), (7, 1.0)],
>>> [(0, 1.0), (4, 2.0), (7, 1.0)],
>>> [(3, 1.0), (5, 1.0), (6, 1.0)],
>>> [(9, 1.0)],
>>> [(9, 1.0), (10, 1.0)],
>>> [(9, 1.0), (10, 1.0), (11, 1.0)],
>>> [(8, 1.0), (10, 1.0), (11, 1.0)]]
```
在gensim中,*语料库*只是一个对象,当迭代时,返回其表示为稀疏向量的文档。在这种情况下,我们使用元组列表的列表。如果您不熟悉[矢量空间模型](https://en.wikipedia.org/wiki/Vector_space_model),我们将在下一个关于[Corpora和Vector Spaces的](https://radimrehurek.com/gensim/tut1.html)教程中弥合**原始字符串****语料库****稀疏矢量**之间的差距。[](https://radimrehurek.com/gensim/tut1.html)
如果您熟悉向量空间模型,您可能会知道解析文档并将其转换为向量的方式会对任何后续应用程序的质量产生重大影响。
> 注意:
在此示例中,整个语料库作为Python列表存储在内存中。但是,语料库接口只表示语料库必须支持对其组成文档的迭代。对于非常大的语料库,有利的是将语料库保持在磁盘上,并且一次一个地顺序访问其文档。所有操作和转换都以这样的方式实现,使得它们在内存方面独立于语料库的大小。
接下来,让我们初始化一个*转换*
```
>>> tfidf = models.TfidfModel(corpus)
```
转换用于将文档从一个向量表示转换为另一个向量表示:
```
>>> vec = [(0, 1), (4, 1)]
>>> print(tfidf[vec])
[(0, 0.8075244), (4, 0.5898342)]
```
在这里,我们使用了[Tf-Idf](https://en.wikipedia.org/wiki/Tf%E2%80%93idf),这是一种简单的转换,它将文档表示为词袋计数,并应用对常用术语进行折扣的权重(或者等同于促销稀有术语)。它还将得到的向量缩放到单位长度(在[欧几里德范数中](https://en.wikipedia.org/wiki/Norm_%28mathematics%29#Euclidean_norm))。
[主题和转换](https://radimrehurek.com/gensim/tut2.html)教程中详细介绍了[转换](https://radimrehurek.com/gensim/tut2.html)
要通过TfIdf转换整个语料库并对其进行索引,以准备相似性查询:
```
>>> index = similarities.SparseMatrixSimilarity(tfidf[corpus], num_features=12)
```
并查询我们的查询向量`<span class="pre">vec</span>`与语料库中每个文档的相似性:
```
>>> sims = index[tfidf[vec]]
>>> print(list(enumerate(sims)))
[(0, 0.4662244), (1, 0.19139354), (2, 0.24600551), (3, 0.82094586), (4, 0.0), (5, 0.0), (6, 0.0), (7, 0.0), (8, 0.0)]
```
如何阅读此输出?文档编号为零(第一个文档)的相似度得分为0.466 = 46.6%,第二个文档的相似度得分为19.1%等。
因此,根据TfIdf文档表示和余弦相似性度量,最类似于我们的查询文档vec是文档号。3,相似度得分为82.1%。请注意,在TfIdf表示中,任何不具有任何共同特征的 `vec` 文档(文档编号4-8)的相似性得分均为0.0。有关更多详细信息,请参阅[Similarity Queries](https://radimrehurek.com/gensim/tut3.html)教程。
---
| [[1]](https://radimrehurek.com/gensim/tutorial.html#id1) | 这与 [Deerwester等人](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf) 使用的语料库相同[](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf)[(1990):通过潜在语义分析进行索引](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf),表2。
## 联系方式
> 负责人
......
* [介绍](blog/Introduction/README.md)
* [安装](blog/Install/README.md)
* [教程](blog/tutorial/README.md)
* [语料库和向量空间](blog/tutorial/1.md)
* [主题和转换](blog/tutorial/2.md)
* [相似性查询](blog/tutorial/3.md)
* [英语维基百科上的实验](blog/tutorial/4.md)
* [分布式计算](blog/tutorial/5.md)
# 安装
## [快速安装](https://radimrehurek.com/gensim/install.html#quick-install "永久链接到这个标题")
## 快速安装
在您的终端中运行(推荐):
......@@ -16,7 +16,7 @@
---
## [代码依赖](https://radimrehurek.com/gensim/install.html#code-dependencies "永久链接到这个标题")
## 代码依赖
Gensim在Linux,Windows和Mac OS X上运行,并且应该在支持Python 2.7+和NumPy的任何其他平台上运行。Gensim取决于以下软件:
......@@ -26,7 +26,7 @@ Gensim在Linux,Windows和Mac OS X上运行,并且应该在支持Python 2.7+
* [Six](https://pypi.org/project/six/) >= 1.5.0
* [smart_open](https://pypi.org/project/smart_open/) >= 1.2.1
## 测试Gensim [](https://radimrehurek.com/gensim/install.html#testing-gensim "永久链接到这个标题")
## 测试Gensim
Gensim使用持续集成,在每个pull请求上自动运行完整的测试套件
......@@ -36,6 +36,6 @@ Gensim使用持续集成,在每个pull请求上自动运行完整的测试套
| AppVeyor | 在Windows上运行测试 | ![AppVeyor](/imgs/Introduction/develop_1.svg) |
| CircleCI | 构建文档 | ![CircleCI](/imgs/Introduction/develop.svg) |
## [问题?](https://radimrehurek.com/gensim/install.html#problems "永久链接到这个标题")
## 问题
使用[Gensim讨论组](https://groups.google.com/group/gensim/)进行问题和故障排除。有关商业支持,请参阅[支持页面](https://radimrehurek.com/gensim/support.html)
......@@ -11,7 +11,7 @@ Gensim旨在处理原始的非结构化数字文本(**`纯文本`**)。
> 注意
如果前面的段落让您感到困惑,您可以在Wikipedia上阅读有关[向量空间模型](https://en.wikipedia.org/wiki/Vector_space_model)[无监督文档分析的](https://en.wikipedia.org/wiki/Latent_semantic_indexing)更多信息。
## [功能](https://radimrehurek.com/gensim/intro.html#features "永久链接到这个标题")
## 功能
* **内存独立性** - 任何时候都不需要整个训练语料库完全驻留在RAM中(可以处理大型的Web级语料库)。
* **内存共享** - 经过训练的模型可以持久保存到磁盘并通过[mmap](https://en.wikipedia.org/wiki/Mmap)加载回来。多个进程可以共享相同的数据,从而减少RAM占用空间。
......@@ -30,7 +30,7 @@ Gensim背后的**主要设计目标**是:
到达 info@scaletext.com 如果你需要专业支持的工业级NLP工具。
## [可用性](https://radimrehurek.com/gensim/intro.html#availability "永久链接到这个标题")
## 可用性
Gensim根据OSI批准的[GNU LGPLv2.1许可证授权](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html),可以从其[Github存储库](https://github.com/piskvorky/gensim/) 或[Python Package Index下载](https://pypi.python.org/pypi/gensim)
......@@ -38,7 +38,7 @@ Gensim根据OSI批准的[GNU LGPLv2.1许可证授权](https://www.gnu.org/licens
有关Gensim部署的更多信息,请参阅[安装](https://radimrehurek.com/gensim/install.html)页面。
## [核心概念](https://radimrehurek.com/gensim/intro.html#core-concepts "永久链接到这个标题")
## 核心概念
> 文集
......
......@@ -118,7 +118,7 @@ Dictionary(12 unique tokens)
## [语料库流 - 一次一个文档](https://radimrehurek.com/gensim/tut1.html#corpus-streaming-one-document-at-a-time "永久链接到这个标题")
请注意,上面的语料库完全驻留在内存中,作为普通的Python列表。在这个简单的例子中,它并不重要,但为了使事情清楚,让我们假设语料库中有数百万个文档。将所有这些存储在RAM中是行不通的。相反,我们假设文档存储在磁盘上的文件中,每行一个文档。Gensim只要求语料库必须能够一次返回一个文档向量:
请注意,上面的语料库完全驻留在内存中,作为普通的Python列表。在这个简单的例子中,它并不重要,但为了使事情清楚,让我们假设语料库中有数百万个文档。将所有这些存储在RAM中是行不通的。相反,我们假设文档存储在磁盘上的文件中,每行一个文档。gensim只要求语料库必须能够一次返回一个文档向量:
```
>>> class MyCorpus(object):
......@@ -173,7 +173,7 @@ Dictionary(12 unique tokens)
## [语料库格式](https://radimrehurek.com/gensim/tut1.html#corpus-formats "永久链接到这个标题")
存在几种用于将Vector Space语料库(〜矢量序列)序列化到磁盘的文件格式。 Gensim通过前面提到的*流式语料库接口*实现它们:文件以懒惰的方式从(分别存储到)磁盘读取,一次一个文档,而不是一次将整个语料库读入主存储器。
存在几种用于将Vector Space语料库(〜矢量序列)序列化到磁盘的文件格式。 gensim通过前面提到的*流式语料库接口*实现它们:文件以懒惰的方式从(分别存储到)磁盘读取,一次一个文档,而不是一次将整个语料库读入主存储器。
[市场矩阵格式](http://math.nist.gov/MatrixMarket/formats.html)是一种比较值得注意的文件[格式](http://math.nist.gov/MatrixMarket/formats.html)。要以Matrix Market格式保存语料库:
......@@ -235,7 +235,7 @@ MmCorpus(2 documents, 2 features, 1 non-zero entries)
## [与NumPy和SciPy的兼容性](https://radimrehurek.com/gensim/tut1.html#compatibility-with-numpy-and-scipy "永久链接到这个标题")
Gensim还包含[有效的实用程序函数](https://radimrehurek.com/gensim/matutils.html) 来帮助转换为/ numpy矩阵:
gensim还包含[有效的实用程序函数](https://radimrehurek.com/gensim/matutils.html) 来帮助转换为/ numpy矩阵:
```
>>> import gensim
......
......@@ -120,7 +120,7 @@ topic #1(1.476): -0.460*"system" + -0.373*"user" + -0.332*"eps" + -0.328*"interf
## [可用的转换](https://radimrehurek.com/gensim/tut2.html#available-transformations "永久链接到这个标题")
Gensim实现了几种流行的矢量空间模型算法:
gensim实现了几种流行的矢量空间模型算法:
* [术语频率*反向文档频率,Tf-Idf](https://en.wikipedia.org/wiki/Tf%E2%80%93idf) 期望初始化期间的词袋(整数值)训练语料库。在变换期间,它将采用向量并返回具有相同维度的另一个向量,除了在训练语料库中罕见的特征将增加其值。因此,它将整数值向量转换为实值向量,同时保持维度的数量不变。它还可以任选地将得到的矢量归一化为(欧几里得)单位长度。
......
......@@ -99,10 +99,10 @@ MmCorpus(9 documents, 12 features, 28 non-zero entries)
恭喜你,你已经完成了教程-现在你知道作品:-)深入到更多的细节如何gensim,您可以通过浏览[API文档](https://radimrehurek.com/gensim/apiref.html),请参阅[维基百科的实验](https://radimrehurek.com/gensim/wiki.html)或者是退房[分布式计算](https://radimrehurek.com/gensim/distributed.html)中gensim。
Gensim是一个相当成熟的软件包,已被许多个人和公司成功使用,用于快速原型制作和生产。这并不意味着它是完美的:
gensim是一个相当成熟的软件包,已被许多个人和公司成功使用,用于快速原型制作和生产。这并不意味着它是完美的:
* 有些部分可以更有效地实现(例如,在C中),或者更好地利用并行性(多个机器内核)
* 新算法一直在发布; 帮助gensim通过[讨论](https://groups.google.com/group/gensim)[贡献代码](https://github.com/piskvorky/gensim/wiki/Developer-page)来跟上[](https://github.com/piskvorky/gensim/wiki/Developer-page)
* 您的**反馈非常受欢迎**和赞赏(而且不仅仅是代码!): [创意贡献](https://github.com/piskvorky/gensim/wiki/Ideas-&-Features-proposals), [错误报告](https://github.com/piskvorky/gensim/issues)或只考虑贡献 [用户故事和一般问题](https://groups.google.com/group/gensim/topics)
在所有NLP(甚至机器学习)子域中,Gensim没有野心成为一个包罗万象的框架。它的使命是帮助NLP从业者轻松地在大型数据集上尝试流行的主题建模算法,并促进研究人员对新算法的原型设计。
在所有NLP(甚至机器学习)子域中,gensim没有野心成为一个包罗万象的框架。它的使命是帮助NLP从业者轻松地在大型数据集上尝试流行的主题建模算法,并促进研究人员对新算法的原型设计。
......@@ -14,7 +14,7 @@
> 注意
* 这个预处理步骤通过8.2GB压缩wiki转储进行两次传递(一次用于提取字典,一次用于创建和存储稀疏向量),并且在笔记本电脑上花费大约9个小时,因此您可能想要喝咖啡或二。
* 此外,您将需要大约35GB的可用磁盘空间来存储稀疏输出向量。我建议立即压缩这些文件,例如使用bzip2(低至~13GB)。Gensim可以直接使用压缩文件,因此可以节省磁盘空间。
* 此外,您将需要大约35GB的可用磁盘空间来存储稀疏输出向量。我建议立即压缩这些文件,例如使用bzip2(低至~13GB)。gensim可以直接使用压缩文件,因此可以节省磁盘空间。
## [潜在语义分析](https://radimrehurek.com/gensim/wiki.html#latent-semantic-analysis "永久链接到这个标题")
......
......@@ -17,11 +17,11 @@
`pip install Pyro4`
您不必安装Pyro来运行Gensim,但如果不这样做,您将无法访问分布式功能(即,所有内容都将始终以串行模式运行,此页面上的示例不适用)。
您不必安装Pyro来运行gensim,但如果不这样做,您将无法访问分布式功能(即,所有内容都将始终以串行模式运行,此页面上的示例不适用)。
## [核心概念](https://radimrehurek.com/gensim/distributed.html#core-concepts "永久链接到这个标题")
与往常一样,Gensim努力寻求一个清晰明了的API(见[功能](https://radimrehurek.com/gensim/intro.html#design))。为此,*您无需在代码中进行任何更改*,以便在计算机集群上运行它!
与往常一样,gensim努力寻求一个清晰明了的API(见[功能](https://radimrehurek.com/gensim/intro.html#design))。为此,*您无需在代码中进行任何更改*,以便在计算机集群上运行它!
您需要做的是在开始计算之前在每个集群节点上运行一个[工作](https://radimrehurek.com/gensim/distributed.html#term-worker)脚本(见下文)。运行此脚本告诉gensim它可以使用该节点作为从属程序将某些工作委托给它。在初始化期间,gensim中的算法将尝试查找并奴役所有可用的工作节点。
......
# 教程
这些教程被组织为一系列示例,突出了gensim的各种功能。假设读者熟悉[Python语言](https://www.python.org/)[安装了gensim](/blog/Install/README.md) 并阅读了[介绍](/blog/Introduction/README.md)
这些教程被组织为一系列示例,突出了Gensim的各种功能。假设读者熟悉[Python语言](https://www.python.org/)[安装了gensim](/blog/Install/README.md) 并阅读了[介绍](/blog/Introduction/README.md)
这些例子分为以下部分:
* [语料库和向量空间](/blog/tutorial/1.md)
* [从字符串到向量](https://radimrehurek.com/gensim/tut1.html#from-strings-to-vectors)
* [语料库流 - 一次一个文档](https://radimrehurek.com/gensim/tut1.html#corpus-streaming-one-document-at-a-time)
* [语料库格式](https://radimrehurek.com/gensim/tut1.html#corpus-formats)
* [与NumPy和SciPy的兼容性](https://radimrehurek.com/gensim/tut1.html#compatibility-with-numpy-and-scipy)
* [主题和转换](/blog/tutorial/2.md)
* [转换界面](https://radimrehurek.com/gensim/tut2.html#transformation-interface)
* [可用的转换](https://radimrehurek.com/gensim/tut2.html#available-transformations)
* [相似性查询](/blog/tutorial/3.md)
* [相似界面](https://radimrehurek.com/gensim/tut3.html#similarity-interface)
* [下一个在哪里](https://radimrehurek.com/gensim/tut3.html#where-next)
* [英语维基百科上的实验](/blog/tutorial/4.md)
* [准备语料库](https://radimrehurek.com/gensim/wiki.html#preparing-the-corpus)
* [潜在语义分析](https://radimrehurek.com/gensim/wiki.html#latent-semantic-analysis)
* [潜在的Dirichlet分配](https://radimrehurek.com/gensim/wiki.html#latent-dirichlet-allocation)
* [分布式计算](/blog/tutorial/5.md)
* [为何分布式计算?](https://radimrehurek.com/gensim/distributed.html#why-distributed-computing)
* [先决条件](https://radimrehurek.com/gensim/distributed.html#prerequisites)
* [核心概念](https://radimrehurek.com/gensim/distributed.html#core-concepts)
* [可用分布式算法](https://radimrehurek.com/gensim/distributed.html#available-distributed-algorithms)
## [预赛](https://radimrehurek.com/gensim/tutorial.html#preliminaries "永久链接到这个标题")
* [语料库和向量空间](blog/tutorial/1.md)
* 从字符串到向量
* 语料库流 - 一次一个文档
* 语料库格式
* 与NumPy和SciPy的兼容性
* [主题和转换](blog/tutorial/2.md)
* 转换界面
* 可用的转换
* [相似性查询](blog/tutorial/3.md)
* 相似界面
* 下一个在哪里
* [英语维基百科上的实验](blog/tutorial/4.md)
* 准备语料库
* 潜在语义分析
* 潜在的Dirichlet分配
* [分布式计算](blog/tutorial/5.md)
* 为何分布式计算?
* 先决条件
* 核心概念
* 可用分布式算法
## 预赛
所有示例都可以直接复制到Python解释器shell。[IPython](http://ipython.scipy.org/)`cpaste` 命令对于复制代码片段(包括主要 `>>>>` 字符)特别方便。
......@@ -36,7 +37,7 @@ Gensim使用Python的标准 `logging` 模块来记录各种优先级的各种东
>>> logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
```
## [快速示例](https://radimrehurek.com/gensim/tutorial.html#quick-example "永久链接到这个标题")
## 快速示例
首先,让我们导入gensim并创建一个包含九个文档和十二个特征的小型语料库[[1]](https://radimrehurek.com/gensim/tutorial.html#id2)
......@@ -54,7 +55,7 @@ Gensim使用Python的标准 `logging` 模块来记录各种优先级的各种东
>>> [(8, 1.0), (10, 1.0), (11, 1.0)]]
```
gensim中,*语料库*只是一个对象,当迭代时,返回其表示为稀疏向量的文档。在这种情况下,我们使用元组列表的列表。如果您不熟悉[矢量空间模型](https://en.wikipedia.org/wiki/Vector_space_model),我们将在下一个关于[Corpora和Vector Spaces的](https://radimrehurek.com/gensim/tut1.html)教程中弥合**原始字符串****语料库****稀疏矢量**之间的差距。[](https://radimrehurek.com/gensim/tut1.html)
Gensim中,*语料库*只是一个对象,当迭代时,返回其表示为稀疏向量的文档。在这种情况下,我们使用元组列表的列表。如果您不熟悉[矢量空间模型](https://en.wikipedia.org/wiki/Vector_space_model),我们将在下一个关于[Corpora和Vector Spaces的](https://radimrehurek.com/gensim/tut1.html)教程中弥合**原始字符串****语料库****稀疏矢量**之间的差距。[](https://radimrehurek.com/gensim/tut1.html)
如果您熟悉向量空间模型,您可能会知道解析文档并将其转换为向量的方式会对任何后续应用程序的质量产生重大影响。
......@@ -99,4 +100,4 @@ Gensim使用Python的标准 `logging` 模块来记录各种优先级的各种东
---
| [[1]](https://radimrehurek.com/gensim/tutorial.html#id1) | 这与 [Deerwester等人](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf) 使用的语料库相同[](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf)[(1990):通过潜在语义分析进行索引](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf),表2。
> [1] 这与 [Deerwester等人](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf) 使用的语料库相同[。](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf)[(1990):通过潜在语义分析进行索引](http://www.cs.bham.ac.uk/~pxt/IDA/lsa_ind.pdf),表2。
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
<!-- google ads -->
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- baidu stats -->
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?38525fdac4b5d4403900b943d4e7dd91";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- google webmaster -->
<meta name="google-site-verification" content="pyo9N70ZWyh8JB43bIu633mhxesJ1IcwWCZlM3jUfFo" />
</head>
<body>
<div id="app">now loading...</div>
<script id="footer" type="text/xml">
<hr/>
<div align="center">
<p><a href="http://www.apachecn.org/" target="_blank"><font face="KaiTi" size="6" color="red">我们一直在努力</font></a><p>
<p><a href="https://github.com/apachecn/gensim-doc-zh/" target="_blank">apachecn/gensim-doc-zh</a></p>
<p><iframe align="middle" src="https://ghbtns.com/github-btn.html?user=apachecn&repo=gensim-doc-zh&type=watch&count=true&v=2" frameborder="0" scrolling="0" width="100px" height="25px"></iframe>
<iframe align="middle" src="https://ghbtns.com/github-btn.html?user=apachecn&repo=gensim-doc-zh&type=star&count=true" frameborder="0" scrolling="0" width="100px" height="25px"></iframe>
<iframe align="middle" src="https://ghbtns.com/github-btn.html?user=apachecn&repo=gensim-doc-zh&type=fork&count=true" frameborder="0" scrolling="0" width="100px" height="25px"></iframe>
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=bcee938030cc9e1552deb3bd9617bbbf62d3ec1647e4b60d9cd6b6e8f78ddc03"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="ML | ApacheCN" title="ML | ApacheCN"></a></p>
<div style="text-align:center;margin:0 0 10.5px;">
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-3565452474788507"
data-ad-slot="2543897000"></ins>
</div>
</div>
</script>
<script>
window.docsPlugin = function(hook) {
var footer = document.querySelector('#footer').innerHTML
hook.afterEach(function(html) {
return html + footer
})
hook.doneEach(function() {
(adsbygoogle = window.adsbygoogle || []).push({})
})
}
window.$docsify = {
loadSidebar: 'SUMMARY.md',
name: 'Gensim 中文文档',
auto2top: true,
themeColor: '#006699',
repo: 'apachecn/gensim-doc-zh',
plugins: [window.docsPlugin],
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-python.min.js"></script>
<script>Prism.languages.py = Prism.languages.python</script>
</body>
</html>
\ No newline at end of file
git add -A
git commit -am "$(date "+%Y-%m-%d %H:%M:%S")"
git push
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册