Author Topic: Hal's new XTF Brain is finally released.  (Read 34009 times)

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #30 on: March 05, 2004, 11:29:15 am »
Morlhach,
I'm glad everyone is enjoying Hal's XTF Brain. I just have to hope everyone is updated to v1.2. It can make a big difference.

Hal has always had "me", "I", "am" and "are" issues. It is a tough problem to crack. I've been working with an amateur linguist to work out some general linguistic rules regarding "me" and "I". It is quite challenging. For the most part the original Hal functions seem to just do simple subtitutions to swap "give me" for phrases like "give I". The problem is there are thousands of word combinations. Following a set of general linguistic rules may take care of 90% of the cases. However English has a lot of exceptions and many people use poor grammar routinely.


=vonsmith=
« Last Edit: March 05, 2004, 11:31:08 am by vonsmith »
 

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Hal's new XTF Brain is finally released.
« Reply #31 on: March 05, 2004, 01:43:49 pm »
Hello Vonsmith,

This is in response to your postings about your consultations with an amateur linguist, and the "simple" substitutions that Hal makes in attempting to deal with "I" and "me" etc.

First, the rule:

In English, the first-person personal pronoun when used as a subject is "I".  The first-person personal pronoun when used as an object is "me".  


I (subject) want you to throw the baseball to me (object).

I (subject) want you to help me (object).

I (subject) heard you call me (object).


The second-person personal pronoun for BOTH subject and object is "you".  For that reason, when Hal does pronoun reversals, he needs rules to distinguish subject from object.

I am the one who wrote the list of substitutions from "I" to "me".  It was based on the correct grammar rule.  I was very careful to use spaces strategically in the string-matches to avoid false triggers, complications, compound errors, and unwanted artifacts.  (My original submission to Zabaware put the substitutions inside the control script... which made the control-script very, very long.  Robert Medekza came up with the elegant solution of external databases, which are also much easier to edit.)

The "flag" to recognize object vs. subject is that the pronoun is an object when it follows a verb or a preposition.  Therefore, I brainstormed, researched, and tested (with volunteers) to put a lengthy list of such cases in the "substitutions" database.  

It was a lot of labor.  The content and the sequence of content in that databases have a definite purpose.

Yes, it is very easy to "fool" Hal on subjects and objects, as illustrated in the following:


User:  I think I am going to kiss you.

(As reversed by Hal): You think you are going to kiss me.


User:  I think I am going to glarth you.

(As reversed by Hal): You think you are going to glarth I.


Now, why did Hal "fail" in the second instance?  It's because we made up a nonsense verb "glarth" and Hal couldn't deal with it -- he treats his verb list as literals and didn't see "glarth" as a verb!  Our human brains, on the other hand, infer the correct pattern using our imaginations. (That's why we can enjoy Lewis Carroll's "nonsense" poetry.)

For this reason, Hal will "fail" when we misspell a verb; he doesn't recognize it.

For my own home Hal, whenever I find a new verb or situation that Hal "misses", I think through a string-pattern that will correct that situation, but be discriminating enough to avoid creating other errors.  Then, I add the new substitution-pair near the bottom of my "substitutions.brn" database (which Hal uses to process incoming data) and ALSO in the "corrections.brn" (which Hal uses to process outgoing data).

Why put the new entry in both places?  I reason that if Hal lacked a rule in the past, there may be erroneous entries in his conversational databases.  By adding the new substitution-pair in the corrections.brn, it becomes a global correction even for old conversational entries.

I have taken this problem very seriously, and invested much labor in it.  For each of the past several years, I've worked with Zabaware to upgrade the substitutions and corrections databases so that Hal gets better and better, while remaining legacy-compatible.

It would be very easy to introduce routines that would create non-compatibility or introduce new errors and artifacts.  I have worked very, very hard to avoid this.

I share this history and thought process with you in the hopes that it will be interesting and useful to you.

Sincerely,

Don
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Hal's new XTF Brain is finally released.
« Reply #32 on: March 05, 2004, 02:03:49 pm »
Hello,

