我想使用PyTextRank进行关键字提取。我如何向包提供500万份文档(每个文档由几个段落组成)?
这就是我在官方教程上看到的例子。
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),因为我想通过计算所有文档中的单词/短语来创建一个网络。
发布于 2021-10-22 02:30:57
不,相反,几乎可以肯定的是,并行运行这些任务会更好。pytextrank的许多用例都使用Spark、Dask、Ray等工具,通过spaCy管道与pytestrank并行处理正在运行的文档,以提取实体。有关使用Ray并行化的示例,请参见phrases.py#L45
一个问题是如何将提取的实体与文档关联?这些是否被收集到数据集中,或者是数据库或密钥/值存储?
无论收集这些结果,您都可以构造一个共现短语图,还可以包含其他语义,以帮助构建结果。为这类用例创建了一个姐妹项目kglab https://github.com/DerwenAI/kglab。kglab项目附带的木星笔记本中有一些示例;请参阅https://derwen.ai/docs/kgl/tutorial/
FWIW,我们将在ODSC上提供关于使用kglab和pytextrank的教程,还有几个在线视频(在图形数据科学下)供以前的会议教程使用。我们还通过https://www.knowledgegraph.tech/提供了每月的公共办公时间- Tw上的me @pacoid以获得详细信息。
https://stackoverflow.com/questions/69668138
复制相似问题