algorithm - 从段落中找出问题的答案

标签 algorithm

<分区>

问题陈述:
给定一个段落和一个问题列表,这些问题可以通过阅读该段落轻松回答。找到问题的答案。

我该如何解决这个问题?我知道这是一个广泛的问题,但我想知道解决这个问题的更高层次的方法。

示例输入

Zebras are several species of African equids (horse family) united by their distinctive black and white stripes. Their stripes come in different patterns, unique to each individual. They are generally social animals that live in small harems to large herds. Unlike their closest relatives, horses and donkeys, zebras have never been truly domesticated. There are three species of zebras: the plains zebra, the Grévy's zebra and the mountain zebra. The plains zebra and the mountain zebra belong to the subgenus Hippotigris, but Grévy's zebra is the sole species of subgenus Dolichohippus. The latter resembles an ass, to which it is closely related, while the former two are more horse-like. All three belong to the genus Equus, along with other living equids. The unique stripes of zebras make them one of the animals most familiar to people. They occur in a variety of habitats, such as grasslands, savannas, woodlands, thorny scrublands, mountains, and coastal hills. However, various anthropogenic factors have had a severe impact on zebra populations, in particular hunting for skins and habitat destruction. Grévy's zebra and the mountain zebra are endangered. While plains zebras are much more plentiful, one subspecies, the quagga, became extinct in the late 19th century – though there is currently a plan, called the Quagga Project, that aims to breed zebras that are phenotypically similar to the quagga in a process called breeding back.
Which Zebras are endangered?
What is the aim of the Quagga Project?
Which animals are some of their closest relatives?
Which are the three species of zebras?
Which subgenus do the plains zebra and the mountain zebra belong to?
subgenus Hippotigris;the plains zebra, the Grévy's zebra and the mountain zebra;horses and donkeys;aims to breed zebras that are phenotypically similar to the quagga;Grévy's zebra and the mountain zebra

示例输出

Grévy's zebra and the mountain zebra
aims to breed zebras that are phenotypically similar to the quagga
horses and donkeys
the plains zebra, the Grévy's zebra and the mountain zebra
subgenus Hippotigris

最佳答案

您必须构建一个 NLP 分类器。
在最简单的形式中,我想你可以:

  1. 从段落中找到最相关的一组关键词,然后使用 N-Gram 等算法与问题文本进行匹配.

  2. 训练分类器标记单词并在问答之间形成知识体

    例如 - 关键词:来自问题 - Zebras and endangered,段落中的匹配文本 - Grévy's zebra 和 mountain zebra are endangered。

可以看看Chapter 6 from Natural Language Processing with Python - Learning to Classify Text了解如何构建分类器。

关于algorithm - 从段落中找出问题的答案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22191541/

相关文章:

algorithm - 是否有任何有效的算法来检查我是否有至少一个有效组合从一组有效组合中获胜?

c++ - 如何相对于其他元素过滤 vector 元素?

algorithm - 我必须用 BFS 实现邻接矩阵吗?

python - 从 Python 列表中获取最多的 'diverse' 对集?

java - 为什么迭代映射比迭代列表慢?

c++ - 如何排序比 n log n 更快(给定列表上的强条件)?

c++ - “Probability Based”产生怪异结果的到达算法的时间延迟?

ios - 围绕中心质量创建圆形路径的算法?

java - PriorityQueue A* 算法上的 NullPointerException

python - 一种生成满足特定条件的集合的子集的算法