Author Topic: how could i capture words into an array  (Read 6226 times)

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
how could i capture words into an array
« on: April 06, 2005, 07:08:31 am »
QUESTION:

i would like a function to capture the usersentence into an array.:

this would enable us to do a deeper search: of the user input:

ie once the words are in the array, i would be able to search each word : ie, check if noun, if verb, if keyword, :

would this not help in removals  also,

if user said "i am happy"

i am <<<< describes USER STATE. "about self linking verb = true"
+
happy <<< adjective "EMOTION" / Keyword "HAPPY"

therefore user is describing EMOTION about SELF.... build response..

response = "CONGRAT about state of being" or "describe HAL CURRENT EMOTION" or ETC...

HAL realizes now What was said::: How to RESPOND.

even more better will be building MORE FOCUSED responses from SENTENCE GENERATORS, Chooseing sentences from files as we can now select a sentence from a file Where at LEAST 2 - 3 topic KEYWORDS match the usersentence. this keeps the conversation more RELEVENT.


ie if talking  religion: we dont want hal just to randomly Spurt out something learned, YET if we haven preprogramed a response to the userQUESTION ie the user is conversing rather that asking a FACT which we have put in his DATABASE or Q&A files.

we could select a much more focused response from a sentencefile even if its just a quip.

ie : "i like to speak to GOD"

