Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Examples

BAI Research edited this page Jun 5, 2022 · 9 revisions

Usage Instructions

  • Install all necessary Dependencies for OpenGIA
  • Download the OpenGIA source and compile your own executable
  • Place all the input files (including the GIArules.xml file) in your input folder (e.g. folder containing OpenGIA.exe)
  • Execute the program based upon the command line requirements

Usage Example(s)

The OpenGIA "examples" archive contains prominent examples of OpenGIA usage (along with respective input files);

e.g.

Linux EL5/EL6/EL7/UB14/UB16:

Example using NLP input from Stanford Core NLP;

./OpenGIA.exe -lrpfolder "/home/systemusername/source/LRPdata" -itxt inputText.txt -oall semanticNet -nlprelation 1 -nlpfeature 1 -nlprelexfolder "/home/systemusername/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "/home/systemusername/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "/home/systemusername/stanford/parser/stanford-parser-full-2016-10-31" -notshow
./OpenGIA.exe -lrpfolder "/home/systemusername/source/LRPdata" -itxt inputText.txt -itxtq inputTextQuery.txt -oall semanticNet -nlprelation 1 -nlpfeature 1 -nlprelationq 1 -nlpfeatureq 1 -nlprelexfolder "/home/systemusername/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "/home/systemusername/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "/home/systemusername/stanford/parser/stanford-parser-full-2016-10-31" -notshow

Example using NLP input from Stanford Parser + Stanford Core NLP;

./OpenGIA.exe -lrpfolder "/home/systemusername/source/LRPdata" -itxt inputText.txt -oall semanticNet -nlprelation 2 -nlpfeature 1 -nlprelationq 2 -nlpfeatureq 1 -nlprelexfolder "/home/systemusername/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "/home/systemusername/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "/home/systemusername/stanford/parser/stanford-parser-full-2016-10-31" -notshow
./OpenGIA.exe -lrpfolder "/home/systemusername/source/LRPdata" -itxt inputText.txt -itxtq inputTextQuery.txt -oall semanticNet -nlprelation 2 -nlpfeature 1 -nlprelationq 2 -nlpfeatureq 1 -nlprelexfolder "/home/systemusername/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "/home/systemusername/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "/home/systemusername/stanford/parser/stanford-parser-full-2016-10-31" -notshow > answer.txt
./OpenGIA.exe -lrpfolder "/home/systemusername/source/LRPdata" -syndet 1 -itxt inputText.txt -oall semanticNet -nlprelation 2 -nlpfeature 1 -nlprelationq 2 -nlpfeatureq 1 -nlprelexfolder "/home/systemusername/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "/home/systemusername/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "/home/systemusername/stanford/parser/stanford-parser-full-2016-10-31" -notshow

Windows XP/7/8/10:

Example using NLP input from Stanford Core NLP;

OpenGIA.exe -lrpfolder "C:/Files/source/LRPdata" -itxt inputText.txt -oall semanticNet -nlprelation 1 -nlpfeature 1 -nlprelationq 1 -nlpfeatureq 1 -nlprelexfolder "C:/Files/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "C:/Files/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "C:/Files/stanford/parser/stanford-parser-full-2016-10-31" -notshow
OpenGIA.exe -lrpfolder "C:/Files/source/LRPdata" -itxt inputText.txt -itxtq inputTextQuery.txt -oall semanticNet -nlprelation 1 -nlpfeature 1 -nlprelationq 1 -nlpfeatureq 1 -nlprelexfolder "C:/Files/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "C:/Files/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "C:/Files/stanford/parser/stanford-parser-full-2016-10-31" -notshow

Example using NLP input from Stanford Parser + Stanford Core NLP;

OpenGIA.exe -lrpfolder "C:/Files/source/LRPdata" -itxt inputText.txt -oall semanticNet -nlprelation 2 -nlpfeature 1 -nlprelationq 2 -nlpfeatureq 1 -nlprelexfolder "C:/Files/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "C:/Files/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "C:/Files/stanford/parser/stanford-parser-full-2016-10-31" -notshow
OpenGIA.exe -lrpfolder "C:/Files/source/LRPdata" -itxt inputText.txt -itxtq inputTextQuery.txt -oall semanticNet -nlprelation 2 -nlpfeature 1 -nlprelationq 2 -nlpfeatureq 1 -nlprelexfolder "C:/Files/relex/relex-1.4.0" -nlpstanfordcorenlpfolder "C:/Files/stanford/coreNLP/stanford-corenlp-full-2016-10-31" -nlpstanfordparserfolder "C:/Files/stanford/parser/stanford-parser-full-2016-10-31" -notshow

Formal Usage

Usage:  OpenGIA.exe [options]

