Develop MSN chat robots with .NET

xiaoxiao2021-03-06  101

[转] 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. 1. Why do I want MSN chat robot 1 The reason I can think is because it is very 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 robots now MSN robots have a lot, if you have added MSN robots, I think you are the most list of "small cloth" or a big pile called "small cloth" or his brothers and sisters (http: // www .9zi.com), may be based on the load, you may be surrounded by a number of requests to join a friend by a bunch of friends in a boy. 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 is it easy to use .Net. 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 1 is the development of the idea to discuss it here is the concept of "chat robot", meaning, what he can do is to chat 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 Also let him do what you can make him do a lot of other things, such as query IP, mobile 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, no matter whether your robots are not smart, let him answer the most important thing in MSN. 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/example/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 such that:!. Private void ContactJoined (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! ");} After 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 cshttp: //sourceforge.net/projects/mysqldrivercs/

2 The whole sentence matching 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 OK must have some 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/chinese Information Processing/2002_2003_1.htm

Download this PPT handy: http://ccl.pku.edu.cn/doubtfire/course/chinese Information Processing/Contents/chapter_07_1.ppt fensed algorithm does not need to be too complicated, simple points. 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 Prediction Library Download: http://www.guanqun.com/down/wordlist.rar4 The match is not enough, if you really want the robot to understand what people say, 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. For example, the other party said: "You are so fun", we first divide this sentence into "you are 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). V. Let the robot "smart" 1 1 The first step of the matching word library is of course to do your entirety matching language library. The corpus must be written by himself, don't be lazy. I find out what others are most often saying. For example, if you thank you, let's put more answers, so you have the same answer, then you have to answer, first write SQL to query, such as SELECT * from reply WHERE `Key` = '" SENTENSE "' Order by rand () Limit 1 After finding, you can reply to the past. If you can't find a full sentence match, do word processing. 2 Design of Piennium Matching Foundation Because we have no optimization, we find out the keyword's way is not so good, so your answer 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.

Lifting 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 sign, we have to record the sage of the sentence, at the same time, to do some of the punctuation), we can pass Pieces, find keywords: "Still", and by judging the words, you can know that this is a question. And asked to choose between two situations. (Of course, we can't know this sentence by simple algorithm, is 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 of the answer to the chat, and there is a bit of joke, so it will make the chat, this 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 Do not do not have a keyword, how to write a language library is not a lot, it is likely that our word algorithm does not match the appropriate answer to cope. 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. In the last words: It is actually written 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

Please don't remove this

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

New Post(0)