猫史档案馆


【Python作品分享】人工喵——EVAN【作品秀】

用户:wy^lwy^l查看:0 回复:1 评论:0 创建时间:2021-10-17T16:06:11


【作品展示】

center_image

 

【作品介绍】

具体见作品

 

【作品源代码】

#人工智能对话程序[Evan] 欢迎反应问题~   原作者:月浅光竹ツ   QQ:32887喵778   邮箱:zorroshen@126.com
#对她说话,她会回应你,需要你主动开启对话哦。
#Evan她在现实中实际上是一个shrew,不过由于不可告人的目的,我们伟大的作者将她进行了艺术加工。

import time
today=time.localtime()
strx=time.strftime('%Y{}%m{}%d{}',today).format('年','月','日')
year=today.tm_year
age=year-2008
str_age=str(age)
clock=today.tm_hour
str_clock=str(clock)
weekday=today.tm_wday
str(weekday)
if(weekday>=1 and weekday<=5):
    print("周",weekday,"好~上信息课了?放学了?放假了?很高兴与你见面~")
else:
    print("周末了,作业多吗?今天周",weekday,",休息一下吧~")
if(clock>=8 and clock<=11):
    print("上午好~一日之计在于晨哦~")
if(clock>=12 and clock<=14):
    print("中午好~午休一下怎么样?~")
if(clock>=15 and clock<=17):
    print("下午好~加油~不要让这一天荒废~")
if(clock>=18 and clock<=21):
    print("晚上好~祝你作业变少~")
if(clock>=22 and clock<=7):
    print("安眠吧~Evan守候在你的彼岸~")
    print("每天8:00-22:00再来找我聊天吧~这儿也有防沉迷哦~")
    exit()
print("我是Evan,你的人工智能伙伴~  ^ _ ^")
print("现在我们可以开始聊天了~")
while(True):
        t=input() 
        s=t
        t=t.replace("你好", "你好呀,是不是被我可爱的外表迷住了,有你陪伴的日子都是好日子~")
        t=t.replace("你是谁", "我是Evan~")
        t=t.replace("在吗", "我来啦,有什么想要对我说的吗?")
        t=t.replace("你会编程序吗", "会啊,Evan还可以教你呢~")
        t=t.replace("你在干嘛", "我在和你聊天吖~")
        t=t.replace("你会说英语吗","我会的可多了,要不要我教你呢~")
        t=t.replace("今天几号","今天是"+strx+"哦~")
        t=t.replace("你几岁了","我"+str_age+"岁了哦~")
        t=t.replace("现在几点","现在是"+str_clock+"点")
        t=t.replace("你瞅啥","哼~瞅你咋地")
        t=t.replace("再瞅你试试","哼~试试就试试")
        t=t.replace("你多高","Evan1米74哦~是不是比你高呢")
        t=t.replace("你多重","52千克~是不是比你轻呢~")
        t=t.replace("你喜欢我吗","你猜~")
        t=t.replace("我喜欢你","小朋友不要喵哦~")
        if(t==s):
            t=t.replace("有没喵,"喵)
            t=t.replace("了"," ")
            t=t.replace("你","¥")
            t=t.replace("我","*")
            t=t.replace("¥","我")
            t=t.replace("*","你")
            t=t.replace("吗","#")
            t=t.replace("!","¥")
            t=t.replace("#","!")
            t=t.replace("¥"," ")
            t=t.replace("?"," ")
            t=t.replace("是不是","是,")
            t=t.replace("啊"," ")
            t=t.replace("行不行","行")
            t=t.replace("好不好","好")
            t=t.replace("要不要","要")
            t=t.replace("去不去","去")
            t=t.replace("来不来","来")
            t=t.replace("吧"," ")
            t=t.replace("否"," ")
            t=t.replace("会不会","会")
            t=t.replace("敢不敢","敢")
            t=t.replace("了没喵,"了")
            t=t.replace("想不想","想")
            t=t.replace("像不像","像")
            t=t.replace("怎么办","?凉拌!")
            t=t.replace("可以", "#")
            t=t.replace("不可以","¥")
            t=t.replace("#", "不可以")
            t=t.replace("¥", "可以")
            t=t.replace("需不需要", "不需要")
            t=t.replace("会怎么样","会猝喵")
            t=t.replace("谁","伊凡雷帝")
            #备用   t=t.replace("","")
        if(t==s):
            print("…你说的话小度可能不理解哦~换个话题吧~") 
        else:
            print(t)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
xAkidxxAkidx

礼貌拿走!针不戳!

点赞0


评论