From ba1d5b161fcb8dc1a035d722eb1dfe9f740fc7d1 Mon Sep 17 00:00:00 2001 From: pingpingy1 Date: Thu, 14 Dec 2023 22:57:35 +0900 Subject: [PATCH] [feat] expand knowledge bases --- hopre/context_kb/similar.json | 5 ++- hopre/englishAnalysis/englishGrammar.pl | 5 +++ hopre/englishAnalysis/englishLexicon.pl | 55 +++++++++++++++++++++++++ hopre/punTestSuite.json | 14 ++++--- 4 files changed, 72 insertions(+), 7 deletions(-) diff --git a/hopre/context_kb/similar.json b/hopre/context_kb/similar.json index 9910d6c..09119c3 100644 --- a/hopre/context_kb/similar.json +++ b/hopre/context_kb/similar.json @@ -6,11 +6,12 @@ {"jump": "frog"}, {"jump": "car"}, {"windows": "computer"}, - {"windows open": "cold"}, + {"windows": "cold"}, {"virus": "computer"}, + {"virus": "doctor"}, {"peeling": "banana"}, {"not feeling well": "doctor"}, - {"hole": "two pairs"}, + {"hole in one": "two pairs"}, {"hole-in-one": "golfer"}, {"byte": "computer"}, {"bite": "doctor"} diff --git a/hopre/englishAnalysis/englishGrammar.pl b/hopre/englishAnalysis/englishGrammar.pl index 5412d8e..e37ff0f 100644 --- a/hopre/englishAnalysis/englishGrammar.pl +++ b/hopre/englishAnalysis/englishGrammar.pl @@ -42,6 +42,11 @@ s([coord:no,sem:S]), {combine(t:T,[s:S])}. +t([sem:T])--> + [in,case], + s([coord:no,sem:S]), + {combine(t:T,[s:S])}. + /*======================================================================== Sentences diff --git a/hopre/englishAnalysis/englishLexicon.pl b/hopre/englishAnalysis/englishLexicon.pl index 688c024..83c67d0 100644 --- a/hopre/englishAnalysis/englishLexicon.pl +++ b/hopre/englishAnalysis/englishLexicon.pl @@ -81,6 +81,15 @@ lexEntry(noun,[symbol:doctor,syntax:[doctor]]). lexEntry(noun,[symbol:bite,syntax:[bite]]). lexEntry(noun,[symbol:byte,syntax:[byte]]). +lexEntry(noun,[symbol:frog,syntax:[frog]]). +lexEntry(noun,[symbol:insurancecompany,syntax:[insurance,company]]). +lexEntry(noun,[symbol:jump,syntax:[jump]]). +lexEntry(noun,[symbol:car,syntax:[car]]). +lexEntry(noun,[symbol:virus,syntax:[virus]]). +lexEntry(noun,[symbol:golfer,syntax:[golfer]]). +lexEntry(noun,[symbol:hole,syntax:[hole]]). +lexEntry(noun,[symbol:book,syntax:[book]]). +lexEntry(noun,[symbol:windows,syntax:[windows]]). /*======================================================================== @@ -105,6 +114,10 @@ lexEntry(pn,[symbol:vincent,syntax:[vincent,vega]]). lexEntry(pn,[symbol:yolanda,syntax:[yolanda]]). +lexEntry(pn,[symbol:twopairsofpants,syntax:[two,pairs,of,pants]]). +lexEntry(pn,[symbol:one,syntax:[one]]). +lexEntry(pn,[symbol:toomanyprobs,syntax:[too,many,problems]]). + /*======================================================================== Quantified Noun Phrases @@ -251,6 +264,46 @@ lexEntry(tv,[symbol:goto,syntax:[went,to],inf:fin,num:pl]). +lexEntry(tv,[symbol:call,syntax:[call],inf:inf,num:sg]). +lexEntry(tv,[symbol:call,syntax:[call],inf:fin,num:sg]). +lexEntry(tv,[symbol:call,syntax:[calls],inf:fin,num:sg]). +lexEntry(tv,[symbol:call,syntax:[calls],inf:fin,num:pl]). +lexEntry(tv,[symbol:call,syntax:[called],inf:inf,num:sg]). +lexEntry(tv,[symbol:call,syntax:[called],inf:inf,num:pl]). +lexEntry(tv,[symbol:call,syntax:[called],inf:fin,num:sg]). +lexEntry(tv,[symbol:call,syntax:[called],inf:fin,num:pl]). + + +lexEntry(tv,[symbol:bring,syntax:[bring],inf:inf,num:sg]). +lexEntry(tv,[symbol:bring,syntax:[bring],inf:fin,num:sg]). +lexEntry(tv,[symbol:bring,syntax:[brings],inf:fin,num:sg]). +lexEntry(tv,[symbol:bring,syntax:[brings],inf:fin,num:pl]). +lexEntry(tv,[symbol:bring,syntax:[brought],inf:inf,num:sg]). +lexEntry(tv,[symbol:bring,syntax:[brought],inf:inf,num:pl]). +lexEntry(tv,[symbol:bring,syntax:[brought],inf:fin,num:sg]). +lexEntry(tv,[symbol:bring,syntax:[brought],inf:fin,num:pl]). + + +lexEntry(tv,[symbol:get,syntax:[get],inf:inf,num:sg]). +lexEntry(tv,[symbol:get,syntax:[get],inf:fin,num:sg]). +lexEntry(tv,[symbol:get,syntax:[gets],inf:fin,num:sg]). +lexEntry(tv,[symbol:get,syntax:[gets],inf:fin,num:pl]). +lexEntry(tv,[symbol:get,syntax:[got],inf:inf,num:sg]). +lexEntry(tv,[symbol:get,syntax:[got],inf:inf,num:pl]). +lexEntry(tv,[symbol:get,syntax:[got],inf:fin,num:sg]). +lexEntry(tv,[symbol:get,syntax:[got],inf:fin,num:pl]). + + +lexEntry(tv,[symbol:open,syntax:[open],inf:inf,num:sg]). +lexEntry(tv,[symbol:open,syntax:[open],inf:fin,num:sg]). +lexEntry(tv,[symbol:open,syntax:[opens],inf:fin,num:sg]). +lexEntry(tv,[symbol:open,syntax:[opens],inf:fin,num:pl]). +lexEntry(tv,[symbol:open,syntax:[opened],inf:inf,num:sg]). +lexEntry(tv,[symbol:open,syntax:[opened],inf:inf,num:pl]). +lexEntry(tv,[symbol:open,syntax:[opened],inf:fin,num:sg]). +lexEntry(tv,[symbol:open,syntax:[opened],inf:fin,num:pl]). + + /*======================================================================== Copula ========================================================================*/ @@ -288,6 +341,8 @@ lexEntry(adj,[symbol:tall,syntax:[tall]]). lexEntry(adj,[symbol:dressing,syntax:[dressing]]). +lexEntry(adj,[symbol:cold,syntax:[cold]]). +lexEntry(adj,[symbol:math,syntax:[math]]). /*======================================================================== diff --git a/hopre/punTestSuite.json b/hopre/punTestSuite.json index a524909..2e2ab0c 100644 --- a/hopre/punTestSuite.json +++ b/hopre/punTestSuite.json @@ -9,7 +9,7 @@ { "input": [ "Why was the math book sad?", - "Because it had too many problems." + "Because the book had too many problems." ], "joke": true }, @@ -23,7 +23,7 @@ { "input": [ "Why was the computer cold?", - "Because the computer left the Windows open." + "Because the computer opened the Windows." ], "joke": true }, @@ -34,6 +34,13 @@ ], "joke": true }, + { + "input": [ + "Why did the banana go to the doctor?", + "Because the banana was not feeling well." + ], + "joke": true + }, { "input": [ "Why did the golfer bring two pairs of pants?", @@ -48,9 +55,6 @@ ], "joke": true }, - - - { "input": [ "A man walks."