AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Pre-chatbot, it’s my syllogism program
 
 
  [ # 61 ]

I loved Chaktar when I saw it for first time. It’s quite funny.

It’s new function is quite interesting.
I tryed it with the word moon .

1-billion
2- satellite
3- bookshelf
4-snowball

After it associated moon with satellite

No satellite is here
a moon is a satellite
no moon is here

I did it with a lot of other words and all associations had a kind of logic.
It’s very interesting how it put associations but I can’t imagine all the associations without pages and more pages of code.
Good!

 

 

 

 

 
  [ # 62 ]

Ah that was you Fatima? I saw some of your other results too.

Humanassoc bat
Chaktar
dresser
   2 
hail
   3 
mountain
   4 
vampire
  
   Ah
vampire seems to jump out at me for that one.
  
   
No vampire is here.
   
a bat is a vampire.
   
No bat is here

Would it surprise you to learn that I created my “syllogism program” in about an hour earlier today with less than a dozen categories of AIML? Certainly not pages and pages of code.

 

 
  [ # 63 ]

Steve,

I knew you had made the “syllogism program” these days, because of the similarity to the Jeremy’s.

What intrigued me was the association between words. I had the impression that if I typed some 1000 words, I would have logical answers for each. And I know that AIML needs “in some way” specific inputs/outputs. So I was intrigued by the size of the code.
But cool!!!!
And very interesting.

 

 
  [ # 64 ]

The code to do word association is not that difficult or lengthy. The magic is in using variable arrays that match the word to a list of related words with a root meaning(s).

Word: wall
Returns: building/structure
Related: floor, roof, door, window

I know this is not quite the same thing as Jeremy or Steve have done, but IMO far more useful.

 

 
  [ # 65 ]

Hu, I think Chatkar doens’t like me very much. All he gives me is chibberish, no word associations…
ha, figured it out, I forgot the ‘assoc’ in the bottom (Hey, it’s still morning, to lazy to read the whole screen wink )

mine was: meatballs
response:
-chocolate
-smelly meatballs
-bite
-spy

the one that strikes me most is smelly meatballs

-> nope it was ‘bite’ cause that’s what I want to do, not have smelly meatballs LOL

 

 
  [ # 66 ]

Jan - It gave a strange reply to meatballs, as that wasn’t in the quick dictionary I knocked up for him. I added a generic catchall to words that were unfamiliar.

Laura is correct, this was merely an exercise in coding and has little use.

 

 
  [ # 67 ]

The explanation for my program:

int split_by_sentence(void)
Receives input from the user. A sentence with a period or multiple sentences, each sentence must have a period.
Writes the result to readtext.txt.

int main ()
Reads the readtext.txt file, sends a sentence/line at a time to the redefined_sentence function.

void redefined_sentence (char* sentence)
Receives the sentence and splits it into a word per line and writes the result to list.txt.

This word per line file is opened and read a line/word at a time in a while loop, till the file is all read.
The word is broken down into a single char and compared against a char array of consonants, to see if the word is a consonant.

If the letter is a consonant the result is written to intermediate.txt, only the consonant version of the word is written to the file.
When this happens,  a integer is changed from zero to one.

In a different part of the while loop, it checks to see if the integer has changed, if it has the whole word is written to consonant_words.txt.

Now intermediate.txt and consonant_words.txt are closed and the while loop is finished.

Now intermediate.txt is opened again and the last word of the file is passed into the variable ‘last’.
Then intermediate.txt is closed.

Then intermediate.txt and consonant_words.txt are opened again.
In a new while loop, if the letters in ‘last’ is the same as the word in intermediate.txt, the whole word version from consonant_words.txt is written to comparison.txt and last_word.txt.
Now comparison.txt has words from the sentence that share consonant letters with the last word of the sentence.
comparison.txt is needed in the percentage calculation later on.
Now intermediate.txt, consonant_words.txt, comparison.txt, and last_word.txt are closed and the while loop is finished.

Now comparison.txt is opened again and the matching words are printed on the screen.
This is not the whole sentence,  onlt the last word and words with matching consonants: paraphrase version, to get to the truth of the sentence.
Now comparison.txt is closed.

Now last_word.txt is opened again, the last word is put into the sentence “The last word is:”.
Now last_word.txt is closed.

Now comparison.txt is opened again, and the word is put as a variable, along with the variable ‘message’ in the percentage_calculation function.

void percentage_calculation(char *a_pch, char *message)
Now the sentence from comparison.txt is broken down into a word per line, and each word is individually put into a while loop.
The whole loop places the word into one of four categories, with ‘B’ being consonant and ‘A’ being vowel: ABA, AB, BA, BAB.
Then all words now given one of these four values the math is done to see how much percentage wise a type of word was used in the sentence.
Then, using if statements I check to see which of the four values was the largest, and the result is passed back into the ‘message’ variable and sent back to the redefined_sentence function.
Also the percentages are printed on the screen.

Now back in the redefined_sentence function, it puts the ‘message’ and ‘last_string’ variable into the word_generator function.

void word_generator(char* C_F_two, char *message)
C_F_two = ‘last_string’ variable.

Using if statements, I check if the C_F_two word has a vowel and letter value, if it does the vowel, letter, ‘C_F_two’ and ‘message’ variables are passed into the search function.

void search(char *src, char *a, char *b, char *c, char *message)

Opens the readfile.txt, which has the dictionary and using a while loop goes through the dictionary a word at a time.
I pass the first character and second last character of the dictionary word into their own variables.
Then, using a for loop I break the dictionary word into individual characters/letters.
Then, in the same calculation: I check if the vowel is one of the letters from the for loop, and if the letter is either the first character or second last character of the dictionary word.
So all these steps are per-qualifiers.
If a word qualified the number value is incremented by one, the value is never reset so the value increases with qualified words.
Then I choose qualified words based on their number and save them to a variable to be displayed later.
How the number qualifies the word is like ducks flying through the air during migration, the leader is neither the first or last word, so I wait for a few results then pick one.
Yes, I used ducks to model my code, don’t laugh, I got the idea after watching a mythbusters episode on the tv.

Then I print the four results to screen, and using the ‘message’ variable I compare it to see the value of message and print the result in the sentence:
“printf(“The result using Analysis part ones data is: %s\n”, d_d);”, where d_d is one of the qualified words.

The I close the program. So a lot of steps but they aren’t rocket science steps, I think. The code was made by a novice C programmer, me, so it’s not ultra advanced sci-fi code.

Here is a short version of the description:

int split_by_sentence(void) takes articles and breaks them down into a sentence per line so articles can be fed into the program.
void redefined_sentence (char* sentence) created a hidden sentence from a sentence that reveals the hidden truth the writer is thinking as he writes,
then uses this to make a percentage which is then fed into the search function to print the matching qualified word.
void word_generator(char* C_F_two, char *message) ID’s the vowel, letter combination of the word and goes to search function.
void search(char *src, char *a, char *b, char *c, char *message) qualifies words, then picks the word after x number to make sure it is not the first or last result.
And using the word from percentage function prints that below the four matching words.

I wrote this because I thought you might be confused if you only read the code without me telling you what happened.

There’s only 1931 lines.
I wish I knew enough C to make it smaller, but I don’t.

 

 
  [ # 68 ]

Link to updated program:

http://www.mediafire.com/?5a89ufu3jpsxyp9

Sometimes the program would get multiple results, all the same but it broke the rhythm, so I fixed that, now you should get a result based on the percentages every time, unless the case of the last word the program uses is different than the rest of the sentence.

 

 
  [ # 69 ]

http://www.mediafire.com/?m7xc625pw6zba99

Link to new program. I updated the program today but I was in a rush so did the job incorrectly, I’m sorry.
This release fixes a bug that the percentage based result was not there or was wrong.
Happy new year or new years eve to you.

Besides corgi.c, you need these text files:

bad.txt
comparison.txt
consonant_words.txt
intermediate.txt
last_word.txt
list.txt
m_and_s.txt
readtext.txt
readtext1.txt
writelist.txt
readfile.txt

readfile.txt needs the diction from sourceforges ‘kevins word list’.
I use the Official 12Dicts Package, I copy and paste the contents of ‘2 of 12.txt’ into readfile.txt.

To open the corgi file I uploaded, remove the txt extension and then unzip it.

File Attachments
corgi.zip.txt  (File Size: 7KB - Downloads: 86)
 

 
  [ # 70 ]

I get the feeling that some people have to much time on their hands.

 

 
  [ # 71 ]

Laura - I agree. I am not sure why anyone would spend weeks writing something like this in nearly 2000 lines of code.

Jeremy, you should try looking at AIML. I produced the same results as you using about 10 categories (roughly 50 lines of code) and it only took me an hour.

http://www.square-bear.co.uk/chaktar/chaktar.html

 

 
  [ # 72 ]

I’ve updated my C program and lowered the number of lines in the source code from 1931 to about 1000.
Also some usless variables were removed, so some code cleaning was done too.
And I broke the code down into another function, so the functions are a bit easier to read and understand I hope.

http://www.mediafire.com/?pqqrk0oyzmba33t

I’ll also upload the source code, in case you don’t want to dl the folder.

Is your program using percentages too? I just see some random words generated in your program.
My program uses percentages to guess the best of four possible answers is the right one.
My program reveals the hidden the hidden sentence in sentences.
So if all my program did was take a word and make a rondom guess then you would be right, but I do a lot of calculation in my program, not ‘pin the tail on the donkey’.

File Attachments
corgi.zip.txt  (File Size: 5KB - Downloads: 88)
 

 
  [ # 73 ]
Jeremy Duncan - Jan 1, 2012:

Is your program using percentages too? I just see some random words generated in your program.
My program uses percentages to guess the best of four possible answers is the right one.

It displays 4 random words and it uses a scoring system for each word and displays the most likely. I just see random words generated in your program too, “friend asteroid” for example.

Jeremy Duncan - Jan 1, 2012:

My program reveals the hidden the hidden sentence in sentences.

I have no idea what you mean by that. All I see is that my program produces the same output as yours. The only difference being yours is hundreds of lines long and took weeks to write and re-write. Mine was a bit of fun which I coded in an hour in about 50 lines.

 

 
  [ # 74 ]

I have further updated my code. I have tweaked some if conditions and nested them to make the source less lines of code.
The global variable “red” is actually used in line 613.

The new link to the source and program.

That quote you didn’t understand was a typo.
What I’m sure your program doesn’t do but mine does is display the sentence the user inputs into a new version where each word in the sentence shares at least one consonant letter with the last word.
If the word doesn;t share at least one consonant letter with the last word it isn’t displayed, this is the sentence I use for percentage calculation.

I find this shortened version of the sentence to be a revealer of a hidden message in sentences.
Try some sentences yourself, my program has been updated since the ‘friend asteroid’ result.

What I’m thinking of doing now is generating a word for every word in the shortened version of the sentence and showing that result. But it might look funny.
Just looking at what else I might do to make the results more interesting than just one word.
But I might just leave the project now, why continue when you and that lady have shown me that random results are wrong.
So some problem solving may be in order before I update the code again.

File Attachments
corgi.zip.txt  (File Size: 5KB - Downloads: 80)
 

 
  [ # 75 ]

If you are trying to find relationships between words, I suggest you try to use a thesaurus in your application. This will allow you to do things like this:
complete the sequence

 

‹ First  < 3 4 5 6 7 >  Last ›
5 of 9
 
  login or register to react
‹‹ MALDIX      SMS ChatBot ››