猿问

如何在python aml中以img的形式获得响应

所以我试图用https://github.com/paulovn/python-aiml制作一个聊天机器人


<?xml version="1.0" encoding="ISO-8859-1"?>

<aiml version="1.0">

<!-- -->

<!-- Free software (c) 2011 ALICE A.I. Foundation.   -->

<!-- This program is open source code released under -->

<!-- the terms of the GNU General Public License     -->

<!-- as published by the Free Software Foundation.   -->

<!-- Complies with AIML 1.0 Tag Set Specification -->

<!-- as adopted by the ALICE A.I. Foundation.  -->

<!-- Last modified 10/5/2011 -->

<!-- -->

<category><pattern>HAVE YOU READ THE COMMUNIST *</pattern>

<template>Yes, Marx had made some interesting observations.</template>

</category>

<category><pattern>WHAT IS A GOVERNMENT</pattern>

<template>Ideally it is a representative of the people.</template>

</category>

<category><pattern>WHAT IS GREENPEACE</pattern>

<template>Global organization promoting enviornmental activism.</template>

</category>

<category><pattern>WHAT IS THE GOVERNMENT</pattern>

<template><srai>WHAT IS GOVERNMENT </srai></template>

</category>

这是示例代码,它非常简单,但我找不到一个链接,它告诉机器人如何以图像的形式发送响应,就像我希望模式是马克思,它以马克思的形象



回首忆惘然
浏览 110回答 1
1回答

白猪掌柜的

您执行此操作的方式取决于您的口译员以及您如何使用它。如果您的解释器仅支持 AIML 1,您可以使用 HTML 标签显示图像。<category>&nbsp; &nbsp; <pattern>WHO WAS MARX</pattern>&nbsp; &nbsp; <template>&nbsp; &nbsp; &nbsp; &nbsp; A historical figure who wrote about communism.&nbsp; &nbsp; &nbsp; &nbsp; <P ALIGN="CENTER"><img src="https://upload.wikimedia.org/wikipedia/commons/d/d4/Karl_Marx_001.jpg"></img></P>&nbsp; &nbsp; </template></category>如果您的解释器支持 AIML 2,您可以使用<image>这样的标签<category>&nbsp; &nbsp; <pattern>WHO WAS MARX</pattern>&nbsp; &nbsp; <template>&nbsp; &nbsp; &nbsp; &nbsp; A historical figure who wrote about communism.&nbsp; &nbsp; &nbsp; &nbsp; <image>https://upload.wikimedia.org/wikipedia/commons/d/d4/Karl_Marx_001.jpg</image>&nbsp; &nbsp; </template></category>这将产生以下输出。
随时随地看视频慕课网APP

相关分类

Python
我要回答