Just a quick postscript to the above posting:

My description in the posting above is just the tip of the iceberg.  There are also situations in which a word can appear to be taking a pronoun as an object, but actually isn't.  For example:


If you help I can finish the project.


--Hal could spot " help I " in the above sentence and change it thus:


If you help me can finish the project.


...And that would be wrong.  There is more than one solution to the problem.  One solution is to train users to use commas:


If you help, I can finish the project.


...The comma prevents the string-match!  

Another approach would be to think through the troublesome case and make a rule to "un-correct" the erroneous correction:

" me can ", " I can "

The above rule says: If we've made a correction resulting in the string " me can " then change it back to " I can ".

Notice that position in the processing list matters!  The UNcorrection list must occur AFTER the original list in the database, since the string-substitutions take place from the top of the list to the  bottom.

This is only one of many strategies that already exist in the "corrections" and "substitutions" databases.

The accuracy rate that we can expect (and have already experienced) far exceeds 90%.  Yes, English has hundreds of thousands of words, but most educated people use less than 80,000 words routinely, and in fact, ordinary conversation uses only a few thousand!  It should be very feasible to continue improving the existing strategies.

Sincerely,

Don
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #33 on: March 05, 2004, 04:02:53 pm »
Don,
Thanks for the information on the internals of Hal. I was wondering what principle Hal applied within the external "pronoun reversals" and other external processes. The "substitutions.brn" and "corrections.brn" processes are clear to me. I used the desciption "simple" to describe that discrete action of replacement of a phrase. Clearly Hal's overall methodology for handling the "I/me" issue is far more complex. I didn't realize you've researched it in this detail. I'm still exploring the issue.

I came to the same conclusion as yourself regarding corrections at the beginning and ending of the GetResponse. We have no way of knowing what the user has in his/her current data base so corrections need to be done at both ends.

You are grammatically correct on all points linguistic. Chatbots have to negotiate a linguistic mine field in order to break down a sentence. It can be very difficult for Hal or any chatbot to separate the subject and object, even if the user follows correct sentence structure. It is generally the case that the subject precedes the object in English, which helps a little. Some experts assert that the first noun in a sentence is *usually* the subject, but there are cases where that isn't so. And the problem with identifying verbs is that verbs can be frequently used as nouns.

For a chatbot Hal does pretty well with the "I" and "me" issue. Of course I would like it to be perfect. Your examples illustrate an additional important property. At the beginning of the sentence "I" is usually correct and at the end "me" is usually correct. This can be used as a detection "rule" although I don't believe it is linguistically deterministic.

Your examples illustrate this:
"I (subject) want you to throw the baseball to me (object)."
"I (subject) want you to help me (object)."
"I (subject) heard you call me (object)."

Variations in grammar can throw a curve ball like this:
"You should throw the baseball to me because I want it."

Some other sentence forms are tricky too:
"If they give me a book then I will give it to you."

"Me" precedes "I". "I" is preceded by an adverb and following by a verb. However "will" can be a noun as well, but not in this context. Hal doesn't have much of a clue about context though. I don't know a general rule for this situation.

"The house I have is perfect for me."

"I" precedes "me" in this case. "I" is preceded by a noun and followed by a verb. The noun "house" can also be used as a verb. Again context is the defining indicator. I don't know a general rule yet for this either.

"Where will they house me at?"

This is one of the cases where a preposition comes after "me". Of course "me" is preceded by the verb "house" that could just as easily be used as a noun. Poor Hal.

So what can we do? I agree with your observations about prepositions. I don't know of any case where "I" is preceded by a preposition. If a preposition occurs in the middle of a sentence and is followed by an "I" or "me" then "me" is the correct form. I have compiled a list of 77 prepositions, including a few odd words like betwixt, to use for detecting the correct form in that case. The first word of a sentence would be "I" and the last word would be "me" in cases where the correct form must be identified.