where options are any of the following

-itxt [string]     : plain text .txt input filename to be parsed by the NLP parser (def: inputText.txt)
-itxtq [string]    : query plain text .txt input filename to be parsed by the NLP processor (def: inputTextQuery.txt)
-ionlprel [string] : NLP dependency relation parser .xml intermediary input/output filename (def: inputNLPrelation.xml)
-ionlptag [string] : NLP feature tag parser .xml intermediary input/output filename (def: inputNLPfeature.xml)
-ixml [string]     : semantic network definition .xml input filename (def: semanticNet.xml)
-ionlprelq [string]: query NLP dependency relation parser .xml intermediary input/output filename (def: inputNLPrelationQuery.xml)
-ionlptagq [string]: query NLP feature tag parser .xml intermediary input/output filename (def: inputNLPfeatureQuery.xml)
-ixmlq [string]    : query semantic network definition .xml input filename (def: semanticNetQuery.xml)
#ifdef GIA_INPUT_FILE_LISTS
-ilist             : all input files will be treated as file lists (new line delimited)
#endif	
-ocff [string]     : semantic network NLP parser generated .cff output filename (def: semanticNet.cff)
-oxml [string]     : semantic network definition .xml output filename (def: semanticNet.xml)
-ocxl [string]     : semantic network display .cxl vector graphics output filename (def: semanticNet.cxl)
-oldr [string]     : semantic network display .ldr 3D vector graphics output filename (def: semanticNet.ldr)
-oppm [string]     : semantic network display .ppm raster graphics output filename (def: semanticNet.ppm)
-osvg [string]     : semantic network display .svg 2D vector graphics output filename (def: semanticNet.svg)
-ocffq [string]    : query semantic network NLP parser generated .cff output filename (def: semanticNetQuery.cff)	
-oxmlq [string]    : query semantic network definition .xml output filename (def: semanticNetQuery.xml)
-ocxlq [string]    : query semantic network display .cxl vector graphics output filename (def: semanticNetQuery.cxl)
-oldrq [string]    : query semantic network display .ldr 3D vector graphics output filename (def: semanticNetQuery.ldr)
-oppmq [string]    : query semantic network display .ppm raster graphics output filename (def: semanticNetQuery.ppm)
-osvgq [string]    : query semantic network display .svg 2D vector graphics output filename (def: semanticNetQuery.svg)	
-oall [string]     : semantic network display xml/.svg/.ldr/.ppm default generic output filename (def: semanticNet)
#ifdef GIA_QUERY_WRITE_ANSWER_TO_FILE
-oanswer [string]  : plain text .txt file containing the answer to the query (def: answer.txt)
#endif
-nlprelation [int] : NLP dependency relation parser to be executed by GIA (0 - Relex, 1 - Stanford Core NLP, 2 - Stanford Parser [def])
-nlpfeature [int]  : NLP feature parser to be executed by GIA (0 - Relex, 1 - Stanford Core NLP [def], 2 - Stanford Parser (ie, none))
-nlpcompmode [int] : sets Relex into Stanford compatibility mode (0 - off [def], 1 - (assumes) Relex dependency relations are(/were) generated by Relex parser in Stanford compatibility mode, 2 - assumes Relex dependency relations were generated by GIA in cff) [EXPERIMENTAL]
-nlprelationq [int]: query NLP dependency relation parser to be executed by GIA (0 - Relex [def], 1 - Stanford Core NLP, 2 - Stanford Parser)
-nlpfeatureq [int] : query NLP feature parser to be executed by GIA (0 - Relex [def], 1 - Stanford Core NLP, 2 - Stanford Parser (ie, none))
-nlpcompmodeq [int]: query sets Relex into Stanford compatibility mode (0 - off [def], 1 - (assumes) Relex dependency relations are(/were) generated by Relex parser in Stanford compatibility mode, 2 - assumes Relex dependency relations were generated by GIA in cff) [EXPERIMENTAL]
#ifdef GIA_USE_DATABASE
-dbread            : read from database (GIA knowledge base) [improves referencing capacity]
-dbwrite           : write to database (GIA knowledge base) [saves knowledge]
-dbfolder [string] : database base folder path (def: /home/systemusername/source/GIAKBdatabase)
#endif
#ifdef GIA_SEMANTIC_PARSER
-dbsemanticparserfolder [string]   : direct semantic parser (corpus or optimised) database base folder path (def: /home/systemusername/source/GIAsemanticparserdatabase)
#endif
-nlprelexfolder [string]           : directory name for Relex (def: same as exe)
-nlpstanfordcorenlpfolder [string] : directory name for Stanford Parser (def: same as exe)
-nlpstanfordparserfolder [string]  : directory name for Stanford CoreNLP (def: same as exe)
#ifdef GIA_NLP_CLIENT_SERVER
-nlpclient                         : execute NLP as client (requires server to be already started)"
#endif
#ifdef GIA_PREPROCESSOR
-lrp                               : language reduction preprocessor
-olrptxt [string]                  : plain text .txt output filename with GIA language reduction preprocessor applied (def: inputTextWithLRP.txt)
-olrptxtq [string]                 : query plain text .txt output filename with GIA language reduction preprocessor applied (def: inputTextWithLRPQuery.txt)
-lrpfolder [string]                : folder of LRP data files (list of multiword verbs, multiword prepositions etc) (def: same as exe)
#endif
#ifdef USE_WORDNET
-syndet                            : wordnet synonymn detection (0 - off, 1 - during queries only, 2 - during referencing and queries [def])"
#endif
-show                              : display output in opengl
-width [int]                       : raster graphics width in pixels (def: 640)
-height [int]                      : raster graphics height in pixels (def: 480)
-inputfolder [string]              : input directory name for input files (def: same as exe)
-outputfolder [string]             : output directory name for temporary and output files (def: same as exe)

