初学AI功能 [英] Beginner AI function

查看:108
本文介绍了初学AI功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让用户喜欢输入我感觉很好并且它会读取好的部分,程序会响应

How do I make a user like type in "I'm feeling good" and it reads the "good" part in which the program would respond to

"I see, That's great to hear from you"



我的代码就像我输入jasdhagood或者除了'good'之外的其他任何东西都会回复空白。



样本:



用户:我很好

程序:我明白了,很高兴收到你的来信



任何人,帮助我?



我尝试过的事情: < br $>



My code is like when i type in "jasdhagood" or anything other than the 'good' itself would respond to blank.

sample:

User:I'm good
Program:I see, That's great to hear from you

Anyone, help me?

What I have tried:

#include <iostream>
#include <cstring>
#include <String>

using namespace std;



void replyy(){
	string y;
	cin>>y;
	cout<<"I see your name is "<<y<<endl;
	
	
}

void goodornot(){
char responds[50];
  here:cin>>responds;
	
	if(strcasecmp("good",responds)==0){
	cout<<"I see, That's great to hear from you";
	}


else if(!strcasecmp("great",responds)){
	cout<<"I see, Feeling great!"<<endl;
}

}

int main(){
  char str[50];
  char understanding[50];
  char relation[50];
  here:cin>>str;
  
  if(strcasecmp ("hello",str)==0){
  
  cout<< "Doing good?";
  goodornot();
}

 else if(!strcasecmp ("hi",str)){
 
cout<<"hey there what's your name"<<endl;
 replyy();

}

else if(!strcasecmp ("sad",str)){
 relation==str;
 understanding==relation;
 
cout<<"Don't be sad.'"<<understanding;
goto here;


return 0;
}}

推荐答案

使用情绪分析(二元或多类):



在情感分析二进制文件中使用ML.NET分类场景| Microsoft Docs [ ^ ]
Use "sentiment analysis" (binary or multi-class):

Use ML.NET in a sentiment analysis binary classification scenario | Microsoft Docs[^]


你想要的是在其他文本中找到一些文本。使用 string :: find 功能。字符串类还有其他不错的功能。



我会使用不区分大小写的比较。



小心编译警告,因为显示你的问题。将字符串分配给char缓冲区不起作用!!!
What you want is to find some text into other text. Use the string::find functions. The string class has also other nice functions.

I would use case insenstive comparison.

Take care of compiler warnings, because the show you problems. Assigning a string to char buffer shouldnt work!!!


这篇关于初学AI功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