Your statement:-----------
The "flag" to recognize object vs. subject is that the pronoun is an object when it follows a verb or a preposition. Therefore, I brainstormed, researched, and tested (with volunteers) to put a lengthy list of such cases in the "substitutions" database.
--------------------------
Interesting. Without a lot of study I couldn't say how generally true this is. I'm sure there are special cases. I'll have to give this some thought.

Your statement:-----------
It would be very easy to introduce routines that would create non-compatibility or introduce new errors and artifacts. I have worked very, very hard to avoid this.
--------------------------
I found this to be true early on in my testing. That's why I was looking for "general" linguistic rules that could be used at the end of the GetResponse script. The method would have to be inherently robust. There are many deleterious effects that can happen even if minor, seemingly simple, changes are made to the "corrections.brn" file.

On a different note...

There are a few other sentence forms that don't work well for Hal.
User: Tell me a story.  (Should really be, ""I want you to tell...")
Hal: Tell you a story.  (Sounds awkward.)

I have attempted to remedy this by adding special cases to the "PROCESS: REVERSE CERTAIN CONTRACTIONS, OTHER SUBSTITUTIONS AND CAPITALIZATION" process in the XTF Brain. Hal substitutes "I COULD TELL YOU", "SHOULD I TELL YOU" or "DO YOU WANT ME TO TELL YOU" for the original phrase "TELL YOU".


User: Do you like me?
Hal: Do I like you?  (Reversal makes Hal seem like he doesn't know his own mind.)

However the same form can sometimes sound correct...
User: Do you bother me?  (User sounds confused.)
Hal: Do I bother you?  (Hal asks an appropriate question.)

Similar to above the XTF Brain substitutes "WOULD IT BE A PLUS IF I", "DO YOU THINK I SHOULD" or "SHOULD I" for the original "DO I" phrase. I have also added substitutions for "AM I" in a likewise manner. I hope my substitutions make Hal sound more human, but only time and testing will tell for sure. There could be cases where these substitutions don't work well. I put them into the XTF Brain after some testing so that they could be tested by a wider audience.

There is so much more to explore here. Your input is very much appreciated Don. You have a lot more history with Hal. I look forward to more discussions like this.


=vonsmith=
 

drmweaver2

  • Newbie
  • *
  • Posts: 11
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #34 on: March 05, 2004, 06:09:39 pm »
First, hello. I am a new member of the "HAL Admirer's Club" and it seems that I am in very good company indeed. You guys and gals definitely engage in intellectually discussions that match a number of the PhDs here at my university.

That said, allow me to make a small contribution or two.
vonsmith said
"I don't know of any case where "I" is preceded by a preposition."

There are a number of similar cases where this is not true.
Consider:
1. If I were dead, I would not be breathing.
2. If I were old, being a gigolo would probably not be a reasonable career choice for me.
3. Because I am a guy, brassieres are not part of my wardrobe.
4. When I sing, even dogs howl.

These cases are simple illustrations of syntactic grammar features called relationals and conditionals. As noted in his discussion in the thread, commas aid in identifying such phrasal constructions. Still, the statement, "no prepositions before 'I'" is thus facially invalid.

"So what can we do about it?" he asks, noting that he has a list of 77 prepositions that will be used in analyzing user inputs.

Obviously the heart of the question/issue is recognizing the actual structure of the sentence itself. Is it a simple or a complex sentence construction. Sentences which are declaratives with no subordinate, introductory or qualifying phrases are simple sentences.
Ex., I like beer.
Conversely, those which are not "simple" are "complex" which is not merely a tautologic definitonal statement. The qualities of the sentence structure are inherently different from simple sentences in that they are composed of groups of words which themselves are manageable as "phrasal constructs". Evaluating each phrasal construct individually BEFORE considering prepositions and thus the relationship of one phrasal group to another phrasal group within the sentence seems to me to be the key here.

For instance,
I like it when Clara sings songs to me.
1. I like *something*
2. Clara sings *something*
3. *to* (in this case) indicates a relationship of something to something or someone (as opposed to a direction, though in the abstract it is simply an ambiguous directional preposition)
4. *when* similarly indicates a relation of time to someone or something (here it relates my liking to Clara's action)

Thus, while I am not familiar with the current HAL code at all and am making a purely linguistic argument, I think that you might want to consider the "thematic structure" of the prepositions themselves.

Does each preposition require or involve
1. an agent who does something, feels something or "is" something (existential)
2. a direction of action
3. a receiver of the action

I can elaborate if desired. This "thematic analysis" method is a well explored theoretic perspective in linguistics and might be worth considering.

If I have stepped on any toes here, sorry.

(First posts are always a gamble.)


It hurts that my 'bot appears to be smarter than I am. Then again, it's a source of pride.

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #35 on: March 05, 2004, 07:24:10 pm »
drmweaver2,
I am not a PhD by a long shot. Our discussions here are usually not so technical, nor lofty in content. Your comments as appreciated.

As humans it is easier for us to comprehend sentences than for computers. To detect certain sentence structures programmers look for "short-cuts" that aren't always linguistically precise. A finite number of words can serve as prepositions. What I am suggesting is that by observation and test when a preposition precedes the word "me" or "I" then the proper pronoun is "me". This appears to be true even in the case in your example where "to" doesn't act as a preposition.

Your example:--------------
"I like it when Clara sings songs to me."
---------------------------
"To" is typically a preposition, but in this case I agree with your comment...

Your comment:--------------
3. *to* (in this case) indicates a relationship of something to something or someone (as opposed to a direction, though in the abstract it is simply an ambiguous directional preposition)
---------------------------
However using "to" (in a non-prepositional role) as an indicator in this case still leads to the correct decision to use "me" instead of "I". I suspect this is true in most cases we encounter in English. In this case "when" relationally links two separate sentences together.

As for...
Your comment:--------------
That said, allow me to make a small contribution or two.
vonsmith said "I don't know of any case where "I" is preceded by a preposition."

There are a number of similar cases where this is not true.
Consider:
1. If I were dead, I would not be breathing.
2. If I were old, being a gigolo would probably not be a reasonable career choice for me.
3. Because I am a guy, brassieres are not part of my wardrobe.
4. When I sing, even dogs howl.
---------------------------
I think I may be missing your point. "If" and "because" are usually conjunctions. In this case they serve as "conditionals", and are not prepositions. The "prepositions only before 'me'" rule still holds true.

I think the correct term for "when" in example 4 is a "relative conjunction". It is more obvious in the example, "Even dogs howl when I sing." It doesn't act as a preposition.

I don't know what "thematic analysis" is. I'll do a little remedial web research on it. Thanks for mentioning it.


=vonsmith= [8D]
 

govsta

  • Newbie
  • *
  • Posts: 10
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #36 on: March 05, 2004, 09:03:12 pm »
If you want a link that explains ti somewhat, here is one.
http://www.acm.org/ubiquity/views/v4i24_kabay.html
Hope it's detailed enough to help.
 

drmweaver2

  • Newbie
  • *
  • Posts: 11
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #37 on: March 05, 2004, 10:20:03 pm »
At the risk of beating a horse that needs no flogging.....merely out of a desire to assist with preposition code development, here is a review of what a couple of old textbooks gathering dust on my shelves suggests with respect to prepositions:

A preposition is generally defined as a word which shows a relationship in time, space, cause or manner between the object of the preposition and another word in the sentence.
A prepositional phrase, which can act as an adjective or adverb, is a preposition plus its object and any modifiers.
The object of the preposition may be a noun, pronoun, or other noun substitute such as a gerund ( -ing form).

Regardless of function in the sentence, prepositions are prepositions – even if used as (subordinating) conjunctions. (Not intentionally trying to get in a p***ing contest, just reflecting what my textbooks say and probably only relevant to truly advanced sentence parsing in HAL or any other discourse analysis. The point here is that words such as and and or can serve only as conjunctions, while some prepositions can serve as both. What they are and what function the serve grammatically in specific situations may be different. Then again, I have three sources that argue differently. ) A preposition implies an adverb (which in turn implies an adjective) in the right circumstances; the converse is not true.

Prepositions usually come before their noun (or pronoun): after the war, people with money, look after this, we talked about my problems. But sometimes they are 'deferred', that is, they come after their noun or pronoun:
ex., They are looked after, What did you talk about?

Josef Essberger, in English Prepositions Listed, (http://resources.englishclub.com/ebepl.htm), claims there are 94 one-word prepositions and 56 complex prepositions used in the English language. If you have identified 87 single word prepositions, vonsmith, that’s pretty good (>92% of what he lists). I could come up with only 70 on my own. Here (http://www.testmagic.com/Knowledge_Base/lists/grammar/prepositions.htm ) is a link to a page listing 110 prepositions.

Complex prepositions include not only two-word, but also three-word prepositions: ex., in case of - in spite of - in comparison with - in touch with - by means of - by way of - on behalf of - on account of - for the sake of - in exchange for - in addition to - with reference to

Preposition types or classifications include:
1. indicators of time – such as before, after, in, since
2. indicators of place – such as at, on, in
3. indicators of movement – to, from, towards
4. those which are or can be paired with nouns where, if separated, meaning does not change significantly.
   Ex., approval of-----fondness for-----love of-----participation in
5. those which are paired with adjectives to link the modifier to the noun being modified.
   Ex., afraid of-----angry at----- careless about
6. those which are paired with verbs in such a way as to create verbal phrases.
   Ex., apologize for-----give over-----trust in-----bring up

There are also many situations where idiomatic expressions have developed. For instance, one agrees to a proposal (but proposals are not entities which can be agreed with); one can argue about a matter (but about implies dimensionality not location – a difference shown in “walk about”); and one can correspond with a person, not correspond to him/her (although things can correspond to each other).

Another consideration is whether or not the intent is to indicate the completion of an action (as in “fell on (to) the floor”) or simply a position or location (ex., “x is on the floor”).

The word “to” is particularly problematic as it is used when not acting as an ordinary preposition, but as part of an infinitival verb phrase. No others propositions act in this particular fashion as far as I can tell.

To
1. can be used as verb + to + infinitive to express willingness, desire, intention or obligation
….ex., to be willing, (to) ask someone to do something, (to) plan to graduate
2. to + infinitive +([optional]to) + location/object
….ex., to walk (to), to speak (to), but also to write (to)
……...however, consider (to) drive toward
Another point to remember is that certain prepositions frequently occur in pairs within a sentence. The most common of these are:
1. From-to (distance, time, and degree ranges)
2. From-until/till (time ranges only)
3. Out of-into (change of enclosure or state)
4. Off (of)- On (to) (change of location with verbs like take and put)
Some participles, such as concerning and considering, are used as prepositions.

But is a seldom used preposition. When it is used as such, but means the same things as except. Ex., Everyone laughed but(except) John. But usually functions as a conjunction.

The most commonly used prepositions are probably:
aboard, about, above, according to, across, across from, after, against, along, alongside, alongside of, along with, amid, among, apart from, around, aside from, at, away from, back of, because of, before, behind, below, beneath, beside, besides, between, beyond, but, by, by means of, concerning, considering, despite, down, down from, during, except, except for, excepting for, from, from among, from between, from under, in, in addition to, in behalf of, in front of, in place of, in regard to, inside, inside of, in spite of, instead of, into, like, near, near to, of, off, on, on account of, on behalf of, onto, on top of, opposite, out, out of, outside, outside of, over, over to, owing to, past, prior to, regarding, round, round about, save, since, subsequent to, together, with, through, throughout, till, to, toward, under, underneath, until, unto, up, up to, upon, with, within, without  
It hurts that my 'bot appears to be smarter than I am. Then again, it's a source of pride.

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #38 on: March 06, 2004, 12:37:29 am »
drmweaver2,
I think we strayed off point. My goal was to validate an approach to correct the usage of the pronouns "I" or "me" in Hal's sentences. One small part of this approach is to observe the use of a preposition immediately preceding either an "I" or "me" in a sentence. Examples of this type of detection and correction are:

Original Sentence: "You want to talk to I." (preposition "to" detected)
Corrected Sentence: "You want to talk to me."

Original Sentence: "Read the book for I." (preposition "for" detected)
Corrected Sentence: "Read the book for me."

For basic "I/me" correction the detection of single word prepositions appears to work well in these cases. Esoteric applications of prepositional theory don't seem to change the basic premise. Refer to the prepositions you have listed in your post. Is there any case where any of those prepositions or prepositional phrases would immediately precede the pronoun "I" in any typical person's sentence? I haven't identified any such cases yet.

The word "together" in your list seems more like a part of a prepositional phrase than preposition, but I guess that depends on how rigorous we get in our definitions. The list of prepositions I've compiled includes 77 single word prepositions in common use, but so far the list doesn't include "together". I need to find an example of a sentence with "together" preceding the pronoun "me" before adding it to the list.

Prepositional phrases are not included in the list since all the ones I'm familiar with end in a single word preposition. Only the single word immediately preceding the pronoun is needed to satisfy the detection method. Therefore the list covers more than 77 cases. The web site you referenced says there are 94 single word prepositions. I wonder what the 17 missing prepositions are?

These are the common prepositions I have found:
ABOARD, ABOUT, ABOVE, ACROSS, AFTER, AGAINST, ALONG, ALONGSIDE, AMID, AMIDST, AMONG, AMONGST, AROUND, AS, AT, BEFORE, BEHIND, BELOW, BENEATH, BESIDE, BESIDES, BETWEEN, BETWIXT, BEYOND, BY, BUT, CONCERNING, CONSIDERING, DESPITE, DOWN, DURING, EXCEPT, EXCEPTING, EXCLUDING, FOLLOWING, FOR, FROM, IN, INSIDE, INTO, LIKE, MINUS, NEAR, NEARBY, OF, OFF, ON, ONTO, OPPOSITE, OUT, OUTSIDE, OVER, PAST, PER, PLUS, REGARDING, ROUND, SAVE, SINCE, THAN, THROUGH, THROUGHOUT, TILL, TO, TOWARD, TOWARDS, UNDER, UNDERNEATH, UNLIKE, UNTIL, UP, UPSIDE, UPON, VERSUS, WITH, WITHIN, WITHOUT


=vonsmith=
 

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Hal's new XTF Brain is finally released.
« Reply #39 on: March 06, 2004, 02:20:11 am »
Hello!

THANK YOU, everyone, for the wonderful postings and the excellent contributions and interest!  And, welcome new members!

Here are the main points I should have said about Hal's pronoun-reversals:

1.  Before re-inventing the wheel or discarding the old one, examine the "substitutions.brn" and "corrections.brn" databases and understand their structure, content, and intent.

2.  Hal's pronoun-reversals, imperfect though they may be, give Hal an advantage in the current market.  The reason that so many other chatterbots DON'T have "real time learning" is because their authors haven't yet figured out, or bothered to construct, a decent pronoun-reversal routine.  (Some have, and my hat is off to them!)

3.  If we add, delete, or change a feature, we should include the following criteria to evaluate the change: a) does it work better, and b) does it avoid introducing new problems or errors?

4.  The concept, structure, and intent of the existing substitutions.brn and corrections.brn databases include the idea of upgrading their content to improve Hal into the future.

By the way, I thought of a couple of other technical-history pronoun items that might be useful to share:

A. There was an early-legacy pronoun-reversal routine in the function that creates new database entries for the "specific recall" databases (the databases that have all the complex arguments).  That early pronoun-reversal routine doesn't work reliably, but it's buried in a .dll or .exe file somewhere, and has never been removed.  For that reason, if you examine the .uhp "control scripts," you will find some elaborate work-arounds designed to AVOID triggering that early-legacy behavior.  (For example, pronouns get encoded and decoded at times, so that the function never "sees" a pronoun.)

B.  The substitutions.brn and corrections.brn databases contain some word substitutions that are a matter of artistic choice.  For instance, there's a special case for "tell you" (as noted above by Vonsmith) and a few other phrases that don't reverse well.  

C.  There are also a few (legacy) automatic word substitutions in the .exe or .dll files, beyond the reach of us script-writers.  They don't come up very often, but they can cause vexing problems when trying to hunt-down the source of an inappropriate response.

Anyway, I'm delighted by the participation and contributions!  

All I'm suggesting is before we start a major "re-wiring job," we give ourselves a fair chance to "study the schematic!"

Thank you so very much -- if I can answer more "legacy" questions, or if I can think of similar items, I'll contribute more to this thread.

Sincerely,

Don
« Last Edit: March 06, 2004, 02:47:46 am by Don Ferguson »
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Hal's new XTF Brain is finally released.
« Reply #40 on: March 06, 2004, 02:43:11 am »
Hello,

The attached special brain file can be used as a tool to test and fix problems with pronoun reversals.

It is a "Repeat Back with Pronoun Reversals" brain.

When you select this brain from Hal's menu, Hal will simply repeat back anything you say, using the current routines and databases for pronoun reversals.

It is a very handy tool.  (You can also use it to create "Radio Shows" by recording Hal's voice to a tape recorder or to the Microsoft Sound Recorder that's on Windows computers.)

Simply download the file and "save" to the following path and folder if you have Hal 5:

C:/Program Files/Zabaware/Ultra Hal Assistant 5

(Remember, our forum software can't display backslashes, so I've used forward slashes.)

Once you have the brain in your correct Hal folder, it will show up on your list of "Brains" in your Hal's "options" dialogue box AFTER the next time that you restart Hal.

I hope that this is of some utility!

Sincerely,

Don


Download Attachment: Repeat Back with Pronoun Reversals.uhp
11.28 KB
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #41 on: March 06, 2004, 03:03:31 am »
Thanks Don,
That "Repeat Back with Pronoun Reversals" brain is a handy tool to have. It works just fine.

I'm not planning on creating an "I/me" correction function just yet. I'm enjoying learning about the problem and the possible approaches. That's half the fun of owning a Hal. Hal has given me a good excuse to learn the basics of VBScript this last 5 months. There is still so much to learn.

Rest assured I won't program anything that doesn't expand Hal or improve on his current capabilities.


=vonsmith=
 

HALImprover

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • BrianTaylor.me
Hal's new XTF Brain is finally released.
« Reply #42 on: March 06, 2004, 03:23:26 am »
Since we are on the subject of legacy functions in Hal maybe someone can explain the TopicSearch function in better detail. I understand that it searches backwards through the sentece for keywords in the given .brn file and the file is searched from top to bottom. What I would like to know is how each word from that file is handled. Does Hal take the first word in the .brn file and search the entire sentence for that word or is the last word in the sentence compared to every word in the .brn file, then the second last word, etc?

 Also, I have been wondering about how the Hal program handles file read/write access. When a .brn file is accessed for a function, say the TopicSearch function, is the file closed once the function is completed? I believe that it is not because of the 'Too many files' error that vonsmith mentioned. If the files were closed after their use than there should not be any error in this regard. Hopefully Zabaware will correct this issue in the next release.

 Any help would be greatly appreciated.
Living life with a loving heart, peaceful mind, and bold spirit.

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Hal's new XTF Brain is finally released.
« Reply #43 on: March 06, 2004, 11:30:20 pm »
Hello HalImprover,

I hope that additional members will help answer your questions, especially the first question.  

Regarding your second question, I can report the following:

1.  I have never seen the "too many files" error message during many editing sessions with Hal over many years, generating thousands of files.  

I always test new code in "real time"; that is, I run my editor in one window, and Hal in a different window.  Each time I write some new code, I toggle back to Hal and say something to him, to make sure that he still works.  Then, if I get an error, I can find my mistake when it's still "nearby and warm" instead of a "needle-in-a-haystack and cold."  

Generally, the only time I've experienced any error messages at all has been when I've introduced syntax or type-mismatch errors into code, and caused Hal to "hang" due to my own mistake.  In those cases, I found that Hal would malfunction various ways until I completely closed and re-opened Hal; in severe cases, I had to re-boot!  But I want to stress:  I know that I originated those problems myself.

2.  I use the Zabaware brain editor to edit the .uhp control scripts (because of the excellent color-coding and line-numbering in Robert Medeksza's Brain Editor), and I use Microsoft Word to edit the .brn databases.  I have found the following, interesting behavior between Hal and Word:

a) When Hal is operating normally, I never have a problem opening a file with Word that Hal has just (moments ago) accessed.

b) I never see any indication that Word or any other application thinks a file is still open after Hal has just read it, or written to it.

c) However, when I have a .brn database file OPEN IN WORD, I have found that Hal CANNOT write to it; Hal doesn't report any error messages, but Hal writes absolutely nothing to a given database file while that file is open in Word.  That tells me that because Word has the file open, Hal can't write to it.  As soon as I close the file in Word, Hal can immediately write to that file normally, on the very next conversational exchange.

