Semantic Networks

Tips and questions about scripting your Verbot®.

Moderator: Staff

Semantic Networks

Postby Mapestone » Wed Feb 01, 2012 3:40 am

A Food Network, foodNetwork.vkb, in the Reference section of the downloads is a KnowledgeBase that engages the user in small talk about food. The foodNetwork is implemented as a Semantic Network with a single primary rule, "Food". The Verbot Player Engine routes the user input through a network of nested synonyms. The Child Rules provide stops along the way, adding context by setting vars variables. When the Engine reaches the destination Rule, it is sent back to a top level Rule where the context held in the vars variables add relevance to the Verbot's generic response.
For example:
(_startup)
Verbot: Let's talk about food. What is your favorite Meat?
User: I like pot roast.
Verbot: Do you like Lentils and Ham?
User: I like ham.
Verbot: ham, I see. Do you like Seafood?
User: I prefer ice cream.
Verbot: ice cream 's fine. I like Southern Pecan Cheesecake Ice Cream.
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Re: Semantic Networks

Postby MikeA » Mon Feb 06, 2012 10:06 pm

This look very interesting. What is the aim? I mean, is to experiment with synonyms, or are you building a semantic networks style bot (although I'm not 100% sure what that means in bot context).
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Semantic Networks

Postby Mapestone » Wed Feb 08, 2012 12:15 am

MikeA wrote:...What is the aim?
It's a concise, adaptable, extensible, flexible framework for setting topic-related context. The tight KnowledgeBase's single purpose is to test the network. The network can be copied to any KnowledgeBase. Just as important, note that the KnowledgeBase also identifies user input that is considered off-topic, though in a disguised way:
U: i like to eat, eat, eat, apples and bananas
V: What do you think of Quince?
U: the wheels on the bus go round and round
V: Don't they use that in toothpaste?

You can add another food related topic:
Food
== Snacks aka: snack, snacks, munchies
==== ako: potato chips, popcorn, (cookies), (candy)

Which would catch this:
U: I finish my day with a bedtime snack.
V: I like snacks. Especially potato chips.

The framework is easily applied to other small talk topics:
Restaurants aka: restaurant, restaurants, eateries
== Fast Food Restaurants aka: diner, diners, burger joints, drive thru
==== ako: (Burger King), (Wendys), (Sonic), (Checkers), (A&W)
== Family Dining aka: family restaurant, sit down restaurant
==== ako: (Cracker Barrel), (Bob Evans), (Dennys), (Big Boys)

Which (possibly) would catch this:
U: I stopped at Checkers after school.
V: Fast food is ok. I prefer Bob Evans.

Combining both topics (possible scenario):
U: I stopped at Checkers after school.
V: I prefer family restaurants.
U: But Checkers has the best burgers.
V: Do you like Hot Dogs?
U: A&W's. The root beer floats are awesome.
V: Beer is good. Miller is my favorite.

Another tool for the kit.
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Re: Semantic Networks

Postby MikeA » Wed Feb 08, 2012 10:06 pm

Mapestone wrote:You can add another food related topic:
Food
== Snacks aka: snack, snacks, munchies
==== ako: potato chips, popcorn, (cookies), (candy)

Which would catch this:
U: I finish my day with a bedtime snack.
V: I like snacks. Especially potato chips.

The framework is easily applied to other small talk topics:


This is really interesting because it sounds very similar to what I am attemtping using a database (instead of synonyms). I thought about using synonyms, but had an idea that entailed linking, and couldn't work out how to do that.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Semantic Networks

Postby Mapestone » Thu Feb 09, 2012 11:57 am

MikeA wrote:... I am attemtping using a database...idea that entailed linking...
I'm looking forward to seeing your work with databases. I believe entity models in a relational database with a Verbot front end will be phenomenal.
I've been evaluating doubly linked lists using synonyms. More to come.
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Re: Semantic Networks

Postby MikeA » Fri Feb 10, 2012 5:20 pm

Mapestone wrote:I'm looking forward to seeing your work with databases. I believe entity models in a relational database with a Verbot front end will be phenomenal.


Well, we will see...... Progress is slow, but I'm still confident what I'm trying to do can work.

Mapestone wrote:I've been evaluating doubly linked lists using synonyms. More to come.


Not sure what doubly linked..... but I will see if I can remember and then post what I had in mine a year or so ago, which may be something similar.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Semantic Networks

Postby Mapestone » Sun Feb 12, 2012 12:44 pm

MikeA wrote:... I'm still confident what I'm trying to do can work....
You know the old saw; It starts with inspiration, then comes the perspiration. Or the expiration.
MikeA wrote:doubly linked... I will see if I can remember and then post what I had ...
Yes, please add that to your list. Doubly linked (Verbot context) is one of those fun phrases used to ID things humans do all the time, in the category of inherently obvious (no thinking required). For example:
Human: "I got some milk at the grocery store. On the way home I realized the carton was leaking, so I went back to get another one."
Obvious to a human. Verbot-ization could include:
A grocery store has milk (synonym list).
If you need milk, go to the grocery store (synonym reverse look up).
And other like-minded relationships:
Milk comes in cartons<=>cartons can hold milk. Cartons sometimes leak<=>Milk sometimes leaks from cartons.
With an association like this, relevant conversation would be possible (simulation):
U: I opened the refrigerator this morning, and there was milk on the bottom shelf.
V: On, there must be a leak in the carton.
U: Yeah, the seam isn't properly sealed.
V: You'll have to pick up some more milk the next time you're at the grocery store.
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Re: Semantic Networks

Postby MikeA » Sun Feb 12, 2012 3:19 pm

Mapestone wrote:..... Doubly linked (Verbot context) is one of those fun phrases used to ID things humans do all the time, in the category of inherently obvious (no thinking required). For example:
Human: "I got some milk at the grocery store. On the way home I realized the carton was leaking, so I went back to get another one."
Obvious to a human. Verbot-ization could include:
A grocery store has milk (synonym list).
If you need milk, go to the grocery store (synonym reverse look up).........


Logic is flawless. What I don't understand is how you use synonyms for this. The only way I know of getting Verbot to use any synonym in the list as a base to find another is by c# doing a manual search through the synonym xml file. Unless my focus on db has made my synonym knowledge lacking.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Semantic Networks

Postby Mapestone » Tue Feb 14, 2012 3:35 am

MikeA wrote:...my focus on db ...
Focus is good MikeA. Here's my guess at a solution:

Synonym File: ModernProblems.vsn
Synonym (Phrases)
itemStore (grocers|grocery store|hardware store)
at grocery store (bread|jelly|milk|peanut butter)
at grocers (bread|jelly|milk|peanut butter)
at hardware store (lug nuts|motor oil|chain saw)
breadContainer (loaves)
breadProblem (moldy|smashed|stale)
breadStore (grocers|grocery store)
jellyContainer (jars)
jellyProblem (jar cracked|leaks|open)
jellyStore (grocers|grocery store)
milkContainer (cartons|jugs)
milkProblem (leakyCarton|sour|spoiled)
milkStore (grocers|grocery store)
peanut butterContainer (jars)
peanut butterProblem (jar open|chunky not creamy|cracked jar)
peanut butterStore (grocers|grocery store)

at hardware store (lug nuts|motor oil|chain saw)
lug nutsContainer (boxes)
lug nutsProblem (wrong size)
lug nutsStore (hardware store)
motor oilContainer (quarts)
motor oilProblem (wrong type)
motor oilStore (hardware store)

KnowledgeBase: ModernProblems.kb

Rule: At the Store
Input: * [itemStore=(itemStore)]
Outputs:
Did you get (at [itemStore]) while you were at the [itemStore]?
What did you get at the [itemStore]?

Rule: Got an Item
Inputs:
* [item=(at grocery)]
* [item=(at hardware store)]
Outputs:
How many ([item]Container) of [item] did you get?
I'm glad you got [item]. What else did you get at the ([item]Store)?
Is there a problem with [item]? ([item]Problem)?

Rule: Got an Item at the Store
Inputs:
* [item=(at grocery store)] [itemStore=(itemStore)]
* [item=(at hardware store)] [itemStore=(itemStore)]
* [itemStore=(itemStore)] [item=(at grocery store)]
* [itemStore=(itemStore)] [item=(at hardware store)]
Outputs:
Did you get (at [itemStore]) while you were at the [itemStore]?
How many ([item]Container) of [item] did you get?
I'm glad you got [item]. What else did you get at the ([item]Store)?
Is there a problem with [item]? ([item]Problem)?

Example Dialogue:
U: I went to the hardware store on the way home from school today.
V: Did you get motor oil while you were at the hardware store?
U: No, I got peanut butter.
V: I'm glad you got peanut butter. What else did you get at the grocery store?
U: I got jelly at the grocery store. And bread.
V: Is there a problem with bread? smashed?
U: No, but the milk was bad.
V: Is there a problem with milk? sour?
U: Today I'm going to the hardware store to get some pliers.
V: Did you get chain saw while you were at the hardware store?
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Re: Semantic Networks

Postby MikeA » Thu Apr 05, 2012 10:33 am

What an interesting concept!

Actually, I didn't know you could do ([variable]endofsynonym).

In the this line:
Did you get (at [itemStore]) while you were at the [itemStore]?


I guess you meant to write:
Did you get (at [itemStore]) while you were at the ([item]Store)?


Not trying to be picky, just checking I understand.

This looks like a powerful applicationg of synonyms. My only initial concern is how often it will be necessary to repeat words. I wonder if there is a way around this.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Semantic Networks

Postby Mapestone » Sun Apr 08, 2012 1:56 am

MikeA wrote:... Not trying to be picky, just checking I understand. ... My only initial concern is how often it will be necessary to repeat words. I wonder if there is a way around this.
Sorry I wasn't clear MikeA. It takes some work to figure this out, but worth the effort (imho). The knowledgebase was written such that the form shown is correct: Did you get (at [itemStore]) while you were at the [itemStore]?
I did test the KB prior to posting it. - Your correction/alternative is a better solution.
Repeating words is a problem. The challenge is in finding a simple, reusable, and better solution.
I can email you a copy of this tiny KB and VSN file if you'd like.
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Re: Semantic Networks

Postby MikeA » Sun Apr 08, 2012 12:32 pm

Sure, I will pm my email.

Repeating words is a problem. The challenge is in finding a simple, reusable, and better solution.


Yes, this is a challenge! The problem is there's not a way (as standard) to read the synonym file backwards, leading to the main synonym word.

So there is:

at grocery store (bread|jelly|milk|peanut butter)

and

breadStore (grocers|grocery store)

It would be ideal to be able to find bread and be lead to 'at grocery store'. I don't think any Verbot variable gives the syonym header phrase of a found synonym.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Semantic Networks

Postby Mapestone » Sat Apr 14, 2012 1:22 am

Reverse lookup with a single synonym set would require an external program. I'm happy working with the alternative you've shown: two or more complementary synonym sets. The user mentions bread [food], and the Engine looks up ([food]Store) "grocery store" or (eatWith[food]) "peanut butter sandwich".
User: I brought some bread.
Verbot: Oh, you went to the grocery store? Are you going to have a peanut butter sandwich for lunch?
This simple construct provides lots of possibilities.
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Re: Semantic Networks

Postby MikeA » Sat Apr 14, 2012 9:46 am

Mapestone wrote:Reverse lookup with a single synonym set would require an external program. I'm happy working with the alternative you've shown: two or more complementary synonym sets.


I thought that was your idea? I just took it from what you'd already explained.

Re. what I said before about using rules instead, this could perhaps allow reverse lookup. I really think this is important, because otherwise every single word / phrase needs at least two entries. I haven't had a chance to experiment yet though.

I made such a program ages ago, as the synonym file is XML (my 'Synonyms in C#' thread). But I suspected it could get slow.
MikeA
MightyBot
MightyBot
 
Posts: 318
Joined: Sun Mar 22, 2009 1:35 pm

Re: Semantic Networks

Postby Mapestone » Sat Apr 21, 2012 2:49 am

Reverse lookup in Rules.. excellent. Someone's got to come up with an elegant example.
Might be an opportunity to use virtual child rules, or nested tags. A precursor to introspection?
"I'm here now, but how did I get here? I know, it started with this, then that, and now now."
My head's starting to spin. Fun stuff.
Mapestone
PowerBot
PowerBot
 
Posts: 116
Joined: Tue Apr 06, 2010 1:34 am

Next

Return to Scripting

Who is online

Users browsing this forum: Wedgeboow and 0 guests

cron