-version           : print version

This program performs GIA (General Intelligence Algorithm) operations - creates semantic network based upon NLP dependencies file (.xml) or GIA semantic network file (.xml); outputs semantic network to GIA semantic network file (.xml); displays semantic network (using opengl); prints semantic network to raster image (.ppm), 3D vector graphics (.ldr), or 2D vector graphics (.svg).

Extended Examples (release-15August2012)

Standard Syntactic Prototypes

inputText.txt (all of the following:) The broken pencil fell apart. Tom runs quickly. The fish, a carp, swam deeply. The battle happened on March 11th, 1973. There is a new movie we can see. The officer gave the youth a ride. The rabbit is 20 meters away. Robert ate 4 times a day. The girl is 6 feet tall. The undergraduate student is 18 years old. Hamish smoked at the toy shop. Alice wrote the letter. The guy, Akari said, left early in the morning. The bridge is next to the city. Ms. Savata's hand slipped. Kane is late. Margaret brought five pounds. The punter won almost $1000. Elexis owes seven hundred dollars. She is the one that broke it. Moses knew I was angry. The pastry tasted awesome. Jezel likes to draw.

Standard Queries

inputText.txt (all of the following:) The disaster happened over night. Tom should pour 4 litres. The time is 06:45. They should leave at 6pm. The ball is in the park. Jane bought the blue house. That is Jim. The star falls because it rains.

inputTextQuery.txt (one of the following:) How did the disaster happen? How much milk should Tom pour? What is the time? When should they leave? Where is the ball? Which house did Jane buy? Who is that? Why does the star fall?

Answer Found.
Exact Found Answer: night
(Time: TNI)
Answer Context: disaster is happen over night 
Answer Context (NLG):  a disaster happened over TNI
confidence: 40.000000
max confidence: 50.000000
GIA execution time: 13:0:27 15/08/2012 (finish)

Answer Found.
Exact Found Answer: litre
Quantity number: 4
Answer Context: pour 4 litre 
Answer Context (NLG):  Tom pour 4 litres
confidence: 40.000000
max confidence: 40.000000
GIA execution time: 13:2:18 15/08/2012 (finish)

Answer Found.
Exact Found Answer (alias): 06:45
Exact Found Answer: time
Answer Context: time 
confidence: 20.000000
max confidence: 20.000000
GIA execution time: 13:3:22 15/08/2012 (finish)

Answer Found.
Exact Found Answer: 6pm
Answer Context: they is leave at a 6pm 
Answer Context (NLG):  They leave at 6pm
confidence: 40.000000
max confidence: 50.000000
GIA execution time: 13:5:3 15/08/2012 (finish)

Answer Found.
Exact Found Answer: park
Answer Context: ball in park 
Answer Context (NLG):  a ball is in a park
confidence: 30.000000
max confidence: 30.000000
GIA execution time: 13:6:4 15/08/2012 (finish)

Answer Found.
Exact Found Answer: house
(Type: blue)
Answer Context: buy house 
Answer Context (NLG):  Jane bought a blue house
confidence: 40.000000
max confidence: 40.000000
GIA execution time: 13:9:9 15/08/2012 (finish)

Answer Found.
Exact Found Answer (alias): jim
Exact Found Answer: that
Answer Context: that 
confidence: 20.000000
max confidence: 20.000000

Answer Found.
Exact Found Answer: rain
Answer Context: star is fall because rain 
Answer Context (NLG):  it rains
Answer Context (NLG):  a star falls because rains
confidence: 40.000000
max confidence: 50.000000
GIA execution time: 13:11:47 15/08/2012 (finish)

