首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >向PyTextRank提供大文本

向PyTextRank提供大文本
EN

Stack Overflow用户
提问于 2021-10-21 20:02:54
回答 1查看 75关注 0票数 1

我想使用PyTextRank进行关键字提取。我如何向包提供500万份文档(每个文档由几个段落组成)?

这就是我在官方教程上看到的例子。

代码语言:javascript
复制
text = "Compatibility of systems of linear constraints over the set of natural numbers. Criteria of compatibility of a system of linear Diophantine equations, strict inequations, and nonstrict inequations are considered. Upper bounds for components of a minimal set of solutions and algorithms of construction of minimal generating sets of solutions for all types of systems are given. These criteria and the corresponding algorithms for constructing a minimal supporting set of solutions can be used in solving all the considered types systems and systems of mixed types.\n"
doc = nlp(text)
for phrase in doc._.phrases:
    ic(phrase.rank, phrase.count, phrase.text)
    ic(phrase.chunks)

我的选择仅仅是将数百万个文档连接到一个字符串并将其传递给nlp(text)吗?我不认为我可以使用nlp.pipe(texts),因为我想通过计算所有文档中的单词/短语来创建一个网络。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-22 02:30:57

不,相反,几乎可以肯定的是,并行运行这些任务会更好。pytextrank的许多用例都使用Spark、Dask、Ray等工具,通过spaCy管道与pytestrank并行处理正在运行的文档,以提取实体。有关使用Ray并行化的示例,请参见phrases.py#L45

一个问题是如何将提取的实体与文档关联?这些是否被收集到数据集中,或者是数据库或密钥/值存储?

无论收集这些结果,您都可以构造一个共现短语图,还可以包含其他语义,以帮助构建结果。为这类用例创建了一个姐妹项目kglab https://github.com/DerwenAI/kglabkglab项目附带的木星笔记本中有一些示例;请参阅https://derwen.ai/docs/kgl/tutorial/

FWIW,我们将在ODSC上提供关于使用kglabpytextrank的教程,还有几个在线视频(在图形数据科学下)供以前的会议教程使用。我们还通过https://www.knowledgegraph.tech/提供了每月的公共办公时间- Tw上的me @pacoid以获得详细信息。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69668138

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档