Developing MSN Chat Robots with .NET - MSN Chat Robot Development Demycle (ZT)

zhaozj2021-02-16  51

Developing msn chat robots with .NET - MSN Chat Robot.

Written in front:

I am not a developer, not a master, that is, I love to play. Technically, there is no spirit that I like to explore, but I like to spend a trick. In this article, you can't "less worry" to revise a robot through my robot, because you think that the program is more smelling, so it will not open Source. However, if you have a little understanding of .NET or C #, I believe that from this article, you can find all the resources you need to develop a MSN robot that is absolutely available. To chat with my robot, you can add TBOT01@hotmail.com, named "Tatikma", is from the cartoon attachment housing. At the same time, you can also go to http://www.guanqun.com, there is a web chat robot with this MSN robot, you can talk first, try to use Chinese.

This is not a new article, if you don't know what is .NET, don't understand the database, even a little thing, I suggest you look at it first. At the same time, I also hope that the real master should not joke me. After all, a general, non-developer's computer enthusiast passed the exploration, telling you how to be a fun thing, not a wrong thing.

First, why do you want MSN chat robot?

1 The reason I can think of

The most important thing is because it is fun. If your MSN robots say, you must reflect your character (if you want this). Of course, this is my reason, the original intention of this robot is only suddenly one day you want to do. Maybe you also hope that your robot can help you do something, similar to an expert system or a customer service system, etc.

2 Now MSN chat robot

