Speech acts with trees of word-vectors

  • 11 Replies
  • 3461 Views
*

Zero

  • Eve
  • ***********
  • 1287
Speech acts with trees of word-vectors
« on: June 02, 2021, 03:06:27 pm »
As part of what I'm working on (same huge project for several weeks, woohoo!!), I was wondering how I was going to store statements, questions, ...etc. Structured meaning blocks.

Starting from word-vectors, with the famous example of king - man + woman = queen, my first intuition was that a block would be an ordered list of vectors.

Using stanleyfok's vector-object library, that would be an array like this (dumb example):
Code
[
    new Vector({ react: 1, nodejs: 2, angular: 1 }),
    new Vector({ nodejs: 2, marko: 3, nextjs: 2 })
]

But thinking about it, sentences and phrases are not really linear, they are rather like trees. Targetting natural language realization with jsRealB, the shape of sentences is more like this ("he eats apples"):
Code
S(Pro("I").g("m"),
  VP(V("eat"),
     NP(D("a"),N("apple").n("p")))
 )

What I'm thinking here, is that meaning-vectors, organized as leaves of trees, and manipulated accordingly, should make a nice language of thought.

edit:

But then, how would I calculate the vector of a phrase or sentence, based on the vectors of its constituants?
« Last Edit: June 02, 2021, 03:55:52 pm by Zero »

*

frankinstien

  • Replicant
  • ********
  • 652
    • Knowledgeable Machines
Re: Speech acts with trees of word-vectors
« Reply #1 on: June 02, 2021, 05:03:05 pm »
Here's a similar concept and was used to model emotions but is used to model other concepts as well. It incorporates an object-oriented data model so it can benefit from inheritance, and nesting.




*

Zero

  • Eve
  • ***********
  • 1287
Re: Speech acts with trees of word-vectors
« Reply #2 on: June 02, 2021, 09:14:28 pm »
Looks like a really nice tool you have here. If I understand correctly, you're doing single inheritance with overloading? Cool.
 8)

Say you have (A) the boy eats the apple. The meaning-vector of this sentence is more than just an object that would inherit the meaning-vectors of the boy, eats and the apple. We know it's more than that because inheritance à la OO (overloading or adding) would give the same m-vector for (B) the apple eats the boy, which is not the same.

And the missing part is not even in the structure of the sentence, since (A) and (B) have the very same structure. Even if an m-vector gets added because of the structure, it's still not enough to differentiate (A) and (B).

This example makes obvious that the additional information which we're looking for, is the role of the constituants. I'm wondering how to turn these roles into new valued dimensions. Or any other way to solve this!

*

Zero

  • Eve
  • ***********
  • 1287
Re: Speech acts with trees of word-vectors
« Reply #3 on: June 02, 2021, 10:39:36 pm »
Nice article about vectors from a machine-learning perspective   :knuppel2:

edit:

Got it. I think. An m-vector encodes not only a target, but also its role in the sentence or phrase. So the boy in (A) is NOT the same as the boy in (B). But the relation holds.

Let's call them:
Code
[the boy](A)
[the boy](B)
[the apple](A)
[the apple](B)

Then we have:
Code
[the apple](B) - [the apple](A) = [the boy](B) - [the boy](A)

Et voilà, everything follows.

edit:

But it still means the m-vector of the sentence is not the sum of the m-vectors of its constituants.

How about... adding siblings, and multiplying children? Or something.

edit:

  :D The meaning-vector of a sentence is a formula, a higher-order value!!
Code
boy = () => human(1) + young(1)
eats = () => action(1) + foodRelated(2)
apple = () => fruit(1) + foodRelated(3)

boy eats apple = (subject, verb, object) =>
    human(1 * subject) + young(1 * subject) +
    action(1 * verb) + foodRelated(2 * verb) +
    fruit(1 * object) + foodRelated(3 * object)
« Last Edit: June 03, 2021, 12:10:16 am by Zero »

*

frankinstien

  • Replicant
  • ********
  • 652
    • Knowledgeable Machines