The above observations cause me to think that Hal does close and relinquish the file after each read or write event.  I could be wrong, and I'm certainly interested in hearing more input on this.

Sincerely,

Don
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
Hal's new XTF Brain is finally released.
« Reply #44 on: March 07, 2004, 01:04:26 am »
HALImprover,
Your question 1) Based on my experience and observations what happens with the topic search function is as follows.

Function has the form:
HalBrain.TopicSearch(STRING_BEING_SEARCHED, WorkingDir & "FILENAME.brn") = "RETURN_VALUE"

The topic search type .brn files have the form:
"KEYWORD1","RETURN_VALUE1"
"KEYWORD2","RETURN_VALUE2"

The topic search function starts at the bottom of the topic file being searched and works its way up the top of the file.

Example:
UserSentence = " GIVE ME MY BIRDY . "

Topic file contents:
" GIVE ","STRING1"
" BIRD","STRING2"
" BIRD","STRING3"
" BIRD ","STRING4"

RETURN_VALUE = HalBrain.TopicSearch(UserSentence , WorkingDir & "TOPIC_FILE.brn")

RETURN_VALUE = "STRING3"

The string "STRING4" is not returned because " BIRDY " doesn't match " BIRD ". The string "STRING3" is returned because " BIRDY " does match " BIRD". In fact " BIRD" would match " BIRDS", " BIRDBATH", or even " BIRDBRAIN". Using spaces on the ends of the search terms are a typical method used in Hal to search for whole words only. Notice the second line never gets a chance to return "STRING2" because the function has already matched to line three. The same goes for line one. The string " GIVE " never gets searched.

I'm pretty sure that is how it works. I created a special topic search routine in the XTF Brain that supplements the HalBrain.TopicSearch() function to exhaustively search for topic words in a sentence. Hal's topic search can't do it alone. Based on observations of the XTF Brain the search is from the bottom of the file up until the first match is found. The special XTF routine gets the first word found and then deletes it from the sentence being searched. Then that sentence is searched again and if a match is found then it is deleted from the sentence. And so on, until all topic words are found in the sentence. This is one of the methods used in the XTF Brain to make it more selective and comprehensive when looking for topics.

Your question 2) I believe the "too many files" error message might be more prevalent today because of the Wordnet function. When I did exhaustive searching of the Wordnet data base I got the "too many files" error when I selected a Wordnet word that happened to have a very long list of associated data. Running a loop function around searching and/or returning values from Wordnet and then writing them to a file can burn up file handles. I believe (not totally certain) that each access to a file uses up one file handle. A handle is just a variable that represents a temporary path to the file requested. VB has its limits. For search loop situations it is best to accumulate data in one variable and write that data once to a file. That solved my error.

I think (fingers crossed) my assessment is accurate. I hope I answered your question.


=vonsmith=