There are a lot of MSN robots, if you have added MSN robots, I think the most list of you is called "small cloth" or a big pile of brothers and sisters (http://www.9zi.com), It may be based on the load, you may be surrounded by a pile of joining friends at a pile of friends. There are some so-called "free SMS" robots, I have been doing SP, I said directly, in order not to delay your money, I don't comment on this robot. You can mention the robot of Msgerai (Msgerai@hotmail.com), developing its old brother, very hoping to be a smart like a person, although it may not be completed in his life, but I still wish him success. After all, there is a dream is good, and this robot can now do some work for him (http://www.funnyok.net/nlp). There are some other MSN robots, such as providing information inquiry services to help you search for Google. MSN has a list (http://www.msning.com), you will go see it.

Second, why use .NET

In fact, the reason is very simple. C # and Java are very similar, but Java I can't find a very easy to use, in line with Ide you used to us. C # is different, vs.net (http://msdn.microsoft.com/vstudio/) Of course, C # builder (http://www.borland.com/csharpbuilder/) is also good, even SharpDevelop (http : //www.icsharpcode.net/opensource/sd/) is used quite comfortable. So choose .NET better.

In addition, .NET is very convenient to develop, as long as you have a little development basis, it is not difficult to use .NET write. I am standing in a user rather than developer, I don't have to drink too many technical levels, or optimized, I don't want to enter Microsoft Research Institute. It is recommended that you use the latest version of Visual Studio.net, you can save a lot of trouble.

At the same time, there are many resources that .NET development can be found, we will mention it next.

Third, what kind of chat robot do you want?

1 Imagine before development

What I discussed here is the concept of "chat robot", meaning that he can do it with you. You have to have a program to "teaching" he talk, while letting him understand the probabilistic meaning included in the discourse, and can also do a substantially not how to answer.

2 can you let him do?

You can also let him do a lot of other things, such as query IP, mobile phone number, registration number, flight number, or directly let him check Google, help you search. These are not troublesome, as long as you want.

Fourth, let the robots speak

Whether your robots are not smart, let him answer in MSN to answer the status like the most important. So, you need to have an MSN account, connect to the MSN server, get a message of various servers, and send a message back server.

Of course, you can analyze the MSN's protocol (http://www.hypothetic.org/docs/msn/index.php), write the communication section yourself. But I mentioned, I am a person who likes to speculate, so I will use the interface that can be used. So, I found some MSN's development interface.

Msnhelper:

http://sourceforge.net/projects/msnphelper/

Dotmsn:

Http://members.home.nl/b.geertsema/dotmsn/

These two are developed for .NET, I use dotmsn, which uses the MSNP8 protocol. Note DotMSN Don't use the version on the SourceForge, you want to use the address given above.

Next, download this example:

Http://members.home.nl/b.gertsema/dotmsn/...ple/example.zip

Use vs.net to open, compile, execute.

Understand. After logging in, you will double-click someone on the list and send it to this person "Hello World!". You can already talk to people directly through MSN's original procedures.

This part of the code is like this:

Private Void ContactJoad (Conversation Sender, ContactEventArgs E)

{

// Someone Joined Our Conversation! Remember That this Also Occurs When You Are

// only Talking to 1 Other Person. log this event.

Log.Text = E.Contact.name "Joined The Conversation./R/N";

// Now Say Something Back. You can send Messages Using The Conversation Object.

Sender.sendMessage ("Hello World!");

}

It means when the other party joins the chat, you will send him a "Hello World!" Message. At this time, if the person on your list doubles your name, it will also receive a Hello World !. 5. Let the robots understand Chinese

1 database

Because we have to do Chinese chat robots, the size of the corpus is directly related to your robot is smart. Due to your own habits, I used MySQL as a database that stored a word library and a Chinese psychic library. And MySQL speed is extremely fast. Of course, you have to use Access or SQL Server, it is entirely, and it is easier. .NET calls mysql library to find mysql driver cs

http://sourceforge.net/projects/mysqldrivercs/

2 match match

The whole sentence matches this concept is simple. Chat, people who don't know will generally say "hello", or "hi ~~". This kind of words are usually very simple, and there is no too much change, let the robots answer. For example, the other party says "hello", the robot saw this "hello", just answer "Hello", you can. Or the other party say "88", you can let the robot say "goodbye", or 88. . This is called a whole sentence. It is the robot to get the whole sentence, check it in the library, ah, there is this sentence to answer this sentence, pick a sentence to answer the past, the other party will not think this robot is stupid.

Even if the other party says "you are stupid", you let the robot answer "I am not stupid", the other party will feel that this robot is okay, and others know that he is stupid.

3 Chinese word

A chat robot must of course understand Chinese. The basis of Chinese processing is Chinese word. What is the word word? "The word is the process of re-combining the consecutive word sequence in accordance with certain specifications." This definition is my copy. Please refer to this article: http://www.hylanda.com/center/knowledge.htm They should have a certain results. Domestic word system, ICTCLAS is also better. There are VC source code, you can take a look.

http://www.nlp.org.cn/project/project.php?proj_id=6

Some people will say, I don't understand this thing, I have never studied. In fact, I don't understand. However, if you don't do Chinese, chat robots can only stay in the point of evidence. We can use the maximum matching method to make simple words for chatting robots. For algorithms, please refer to this lectures of Mr. Zhan Weidong, it is estimated that you will understand.

Course Name: Chinese Information Processing Foundation

http://ccl.pku.edu.cn/doubtfire/course/chi...2002_2003_1.htm

Download this ppt: http://ccl.pku.edu.cn/doubtfire/course/chinese Information Processing/Contents/chapter_07_1.ppt

The word algorithm does not need to be too complicated, and the simple point is good.

Different distinct algorithms require a Chinese parental library. I have a MySQL, here you can download. Import into your mysql. Other databases can actually make simple changes in SQL statements.

Chinese word library download: http://www.guanqun.com/down/wordlist.rar

4 match match

It is not enough to word, if you really want the robot to understand people, there must be some artificial intelligence algorithms. We are doing robots to play, there is no need to study so deep. Artificial intelligence goes now, too smart chat robots are also less. Moreover, let the professional researchers go to research, we just play. So ... we use a simple way. Our method is to let the robots find the keywords of this sentence, this sentence is probably the word, and then find the repository to find an answer that meets such rules. Lift a simple example:

For example, the other party said:

"You are so fun"

Let's use a word algorithm to divide this sentence.

"You are so fun",

Then find the keyword "fun". At the same time, the meaning of this sentence is also recorded. In this way, when you find the keyword "fun" in the corpus, let's come to see if there is a replihood of this sentence, if there is, random answer: "Haha ... I like you. ", So that you can feel better than chatter.

So problem, how to find a keyword? My method is ... (more rotten, but usually effective), find out the longest words of this sentence as a keyword. No why, because this speed will be fast. If all the words in a sentence are scanned into keywords, then go to check the library, there will be some matching problems. (Not scientific, but usually effective).

5. Let the robots "smart"

1 Design of the whole sentence matching language

The first step is of course a matching word library for your entirety. The corpus must be written by himself, don't be lazy. To find out what others often say, if you thank you for your sorry, put more answers, so you have to answer each answer, then you need to answer, first write a SQL to query, such as

Select * from reply where `key` = '" sentense "' Order by rand () Limit 1

If you find it, you can reply to the past. If you can't find a full sentence match, do word processing.

2 design of the word matching quote

Because we have no optimization, we find out the keyword's approach is not so good, so the answer you give must be not so clear. To put it bluntly, if you answer, some "vague" can be. The goal is to make people feel that the robot has already understood what he said, and the answer is more than the "road". Do not require 100% to the road, as long as there are more than 40% of the road, the chat is basically acceptable. At the same time, answer the corpus, it is best to guide the other party to answer again, you can say that your corpus is in the text, it is best to match the sentence.

Lift a fun example:

Question: Are you a male or a woman? / Are you a male or a woman / Are you a male or a woman? (Is there a punctuation symbol, we have to record the sage of the sentence, at the same time, to do some debit symbols)

As such a sentence, we can find keywords: "Or", and by judging the meaning, this is a question. And asked to choose between two situations. (Of course, we can't know this sentence through simple algorithms, actually asking gender)

For such a problem, how do your robots answer? In fact, it is very simple, first, answer to "road", try not to let people feel ignorant, at least make people feel that your robot knows what the other party is asking. So, my robot answers this: Robot Answer: all. . . Haha

Because the answer is to chat, and there is a bit of joke, so it will feel that the robot is not so stupid.

This is just a simple example. Many specific sentences have to go to the analysis. Of course, the more corpus, the more the robots understand, the smarter.

3 What should I do if I don't know the keyword?

The corpus is not a lot, it is likely that our word algorithm does not match the appropriate answer. So we have to do another corpus, used to answer when you don't match the keyword. Such answered comparison requires a "pair" person's answer skill, because the other party may say anything, and our robot does not understand. Therefore, you must find a way to "make a clearance", and try to guide the direction of your robot possible to answer. You can try to chat with "small cloth" and will find that it will pick up a "Buddhist scripture" when it can't answer.

In fact, one of the most important skills is that if you learn about people, you are all in the fog, which makes people feel that the mind is, and it is possible to be right. We must let the robots learn this skill to meet the "smart" purpose.

The last words:

It is actually written in such a robot program. If you are familiar with some words, it is estimated that you should write it one day. I have been used for a long time, and I add to the time to prepare some kind of log library. If you really want to be a slightly "smart" robot to play, this article should be able to find a time for you to find information about 3-5 hours. If you are too lazy to study, there are other companies that can only download them, and they will be able to play.

Originally published in my blog:

Http://bot.donews.net/bot Reprinted please don't remove this

转载请注明原文地址:https://www.9cbs.com/read-20246.html

New Post(0)