detects religion >> (remove as KEYWORD) "GOD"
DETECTS user describing SELF > ( remove as "linking verb) "i like to"
leaves "speak to" <<< (remove as Xtra Keywords)

when building a response now we search brain file for "GOD" and "Speak to" for a like matching sentence>>>>>

PRODUCT = "when we SPEAK TO GOD we pray"

Now you can see the type of power we could have:

:::


thats why i need to be able to capture words to an array :::

if anybody knows how to then build the FUNCTION and post it up OR contact me and SHOW ME how... please THANKS
 





spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
how could i capture words into an array
« Reply #1 on: April 06, 2005, 07:43:26 am »
Source code

Public Function com_CountWords(phrase As String) As Integer  
'RETURNS THE NUMBER OF WORDS IN THE PHRASE  
Dim i As Integer  
Dim c As String  
Dim prev As String  
Dim count As Integer    
If (phrase <> "") Then    
count = 1    
i = 0    
prev = ""        
For i = 1 To Len(phrase)      
c = Mid$(phrase, i, 1)      
If (prev = " ") And (c <> " ") And (c <> "#") Then        
count = count + 1      
End If      
prev = c    
Next  
Else    
count = 0  
End If    
com_CountWords = count  
End Function

this function is to count the number of words in a string maybe this can help:::

just drop this at the bottom of your script and call the function as needed.......




onthecuttingedge2005

  • Guest
how could i capture words into an array
« Reply #2 on: April 06, 2005, 02:02:05 pm »
quote:
Originally posted by spydaz

QUESTION:

i would like a function to capture the usersentence into an array.:

this would enable us to do a deeper search: of the user input:

ie once the words are in the array, i would be able to search each word : ie, check if noun, if verb, if keyword, :

would this not help in removals  also,

if user said "i am happy"

i am <<<< describes USER STATE. "about self linking verb = true"
+
happy <<< adjective "EMOTION" / Keyword "HAPPY"

therefore user is describing EMOTION about SELF.... build response..

response = "CONGRAT about state of being" or "describe HAL CURRENT EMOTION" or ETC...

HAL realizes now What was said::: How to RESPOND.

even more better will be building MORE FOCUSED responses from SENTENCE GENERATORS, Chooseing sentences from files as we can now select a sentence from a file Where at LEAST 2 - 3 topic KEYWORDS match the usersentence. this keeps the conversation more RELEVENT.


ie if talking  religion: we dont want hal just to randomly Spurt out something learned, YET if we haven preprogramed a response to the userQUESTION ie the user is conversing rather that asking a FACT which we have put in his DATABASE or Q&A files.

we could select a much more focused response from a sentencefile even if its just a quip.

ie : "i like to speak to GOD"

detects religion >> (remove as KEYWORD) "GOD"
DETECTS user describing SELF > ( remove as "linking verb) "i like to"
leaves "speak to" <<< (remove as Xtra Keywords)

when building a response now we search brain file for "GOD" and "Speak to" for a like matching sentence>>>>>

PRODUCT = "when we SPEAK TO GOD we pray"

Now you can see the type of power we could have:

:::


thats why i need to be able to capture words to an array :::

if anybody knows how to then build the FUNCTION and post it up OR contact me and SHOW ME how... please THANKS
 







Hi Spy

Ziggy's The word 5.2 already has the UserSentence array built in to its brain.
Take a look at the custom memory in the brain and you will see that Ziggy stores 10 of the most recent Usersentences in Ziggy's own custom memory.

Ziggy was designed to be memory passive so that more custom memory arrays could be plugged in.

I hope this helps.
Best of wishes and brand new discoveries.
Jerry.

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
how could i capture words into an array
« Reply #3 on: April 07, 2005, 04:53:31 am »
I have recently looked into the ziggy brains and tested them all now::
i have seen a simular type script but i am looking for a more universal script::
that can be called from the main script as a function:::

thanks...

just a point of interest JERRY:

the ziggy brains are good BUT:
they execute too slow, the main problem is that they have too many repetitive scripts. i could be a faster script if you cvonverted these repetitve scripts into functions. this drastically speeds up the script, making the getresponse function shorter and structured:::

you see the more files you search the slowwer the script executes, hmm simular problems with VONSMITHS XTF after major useage::

even VON if he turn his XTF topic generator into a Single function it would be easier to intergrate into NEW BRAINS:: Maybe thats whe he done IT.. (he should know better)... he hee ...

after converting my brain to functions it makes it easier to ADD MORE::: and control PROGRAM FLOW: it runs ver fast :: esecially now that i no longer use *.BRN files just a single *.MDB file::: containing KEYWORDS / QABRAIN / TOPICS /SUBTOPICS TOPIC RESPONSES/
now all searching is done with SQL... AND NO idid not need no EXTRA PLUGINS....

now if i ask or want to add FACTUAL DATA ITS EASY: if i ask a QUESTION thats already in there it AUTOMATICALLY answers correctly:
the datbase has the highest priority in my brain: then it goes to other scripts and functions::

PS : i figured out the best part of the XTF:::: it uses the wordnet to create the RELATED TOPICFOCUS FILES::: VERY SMART ::: this gets all the KEYWORDS for EACH NOUN (TOPIC) .... GOOD GOOD ....


jsut a quck observation still <<< still feel the love

onthecuttingedge2005

  • Guest
how could i capture words into an array
« Reply #4 on: April 07, 2005, 01:30:55 pm »
Hi Spy.

Could you float me a samle of the project your working on with functions embedded I would love to see the work your doing.

Thanks.
Jerry.

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
how could i capture words into an array
« Reply #5 on: April 08, 2005, 06:58:12 am »


Download Attachment: AICOMs.zip
111.5 KB


here is a few of the functions inside my project:: compiled in a chm file

onthecuttingedge2005

  • Guest
how could i capture words into an array
« Reply #6 on: April 08, 2005, 02:01:18 pm »
quote:
Originally posted by spydaz



Download Attachment: AICOMs.zip
111.5 KB


here is a few of the functions inside my project:: compiled in a chm file



Thanks Spy.
Very helpful indeed.
How long before the first public prototype?
Jerry.

Darius

  • Newbie
  • *
  • Posts: 20
    • View Profile
how could i capture words into an array
« Reply #7 on: April 08, 2005, 03:29:04 pm »
Amasing, IMHO many of us, will be expecting your App.

I don't understand your request, you look like a good programmer, but if you want to make an array of words of a User sentence of characters english alike (not ä or é or else), must look something like this.

Dim Words(130) As String, WordIdx As Long

Sub SplitByWords(ByRef USERSENTENCE As String)
Dim CH As Byte, i As Long, j As Byte  ' Note that strFields is a dynamic array of strings
  WordIdx = 0
  For i = 1 To Len(USERSENTENCE)
    CH = Asc(Mid(USERSENTENCE, i, 1))
    If (CH > 64 And CH < 91) Or (CH > 96 And CH < 123) or CH=39 Then
       j = j + 1
    Else
      If j <> 0 Then
        Words(WordIdx) = Mid(USERSENTENCE, i - j, j)
        WordIdx = WordIdx + 1
        j = 0
      End If
    End If
  Next i
  If j <> 0 Then Words(WordIdx) = Mid(USERSENTENCE, i - j, j) Else WordIdx = WordIdx - 1
End Sub

Private Sub Command1_Click()
Dim i As Long
   SplitByWords speaktext.Text
  For i = 0 To WordIdx
    MsgBox Words(i)
  Next i
End Sub

being speaktext your textbox

I hope to understand your question and that this code could help you.
 

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
how could i capture words into an array
« Reply #8 on: April 09, 2005, 10:06:28 am »
quote:
Originally posted by spydaz

after converting my brain to functions it makes it easier to ADD MORE::: and control PROGRAM FLOW: it runs ver fast :: esecially now that i no longer use *.BRN files just a single *.MDB file::: containing KEYWORDS / QABRAIN / TOPICS /SUBTOPICS TOPIC RESPONSES/
now all searching is done with SQL... AND NO idid not need no EXTRA PLUGINS...


PS : i figured out the best part of the XTF:::: it uses the wordnet to create the RELATED TOPICFOCUS FILES::: VERY SMART ::: this gets all the KEYWORDS for EACH NOUN (TOPIC) .... GOOD GOOD ....





Ok Hero! Post your brain so I can play with it... I'm especially interested in your use of MDB... And wordnet!!!


 

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
how could i capture words into an array
« Reply #9 on: April 11, 2005, 04:38:02 am »
WHAT I have always wanted from ZABAWARE was A REAL DEVELOPMENT KIT...

Which covered brain building / Skinning / speech tweeking...

After all the questions i have asked for help / emails sent to MR M.

I was unable to get the HAL as an activeX or explanation on how to REFFERENCE THE DLL..

But now I dont use the ZABAWARE hal no more (only to read the popups / CLIPBOARD) some of my favorite functions..

i use my own total prog...

i am slowly backing away from the hal DLL too. as the functions which i use in the DLL i have been able to either REVERSE ENGINEER of Make A SIMULAR function...

the HELP FILE I HAVE POSTED SHOWS how I HAVE been able to convert some of the scripts from DIFFERENT VERSIONS of hal...



I would advise all AI Programmers to download ALL previous VERSIONS of hal..

i have found that HAL3 has a very funny outlook and a different PERSONALITY that HAl4.5 which is very CHATTY, HAL5 less smarter and less funny than PREVIOUS VERSIONS..

EACH VERSION has DIFFERENT TRAITS EVEN with the same brainfile in use...

So each hal has its qualitys that need to be clonened.
I am currently adding a script control to my AI project (public BRAIN) so that it may become open sourced... just like HAL....

SOON SOON..

PS: i am dieing for the new hal... BUT MY FAV was HAL4.5 enhanced.. XTF was my second.

Dr.Benway

  • Hero Member
  • *****
  • Posts: 554
    • View Profile
how could i capture words into an array
« Reply #10 on: April 11, 2005, 07:41:43 am »
Dear Spydaz,

Where can I find older versions of Ultra Hal on the web?

Greetings,

Dr.Benway

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
how could i capture words into an array
« Reply #11 on: April 12, 2005, 07:59:13 am »
i did actually find them in the FTP of the zabaware site:::

but nowdays the site is a little more secure::


I would do a SEARCH for HAL3 Ultrahal. + GET the Enhanced brain...

A lot of the best convertable brains scripts


Seven

  • Newbie
  • *
  • Posts: 36
    • View Profile
how could i capture words into an array
« Reply #12 on: April 18, 2005, 05:59:32 pm »
Yo spy,

any chance you'd make that new prog. avalable for download one day?
also, does it support speach rec?  AND, did ya forget about my huminoid brain topic, cuse this whould help in that.

that, and large sums of donated money, because iam poor.  but one step at a time.

-Seven-
Sarge-"Options are Optional."

www.redvsblue.com

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
how could i capture words into an array
« Reply #13 on: April 20, 2005, 04:38:39 am »
Im am currently Looking for webspace: / HOSTING /

And building a PUBLIC AI with an added  scriptcontrol for External BRAIN SCRIPTING.

I have also been working with Mindmodel to create the BRAIN DATABASE.

Currently i have made the
ACTIVEX Chatwindow control

2 .DLL's One for FUNCTIONS/COMMANDS needed to program the AI.
         ONE for My built in BRAIN RESPONSE / DETECTORS

I am using A MS AGENT also as a Character interface....

Currently i am looking for a way to ADD the Functionality of the WORDNET, JUST AS Mr M has in hal5.

I would like to remove THE HAL.DLL from MY Project. If i cant add this Wordnet feature ie: Gethypernym etc. then i will have top continue to use the dll. ( i would rather NOT)

I am also Working on and AUTOTOPIC brain of my own to work within the DATABASE BRAIN...


REMEMBER : Its only me making this.. no help:

I have made and remade the project many times: "im in the testing Phase" testiong the Installer, everytime i do one there always seems to be something missing.... SOON KRAK IT.

Currently The Project size is 62 MGBYTES