|
I finally decided what I was doing for my senior project. Being a senior, I don't have a lot of time and the project I am working on will take a considerable amount of time probably.
It is a basic computer to human Korean conversation program. You can pick either romanized Korean (annyeonghaseyo) or hangul Korean (인녕하세요). Then the computer will start off by saying hello in Korean, and the user may respond using basic vocabulary.
What I have done thus far is quite simple though. I start the program, and I make it seem like it is actually loading something by using the Sleep(2000); command, which so far really has been a nice addition to my program. Then I use the function along with <windows.h> to properly change the color of the text in the console window. I do this before the user picks which type of Korean they wish to speak so they can pick what color text they type as well as the computer. I thought it was a nice add-on so the user can see a distinct difference between his/her text and the computers. However this is all I have gotten done.
Some questions:
1. Is it possible to display/write hangul in command window? 2. How should I come about for the computer to find what the user is saying and generating a response? I was figuring using strings and trying to find key words within the user's sentence and generate the most logical reply. Of course, it won't be complex and the amount of vocabulary it will accept and respond with will be limited. But as far as I know a string's termination is the space key, so I don't know how I can get the user to type a sentence and store the whole thing in a string. How do I prevent an array char[] or string from having the space key as the termination? And what shit should I use to find keywords in the string/char[]? 3. How do I delete individual items in Google Chrome's browser history? The fucking thing puts a time on when you visit shit. My brother's gonna be PISSED when he gets home.
|
United States24495 Posts
Where is sleep from? Did you write it yourself? If so, do you use the clock or have multiple dummy iterations? I'm just curious.
Maybe you need to output korean text to a file if you can't get it to display on the screen properly (sounds like a decent amount of work to get the screen to display it)
|
On November 12 2008 23:24 micronesia wrote: Where is sleep from? Did you write it yourself? If so, do you use the clock or have multiple dummy iterations? I'm just curious.
Actually I originally learned the Sleep command from PHP, but then I found out it was used in C++ also. It actually pauses the program for (x) amount of milliseconds. I've just searched the internet and a lot of people are using weird header files for this command, but my program only uses <iostream> and <windows.h> so far. Of course with namespace std.
Edit: Yeah Sleep command is in <windows.h> but it has to have that capitalized "S". A lot of people on the forums I've been searching are using some custom made sleep, not one from the windows.h API sshizzzzz.
Maybe you need to output korean text to a file if you can't get it to display on the screen properly (sounds like a decent amount of work to get the screen to display it)
I was thinking about this as the other option incase displaying Korean fails in command. But yeah, either way it'll require lots of work unfortunately but it'll be semi-cool once finished.
|
On November 12 2008 23:21 SCC-Faust wrote: ... And what shit should I use to find keywords in the string/char[]? ...
I don't know cpp, but I usually use Regular Expressions for this kind of task in Java/C#/PHP. I think you can use the PCRE library in c++.
|
|
Kennigit
Canada19447 Posts
On November 12 2008 23:41 dyodyo wrote:Show nested quote +On November 12 2008 23:21 SCC-Faust wrote: ... And what shit should I use to find keywords in the string/char[]? ... I don't know cpp, but I usually use Regular Expressions for this kind of task in Java/C#/PHP. I think you can use the PCRE library in c++. mystring.find("What you want to find") gives you location of it. Wow level up me.
|
On November 13 2008 00:05 Kennigit wrote:Show nested quote +On November 12 2008 23:41 dyodyo wrote:On November 12 2008 23:21 SCC-Faust wrote: ... And what shit should I use to find keywords in the string/char[]? ... I don't know cpp, but I usually use Regular Expressions for this kind of task in Java/C#/PHP. I think you can use the PCRE library in c++. mystring.find("What you want to find") gives you location of it. Wow level up me.
I love you Kennigit.
|
Germany2896 Posts
http://en.wikipedia.org/wiki/ELIZA Korean characters are probably possible if you use unicode output. Else you'd need to set your applocale to korean and use multi byte charsets which are a real horror.
@micronesia His "sleep" is probably the winapi function which yields execution of your thread for about the specified time in milliseconds. Precision is quite bad due to low timer resolution and low thread switch interval. http://msdn.microsoft.com/en-us/library/ms686298(VS.85).aspx
|
System.out.println("Good Luck Faust");
|
On November 13 2008 05:21 Jonoman92 wrote: System.out.println("Good Luck Faust");
String reply = "That's Java you noob!"; return reply;
|
Java is the only language I know so lay off! And by know I mean barely know.
edit: I don't know English that well either apparently because I left out a word in my original post.
|
|
On November 13 2008 04:53 MasterOfChaos wrote:http://en.wikipedia.org/wiki/ELIZAKorean characters are probably possible if you use unicode output. Else you'd need to set your applocale to korean and use multi byte charsets which are a real horror. @micronesia His "sleep" is probably the winapi function which yields execution of your thread for about the specified time in milliseconds. Precision is quite bad due to low timer resolution and low thread switch interval. http://msdn.microsoft.com/en-us/library/ms686298(VS.85).aspx
I was going to suggest having a look at ELIZA too.
The idea behind computer / IA basic is some kind of interpreter. You would have regular exp + grammars that you build into the interpreter.
It's easier to achieve 1 to 1 matching of response vs input but when the input is complex, you need to parse it appropriately.
This is very very computer science stuff, so do some research. C++ is not the ideally language for this type of programs. But stuff like Bison/Yacc can help you.
|
using sleep to fake a loading bar is very bad design. Why would you do that other than cosmetic reason?
|
|
|
|