Skip to content

Commit 2581a56

Browse files
szabostevelcawl
andauthored
Adds question answering task to Extract information NLP docs (#2138)
Co-authored-by: Lisa Cawley <[email protected]>
1 parent f26b908 commit 2581a56

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

docs/en/stack/ml/nlp/ml-nlp-extract-info.asciidoc

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[[ml-nlp-extract-info]]
22
= Extract information
33

4-
:keywords: {ml-init}, {stack}, {nlp}, named entity recognition, fill mask
4+
:keywords: {ml-init}, {stack}, {nlp}, named entity recognition, fill mask, question answering
55
:description: NLP tasks that extract information from unstructured text.
66

77
These NLP tasks enable you to extract information from your unstructured text:
88

99
* <<ml-nlp-ner>>
1010
* <<ml-nlp-mask>>
11+
* <<ml-nlp-question-answering>>
1112

1213

1314
[discrete]
@@ -100,4 +101,41 @@ The task returns the following result:
100101
}
101102
...
102103
----------------------------------
104+
// NOTCONSOLE
105+
106+
107+
[discrete]
108+
[[ml-nlp-question-answering]]
109+
== Question answering
110+
111+
The question answering (or extractive question answering) task makes it possible
112+
to get answers to certain questions by extracting information from the provided
113+
text.
114+
115+
The model tokenizes the string of – usually long – unstructured text, then it
116+
attempts to pull an answer for your question from the text. The logic is
117+
shown by the following examples:
118+
119+
[source,js]
120+
----------------------------------
121+
...
122+
{
123+
"docs": [{"text_field": "The Amazon rainforest (Portuguese: Floresta Amazônica or Amazônia; Spanish: Selva Amazónica, Amazonía or usually Amazonia; French: Forêt amazonienne; Dutch: Amazoneregenwoud), also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname and French Guiana. States or departments in four nations contain "Amazonas" in their names. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species."}],
124+
"inference_config": {"question_answering": {"question": "Which name is also used to describe the Amazon rainforest in English?"}}
125+
}
126+
...
127+
----------------------------------
128+
// NOTCONSOLE
129+
130+
The answer is shown by the object below:
131+
132+
[source,js]
133+
----------------------------------
134+
...
135+
{
136+
"predicted_value": "Amazonia"
137+
...
138+
}
139+
...
140+
----------------------------------
103141
// NOTCONSOLE

docs/en/stack/ml/nlp/ml-nlp-model-ref.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ refer to <<ml-nlp-overview>>.
4545
* https://huggingface.co/elastic/distilbert-base-cased-finetuned-conll03-english
4646
* https://huggingface.co/philschmid/distilroberta-base-ner-conll2003
4747

48+
[discrete]
49+
[[ml-nlp-model-ref-question-answering]]
50+
== Third party question answering models
51+
52+
* https://huggingface.co/distilbert-base-cased-distilled-squad
53+
* https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad
54+
* https://huggingface.co/deepset/electra-base-squad2
55+
* https://huggingface.co/deepset/tinyroberta-squad2
56+
57+
4858
[discrete]
4959
[[ml-nlp-model-ref-text-embedding]]
5060
== Third party text embedding models

0 commit comments

Comments
 (0)