如何向我的聊天机器人添加计算器 [英] how do I add a calculator to my chatbot

查看:29
本文介绍了如何向我的聊天机器人添加计算器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个聊天机器人 (javascript),它根据我的书面答案工作,我输入一个带有关键字的命令,通过输入的内容,如果找到了关键字,聊天机器人会根据我的答案编写代码进行响应.我需要帮助让我的聊天机器人能够计算简单的数学问题(+、-、*、/).

I have a chatbot (javascript) that works according to my written answers, I enter a command that has a keyword, go through the input written and if the keyword is find the chatbot responds with a code written according to my answer. I need help to make my chatbot have the ability to calculate simple math problems (+,-,*,/).

推荐答案

从聊天中获取值,在本例中是一个计算命令,比如 [calc](calculationhere) 然后解析方程带图书馆.一个简单的搜索将产生许多 javascript 计算解析器,用于类似这种方式的简单操作.

Take the value from the chat, in this case a command to calculate, say [calc](calculationhere) then parse the equation with a library. A simple search will yield many javascript calculation parsers for simple operations like with that fashion.

这篇关于如何向我的聊天机器人添加计算器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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