# *Challenge* Making an algo that learns from a book, and can answer anything about it

I recently took this challenge where I am trying to make a set of algorithms to read any particular book, understand and store the context and subsequently answer any question asked about it. In ways similar a person might execute this task, we would want our algo to hold every variable in its attention so that it can reason better and supersede the output generated by humans.

-It is assumed that the book is very dense and full of complex topics.

-The content of the book is very episodic, the relation between entities change as the book progresses. So with new incoming info the algo should be able to update its knowledge dynamically.

Requirements

Memory ( To store the data, and able to access/update it later)

Reinforcement ( To make sense)

Forecast ( To answer abstract questions)

Current Algo

Right now we are using the below techniques in the following order to accomplish this task.

Using Named Entity Recognition and relation detection NLP algos to extract the keyword and context from the book

Storing these keywords and context in an ontology with bayesian networks/ Inference networks

Reinforcement learning agents with Generative adversarial network of LSTM and CNN.

Question

Is there a better method of realizing the above mentioned goals?

• This is a very ambitious project, beyond current cutting edge research by e.g. OpenAI and Deep Mind. It is unlikely that anyone here will be able to offer practical advice and answer this question. However, you should read Open AI's recent work, e.g. d4mucfpksywv.cloudfront.net/better-language-models/… - the results reported on content summary and question answering seem very good to me. – Neil Slater Apr 23 '19 at 8:17
• Here's a link to sample outputs from the comprehension and question-answering part of Open AI's model: openai.com/blog/better-language-models/#task1 – Neil Slater Apr 23 '19 at 8:28

You could check existing neural network repositories like Wolfram Neural Net Repository. This does not seem to have that particular net. However, in Wolfram Language there is the FindTextualAnswer function (still experimental in version 12) that uses a neural net.

First a "book" can be obtained with WikipediaSearch and WikipediaData.

WikipediaSearch["traffic light"]


{Traffic light, Traffic light rating system, Traffic Light Protocol, Traffic light (disambiguation), Traffic-light signalling and operation, Traffic light coalition, Traffic light less road, Traffic right of way, Traffic light control and coordination, Traffic Light Tree, Traffic light peppers,
Traffic Light (TV series), Traffic Lights (Lena Meyer-Landrut song), Traffic light party}

Taking the first article.

txt = WikipediaData["Traffic light", "ArticlePlaintext"];


Questions will have answers of varying certainty. With FindTextualAnswer I'll return the top five answers. First some very basic formatting with Grid.

format = Grid[Prepend[#, {"Probability", "Sentence"}],
ItemStyle -> {{Automatic, {FontSize -> 11}}},
Alignment -> {{Automatic, Left}}] &;


Now the questions; using the GPU with TargetDevice.

FindTextualAnswer[txt, "Who invented the traffic light?", 5,
{"Probability", "HighlightedSentence"},
TargetDevice -> "GPU"] // format


FindTextualAnswer[txt, "When were traffic lights invented?", 5,
{"Probability", "HighlightedSentence"},
TargetDevice -> "GPU"] // format


The answers are not completely accurate in all cases but it is hard to do this and it is an experimental function in version 12 so not yet finished.

Hope this helps.