Test Advanced Referencing

inputText.txt (one of the following:)

A red dog is fat. The red dog is happy.

Tom is a red dog. Tom ate a bone near the house.

Tom is a red dog. The red dog ate a bone near the house.

A red ball is in the park. A blue ball is in the house. The red ball fell off the table.

a chicken ate a pie. the chicken that ate a pie rowed the boat.

Tom's boat is red. the chicken rowed the red boat.

Tom's boat is red. the chicken rowed the red boat. The boat that was rowed ate a pie.

Test Aliases

inputText.txt/inputTextQuery.txt (one of the following:)

Tom smoked a pipe. Tom is a red dog. What is the name of the red dog that smoked the pipe? Required Answer: Tom.

Answer Found.
Exact Found Answer (alias): tom
Exact Found Answer: dog
(Type: red)
Answer Context: pipe smoke is done by dog has red 
Answer Context (NLG):  a red dog smoked a pipe
confidence: 50.000000
max confidence: 50.000000

Tom smoked a pipe. Tom is a red dog. The red dog that smoked the pipe is happy.

[non query: check advanced referencing manually - see semanticNet.svg output]

Jane bought the blue house. Which house did Jane buy?

Answer Found.
Exact Found Answer: house
(Type: blue)
Answer Context: buy house 
Answer Context (NLG):  Jane bought a blue house
confidence: 40.000000
max confidence: 40.000000
GIA execution time: 13:9:9 15/08/2012 (finish)

A dog eats the mud. Dogs are animals. which animal eats the mud?

Answer Found.
Exact Found Answer: dog
Answer Context: mud eat is done by dog 
Answer Context (NLG):  a dog eats a mud
confidence: 40.000000
max confidence: 40.000000
GIA execution time: 13:21:45 15/08/2012 (finish)

A dog eats the mud. The dog is an animal. which animal eats the mud?

Answer Found.
Exact Found Answer: dog
Answer Context: mud eat is done by dog 
Answer Context (NLG):  a dog eats a mud
confidence: 40.000000
max confidence: 40.000000
GIA execution time: 13:24:43 15/08/2012 (finish)

Tom is a red dog. Tom ate a bone near the house. Which dog ate a bone near the house?

Answer Found.
Exact Found Answer (alias): tom
Exact Found Answer: dog
(Type: red)
Answer Context: bone near house eat is done by dog 
Answer Context (NLG):  red Tom ate a bone near a house
confidence: 60.000000
max confidence: 60.000000
GIA execution time: 13:23:21 15/08/2012 (finish)

The red dog ate a bone near the house. The red dog's name is Tom. What did Tom eat?

Answer Found.
Exact Found Answer: bone
Answer Context: dog is eat bone 
Answer Context (NLG):  a red dog ate a bone near a house
confidence: 40.000000
max confidence: 30.000000
GIA execution time: 13:25:56 15/08/2012 (finish)

Tom is a red dog. Tom ate a bone near the house. What is the name of the red dog who ate a bone near the house?

Answer Found.
Exact Found Answer (alias): tom
Exact Found Answer: dog
(Type: red)
Answer Context: bone near house eat is done by dog has red 
Answer Context (NLG):  red Tom ate a bone near a house
confidence: 70.000000
max confidence: 70.000000
GIA execution time: 13:27:56 15/08/2012 (finish)

Tom ate a bone near the house. Tom is a red dog. What is the name of the red dog who ate a bone near the house?

Answer Found.
Exact Found Answer (alias): tom
Exact Found Answer: dog
(Type: red)
Answer Context: bone near house eat is done by dog has red 
Answer Context (NLG):  a red dog ate a bone near a house
confidence: 70.000000
max confidence: 70.000000
GIA execution time: 13:29:16 15/08/2012 (finish)

The name of a red dog is Tom. The red dog ate a bone near the house. Who ate a bone near the house?

Answer Found.
Exact Found Answer (alias): tom
Exact Found Answer: dog
(Type: red)
Answer Context: bone near house eat is done by dog 
Answer Context (NLG):  a red dog ate a bone near a house
confidence: 60.000000
max confidence: 50.000000
GIA execution time: 13:31:31 15/08/2012 (finish)

A red dog ate a bone near the house. The name of the red dog is Tom. Who ate a bone near the house?

Answer Found.
Exact Found Answer (alias): tom
Exact Found Answer: dog
(Type: red)
Answer Context: bone near house eat is done by dog 
Answer Context (NLG):  a red dog ate a bone near a house
confidence: 60.000000
max confidence: 50.000000
GIA execution time: 13:33:24 15/08/2012 (finish)

Clone this wiki locally