Re: Speech acts with trees of word-vectors
« Reply #4 on: June 03, 2021, 12:34:37 am »
Looks like a really nice tool you have here. If I understand correctly, you're doing single inheritance with overloading? Cool.
 8)

It can do multiple inheritances and can manage circular references (this is good when you have deeply nested objects).

Say you have (A) the boy eats the apple. The meaning-vector of this sentence is more than just an object that would inherit the meaning-vectors of the boy, eats and the apple. We know it's more than that because inheritance à la OO (overloading or adding) would give the same m-vector for (B) the apple eats the boy, which is not the same.

Well, no since an apple doesn't have a mouth or other digestive capabilities, so it would not be the same.

This example makes obvious that the additional information which we're looking for, is the role of the constituants. I'm wondering how to turn these roles into new valued dimensions. Or any other way to solve this!

The roles are determined by definitions described as capabilities and attributes where metaphorical scenarios are detected when those capabilities and attributes are violated by the context of the sentence.

*

frankinstien

  • Replicant
  • ********
  • 652
    • Knowledgeable Machines
Re: Speech acts with trees of word-vectors
« Reply #5 on: June 03, 2021, 01:23:32 am »
Just to elaborate a bit more the ontological framework provides the means to associate pieces of data that can be standardized. So there are vectors in the form of various definitions, below is an image:



Note that in features "part" is marked in a red box. So if you noticed in the RootDescriptor tree a "Head" is a part described as a generalized type. So a machine can sense if something has parts and what kind. The vectors are in the form of enumerators that can be extended indefinitely without having to recode in some programming language and are stored in a NoSQL database. This approach makes the creation, and editing  machine and human readable. So we can provide this kind of input to a neural network or some other algorithm.

This also allows for the compare and contrast operation to be fairly straightforward. Also, note (if you looked at how Emotions are modeled) data can be assigned or associated that can be anything, video, audio, scable vectors, or functions from any language.

Also, note that this approach involves the machine interact with some mentor, machine or human, to learn new concepts that it does not understand. I did describe a means to teach the machine in a previous post. This is all work in progress, as I wish I could find the funding to do much much more...

*

MagnusWootton

  • Replicant
  • ********
  • 646
Re: Speech acts with trees of word-vectors
« Reply #6 on: June 03, 2021, 01:53:15 am »
The apple eats the boy,  is an example where word precedence matters.

But there is lots of cases where it doesnt matter as well.

See you later.
you later see.
see later you.
later you see.
later see you.

could be similar,   im yet to code it tho,  but thats one of my ideas that help plasticize its word dictionary,  cause there is not enough dictionary size on the planet,  for a decent chat bot,   theres got to be some way of increasing the patterns you have.

*

Zero

  • Eve
  • ***********
  • 1287
Re: Speech acts with trees of word-vectors
« Reply #7 on: June 03, 2021, 09:44:52 am »
Quote
Well, no since an apple doesn't have a mouth or other digestive capabilities, so it would not be the same.

Yes it would give the same m-vector for (A) and (B). Here is a snippet that shows this unwanted outcome:

Code
const Vector = require("vector-object");



let boy = new Vector({
    human: 1,
    young: 1
});

let eats = new Vector({
    action: 1,
    foodRelated: 1
});

let apple = new Vector({
    fruit: 1,
    foodRelated: 1
});



let sentenceA = new Vector({}).add(boy).add(eats).add(apple);

console.log("boy + eats + apple = ", sentenceA);



let sentenceB = new Vector({}).add(apple).add(eats).add(boy);

console.log("apple + eats + boy = ", sentenceB);



console.log(
    sentenceA.isEqual(sentenceB) ?
        "boy + eats + apple == apple + eats + boy" :
        "boy + eats + apple != apple + eats + boy"
);

This Javascript code actually outputs:
Code
boy + eats + apple =  Vector {
  vector: { human: 1, young: 1, action: 1, foodRelated: 2, fruit: 1 }
}
apple + eats + boy =  Vector {
  vector: { fruit: 1, foodRelated: 2, action: 1, human: 1, young: 1 }
}
boy + eats + apple == apple + eats + boy

