Nlpsolver README

Allikas: Lambda
README for nlpsolver
====================

Nlpsolver is a tool for answering questions posed in natural language.
  
The current version (4. May 2022) is in active development: 
there are numerous bugs, unfinished functionalities and functionalities 
planned to be built.


Examples
---------

It can already handle simple questions, for example:

./nlpsolver.py "Elephants and foxes are animals. 
John is an elephant. Mike is a old grey fox. Who is an old animal?"

./nlpsolver.py "Elephants and foxes are animals. 
<John> is an elephant. <John> is an animal?"

./nlpsolver.py "John is a grey animal and has a trunk. 
Elephants are big animals and have trunks. 
If an elephant is grey, it is old. 
If an animal has a trunk, it is an elephant. 
Who is an old elephant?" 

./nlpsolver.py "Elephants are big animals and have trunks. 
If an elephant is grey, it is old. 
If an animal has a trunk, it is an elephant. 
Who is an old animal?" 

Command line keys
-----------------

The following command line keys are available:

-debug  : show the main steps in processing the text
-showlogic : show the logic produced
-nosolve : do not attempt to solve the logic produced
-postprocess : run the postprocessor code on logic (see nlppostprocess.py)


Installation and requirements
-----------------------------

Nlpsolver requires:

* Python 3 series
* Stanza NLP parser from Stanford https://stanfordnlp.github.io/stanza/
  (can be installed in debian-based Linux systems with apt)
* gk commonsense logic solver in the same folder as nlpsolver 
  (included, make it executable with chmod +x gk)
* gk_axiomfile.js tiny axiom file in the same folder as nlpsolver
  (included)

To run nlpsolver, first start nlpserver in the same folder:
./nlpserver

After a few seconds the nlpserver starts properly up and then run
./nlpsolver "Elephants are animals. John is an elephant. John is an animal?"