As you can see, the meaning of the sentence is not only the addition of the meaning of its constituants. The role of constituants has to be part of the sentence's m-vector, one way or another.

Quote
could be similar,   im yet to code it tho,  but thats one of my ideas that help plasticize its word dictionary,  cause there is not enough dictionary size on the planet,  for a decent chat bot,   theres got to be some way of increasing the patterns you have.

In other words, the same m-vector should be realizable through different structures. I think it fits with my idea of a formula, where several "math" expressions can be equivalent.

*

Zero

  • Eve
  • ***********
  • 1287
Re: Speech acts with trees of word-vectors
« Reply #8 on: June 03, 2021, 11:27:47 am »
Bivectors could be what I need here...

edit:

A resource here: http://www.jaapsuter.com/geometric-algebra.pdf

I need blades and ganja.
Doing my homework.
« Last Edit: June 04, 2021, 03:42:05 pm by Zero »

*

Zero

  • Eve
  • ***********
  • 1287
Re: Speech acts with trees of word-vectors
« Reply #9 on: June 03, 2021, 11:54:57 am »
Quote
I did describe a means to teach the machine in a previous post.
I love it!  O0

*

frankinstien

  • Replicant
  • ********
  • 652
    • Knowledgeable Machines
Re: Speech acts with trees of word-vectors
« Reply #10 on: August 22, 2021, 10:30:06 pm »
Quote
Well, no since an apple doesn't have a mouth or other digestive capabilities, so it would not be the same.

Yes it would give the same m-vector for (A) and (B). Here is a snippet that shows this unwanted outcome:

Code
const Vector = require("vector-object");



let boy = new Vector({
    human: 1,
    young: 1
});

let eats = new Vector({
    action: 1,
    foodRelated: 1
});

let apple = new Vector({
    fruit: 1,
    foodRelated: 1
});



let sentenceA = new Vector({}).add(boy).add(eats).add(apple);

console.log("boy + eats + apple = ", sentenceA);



let sentenceB = new Vector({}).add(apple).add(eats).add(boy);

console.log("apple + eats + boy = ", sentenceB);



console.log(
    sentenceA.isEqual(sentenceB) ?
        "boy + eats + apple == apple + eats + boy" :
        "boy + eats + apple != apple + eats + boy"
);

This Javascript code actually outputs:
Code
boy + eats + apple =  Vector {
  vector: { human: 1, young: 1, action: 1, foodRelated: 2, fruit: 1 }
}
apple + eats + boy =  Vector {
  vector: { fruit: 1, foodRelated: 2, action: 1, human: 1, young: 1 }
}
boy + eats + apple == apple + eats + boy

As you can see, the meaning of the sentence is not only the addition of the meaning of its constituants. The role of constituants has to be part of the sentence's m-vector, one way or another.

Quote
could be similar,   im yet to code it tho,  but thats one of my ideas that help plasticize its word dictionary,  cause there is not enough dictionary size on the planet,  for a decent chat bot,   theres got to be some way of increasing the patterns you have.

In other words, the same m-vector should be realizable through different structures. I think it fits with my idea of a formula, where several "math" expressions can be equivalent.

Actually, your algorithm is simply conveying whether your terms are elements of a sentence, not the notion of what the word represents and how actions can be executed or applied to the concept(s) of what the word represents.

*

Zero

  • Eve
  • ***********
  • 1287
Re: Speech acts with trees of word-vectors
« Reply #11 on: August 23, 2021, 04:35:02 pm »
Quote
Actually, your algorithm is simply conveying whether your terms are elements of a sentence,

Actually it's not even conveying that, since it's not connected to anything "outside". But you already know it.

 


Will LLMs ever learn what is ... is?
by HS (Future of AI)
November 10, 2024, 06:28:10 pm
Who's the AI?
by frankinstien (Future of AI)
November 04, 2024, 05:45:05 am
Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
Attempting Hydraulics
by MagnusWootton (Home Made Robots)
August 19, 2024, 04:03:23 am
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am

Users Online

414 Guests, 0 Users

Most Online Today: 571. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles