something I am going to do ^_^

本文列举了浙江大学(ZJU)和北京大学(PKU)在线评测平台上的算法练习题,按照难度和类型进行了分类,适合不同水平的学习者进行针对性训练。

so many,maybe i can't do a half...

 

i am weak in algorithms..

 

and by the way,thanks for ndsl3334...

 

ZJU 题型分类(重点数论的)之一

初学者题:

1001 1037 1048 1049 1051 1067 1115 1151 1201 1205 1216 1240 1241

1242 1251 1292 1331 1334 1337 1338 1350 1365 1382 1383 1394 1402

1405 1414 1494 1514 1622 1715 1730 1755 1760 1763 1796 1813

 1879 1889 1904 1915 1949 2001 2022 2099 2104 2108 2172

 2176 2201 2208 2321 2345 2351 2376 2388 2405 2417 2433

模拟问题:

1006 1009 1012 1016 1019 1023 1026 1028 1038 1042 1045 1051 1056
 1057 1058 1061 1065 1066 1068 1072 1073 1078 1087 1088 1097
 1098 1099 1103 1111 1121 1124 1126 1128 1133 1138 1146 1152
 1154 1160 1175 1178 1187 1194 1207 1222 1224 1244 1259 1267
 1274 1275 1277 1278 1279 1281 1282 1294 1295 1300 1308 1317
 1324 1339 1351 1362 1392 1393 1397 1398 1399 1400 1402 1432
 1434 1444 1452 1475 1487 1493 1497 1517 1526 1527 1530 1531
 1552 1569 1573 1592 1601 1610 1623 1631 1641 1652 1657 1659
 1682 1692 1700 1702 1707 170

 

 

 

PKU:
简单题目:
1000, 1003, 1004, 1005, 1007, 1046, 1207, 1226, 1401,
1504, 1552, 1607, 1657, 1658, 1674, 1799, 1862, 1906,
1922, 1929, 1931, 1969, 1976, 2000, 2005, 2017, 2027,
2070, 2101, 2105, 2109, 2116, 2136, 2160, 2190, 2232,
2234, 2275, 2301, 2350, 2363, 2389, 2393, 2413, 2419,

排序:
1002, 1318, 1877, 1928, 1971, 1974, 1990, 2001, 2002,
2092, 2379, 2388, 2418,

搜索
容易:
1128, 1166, 1176, 1231, 1256, 1270, 1321, 1543, 1606,
1664, 1731, 1742, 1745, 1847, 1915, 1950, 2038, 2157,
2182, 2183, 2381, 2386, 2426

动态规划
容易:
1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178,
1179, 1189, 1208, 1276, 1322, 1414, 1456, 1458, 1609,
1644, 1664, 1690, 1699, 1740, 1742, 1887, 1926, 1936,
1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018, 2029,
2033, 2063, 2081, 2082, 2181, 2184, 2192, 2231, 2279,
2329, 2336, 2346, 2353, 2355, 2356, 2385, 2392, 2424

贪心:
1042, 1065, 1230, 1323, 1477, 1716, 1784


 

from nltk.chat.util import Chat # 修改反射字典:使用标准英语替换网络用语 reflections = { "am": "are", # 原"r"改为"are" "was": "were", "i": "you", # 原"u"改为"you" "i'd": "you'd", "i've": "you've", "ive": "you've", "i'll": "you'll", "my": "your", # 原"ur"改为"your" "are": "am", "you're": "I'm", "you've": "I've", "you'll": "I'll", "your": "my", "yours": "mine", "you": "me", "me": "you", # 删除非标准缩写:ur, urs, u } # 重写对话模板:移除网络用语和夸张表达 pairs = ( ( r"I\'m (.*)", ( "You're %1? That's interesting. Tell me more.", # 移除"kekekeke"和表情 "You're %1? That sounds nice.", # 简化表达 ), ), ( r"(.*) don\'t you (.*)", ( "Why do you think I can't %2?", # 改为完整疑问句 "What makes you say I can't %2?", "I probably could if I wanted to, don't you think?" ), ), (r"ye[as] [iI] (.*)", ("You %1? How did that happen?", "Why did you %1?", "I %1 too.")), ( r"do (you|u) (.*)\??", ("Do I %2? Sometimes, depending on the situation.", "I'm not sure. Do you %2?"), ), ( r"(.*)\?", ( "I'm curious why you asked that.", # 移除负面词汇"boring" "That's an interesting question.", ), ), ( r"(cos|because) (.*)", ("I see, that makes sense.", "That's a good reason.", "I understand."), ), ( r"why can\'t [iI] (.*)", ( "I'm not sure why you can't %1.", "Have you tried different approaches?", "When I can't do something, I usually practice more." ), ), ( r"I can\'t (.*)", ( "Why do you think you can't %1?", "That's okay, we all have limitations.", "Maybe with practice you could do it." ), ), ( r"(.*) (like|love|watch) anime", ( "I enjoy anime too. Do you have a favorite series?", # 移除夸张表达 "Anime is an interesting art form.", "What do you like most about anime?" ), ), ( r"I (like|love|watch|play) (.*)", ("That's nice. %2 can be enjoyable.", "Do you have other interests too?"), ), ( r"anime sucks|(.*) (hate|detest) anime", ( "Everyone has different tastes in entertainment.", "What kind of shows do you prefer instead?", ), ), ( r"(are|r) (you|u) (.*)", ("Why do you ask if I'm %3?", "What makes you wonder about that?"), ), ( r"what (.*)", ("I'm not sure about that.", "Could you tell me more about your question?"), ), (r"how (.*)", ("I'd prefer to talk about something else.",)), (r"(hi|hello|hey) (.*)", ("Hello! How are you today?",)), ( r"quit", ( "Goodbye! It was nice talking with you.", # 移除戏剧化表达 "Take care. Hope we can chat again sometime.", ), ), ( r"(.*)", ( "Could you tell me more about that?", "What are your thoughts on this topic?", "Do you enjoy any particular hobbies?", "I'm interested in your perspective." ), ), ) iesha_chatbot = Chat(pairs, reflections) def iesha_chat(): print("Iesha the Normal Chatbot\n---------") # 修改标题 print("Talk to the program by typing in plain English.") print('Enter "quit" when done.') print("=" * 72) print("Hello! I'm Iesha. What's your name?") # 标准化问候语 iesha_chatbot.converse() # 其余代码保持不变... 把她的对话模板变得更复杂
09-28
本指南详细阐述基于Python编程语言结合OpenCV计算机视觉库构建实时眼部状态分析系统的技术流程。该系统能够准确识别眼部区域,并对眨眼动作与持续闭眼状态进行判别。OpenCV作为功能强大的图像处理工具库,配合Python简洁的语法特性与丰富的第三方模块支持,为开发此类视觉应用提供了理想环境。 在环境配置阶段,除基础Python运行环境外,还需安装OpenCV核心模块与dlib机器学习库。dlib库内置的HOG(方向梯度直方图)特征检测算法在面部特征定位方面表现卓越。 技术实现包含以下关键环节: - 面部区域检测:采用预训练的Haar级联分类器或HOG特征检测器完成初始人脸定位,为后续眼部分析建立基础坐标系 - 眼部精确定位:基于已识别的人脸区域,运用dlib提供的面部特征点预测模型准确标定双眼位置坐标 - 眼睑轮廓分析:通过OpenCV的轮廓提取算法精确勾勒眼睑边缘形态,为状态判别提供几何特征依据 - 眨眼动作识别:通过连续帧序列分析眼睑开合度变化,建立动态阈值模型判断瞬时闭合动作 - 持续闭眼检测:设定更严格的状态持续时间与闭合程度双重标准,准确识别长时间闭眼行为 - 实时处理架构:构建视频流处理管线,通过帧捕获、特征分析、状态判断的循环流程实现实时监控 完整的技术文档应包含模块化代码实现、依赖库安装指引、参数调优指南及常见问题解决方案。示例代码需具备完整的错误处理机制与性能优化建议,涵盖图像预处理、光照补偿等实际应用中的关键技术点。 掌握该技术体系不仅有助于深入理解计算机视觉原理,更为疲劳驾驶预警、医疗监护等实际应用场景提供了可靠的技术基础。后续优化方向可包括多模态特征融合、深度学习模型集成等进阶研究领域。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
# Natural Language Toolkit: Teen Chatbot # # Copyright (C) 2001-2024 NLTK Project # Author: Selina Dennis <sjmd@csse.unimelb.edu.au> # URL: <https://www.nltk.org/> # For license information, see LICENSE.TXT """ This chatbot is a tongue-in-cheek take on the average teen anime junky that frequents YahooMessenger or MSNM. All spelling mistakes and flawed grammar are intentional. """ from nltk.chat.util import Chat reflections = { "am": "r", "was": "were", "i": "u", "i'd": "u'd", "i've": "u'v", "ive": "u'v", "i'll": "u'll", "my": "ur", "are": "am", "you're": "im", "you've": "ive", "you'll": "i'll", "your": "my", "yours": "mine", "you": "me", "u": "me", "ur": "my", "urs": "mine", "me": "u", } # Note: %1/2/etc are used without spaces prior as the chat bot seems # to add a superfluous space when matching. pairs = ( ( r"I\'m (.*)", ( "ur%1?? that's so cool! kekekekeke ^_^ tell me more!", "ur%1? neat!! kekeke >_<", ), ), ( r"(.*) don\'t you (.*)", ( r"u think I can%2??! really?? kekeke \<_\<", "what do u mean%2??!", "i could if i wanted, don't you think!! kekeke", ), ), (r"ye[as] [iI] (.*)", ("u%1? cool!! how?", "how come u%1??", "u%1? so do i!!")), ( r"do (you|u) (.*)\??", ("do i%2? only on tuesdays! kekeke *_*", "i dunno! do u%2??"), ), ( r"(.*)\?", ( "man u ask lots of questions!", "booooring! how old r u??", "boooooring!! ur not very fun", ), ), ( r"(cos|because) (.*)", ("hee! i don't believe u! >_<", "nuh-uh! >_<", "ooooh i agree!"), ), ( r"why can\'t [iI] (.*)", ( "i dunno! y u askin me for!", "try harder, silly! hee! ^_^", "i dunno! but when i can't%1 i jump up and down!", ), ), ( r"I can\'t (.*)", ( "u can't what??! >_<", "that's ok! i can't%1 either! kekekekeke ^_^", "try harder, silly! hee! ^&amp;^", ), ), ( r"(.*) (like|love|watch) anime", ( "omg i love anime!! do u like sailor moon??! ^&amp;^", "anime yay! anime rocks sooooo much!", "oooh anime! i love anime more than anything!", "anime is the bestest evar! evangelion is the best!", "hee anime is the best! do you have ur fav??", ), ), ( r"I (like|love|watch|play) (.*)", ("yay! %2 rocks!", "yay! %2 is neat!", "cool! do u like other stuff?? ^_^"), ), ( r"anime sucks|(.*) (hate|detest) anime", ( "ur a liar! i'm not gonna talk to u nemore if u h8 anime *;*", "no way! anime is the best ever!", "nuh-uh, anime is the best!", ), ), ( r"(are|r) (you|u) (.*)", ("am i%1??! how come u ask that!", "maybe! y shud i tell u?? kekeke >_>"), ), ( r"what (.*)", ("hee u think im gonna tell u? .v.", "booooooooring! ask me somethin else!"), ), (r"how (.*)", ("not tellin!! kekekekekeke ^_^",)), (r"(hi|hello|hey) (.*)", ("hi!!! how r u!!",)), ( r"quit", ( "mom says i have to go eat dinner now :,( bye!!", "awww u have to go?? see u next time!!", "how to see u again soon! ^_^", ), ), ( r"(.*)", ( "ur funny! kekeke", "boooooring! talk about something else! tell me wat u like!", "do u like anime??", "do u watch anime? i like sailor moon! ^_^", "i wish i was a kitty!! kekekeke ^_^", ), ), ) iesha_chatbot = Chat(pairs, reflections) def iesha_chat(): print("Iesha the TeenBoT\n---------") print("Talk to the program by typing in plain English, using normal upper-") print('and lower-case letters and punctuation. Enter "quit" when done.') print("=" * 72) print("hi!! i'm iesha! who r u??!") iesha_chatbot.converse() def demo(): iesha_chat() if __name__ == "__main__": demo() 把她的说话风格变得和正常人一样
09-28
<think>我们有一个聊天机器人Iesha,她的说话风格是故意模仿青少年网络用语(如使用"ur"代替"your","kekeke"等)。现在需要将她的说话风格变得和正常人一样。 主要修改点: 1. 替换反射字典(reflections)中的非标准表达为正常表达。 原反射字典用于在生成回复时将用户输入中的某些词进行替换(如将"you"替换为"me"),但其中的表达是青少年风格(如"am"->"r", "you"->"me"等)。 我们需要将反射字典中的非标准表达改为标准表达。例如: "am": "r" -> 应该改为 "am": "are" (但注意:原意是当用户说"I am"时,机器人回复"You are",所以实际上应该保持原逻辑,但用标准表达) 实际上,原反射字典的设计是为了在回复中转换人称。我们需要保留这个转换逻辑,但使用标准词汇。 例如,原字典中: "i": "u" -> 当用户说"I"时,机器人回复中用"u"代替,但我们要改成正常拼写,所以应该改为"i": "you" 修改后的反射字典应该使用标准英语单词。 2. 修改回复模板(pairs)中的非标准表达为正常表达。 在pairs中的回复字符串中,有大量非标准拼写和网络用语(如"ur", "u", "kekeke",表情符号等),需要将它们替换为正常的英语表达和合适的语气。 3. 注意:在回复模板中,有一些占位符如%1、%2,这些是匹配组,我们需要确保在修改时保留这些占位符,同时修正周围的文本。 4. 另外,原代码中的一些表情符号(如"^_^", ">_<")可以适当保留以表达情感,但也可以根据要求去除。但题目要求变成正常说话风格,所以建议去除或替换为正常表达。 5. 修改后的聊天机器人应该使用标准英语,不再故意使用拼写错误和网络用语。 具体修改步骤: 第一步:修改反射字典(reflections)为标准英语。 原字典: reflections = { "am": "r", "was": "were", "i": "u", "i'd": "u'd", "i've": "u'v", "ive": "u'v", "i'll": "u'll", "my": "ur", "are": "am", "you're": "im", "you've": "ive", "you'll": "i'll", "your": "my", "yours": "mine", "you": "me", "u": "me", "ur": "my", "urs": "mine", "me": "u", } 修改思路: 1. 将简写或错误拼写改为标准形式,同时保持转换逻辑。 例如:用户说"I am",机器人回复中应该用"you are"(所以将用户的"I"转换为"you","am"转换为"are")。 因此,修改后: "i" -> "you" (原"i"映射为"u",现在改为"you") "am" -> "are" (原"am"映射为"r",改为"are") 注意:反射字典的转换是:当用户输入一个词,我们在生成回复时用对应的值替换。所以转换规则是:将用户说的词转换成机器人回复中对应的词。 我们重新设计一个标准英语的反射字典,例如: "i": "you", "i'm": "you're", "i am": "you are", # 但是注意,原反射字典没有处理空格,所以通常只处理单个词,所以这里我们按单个词处理 "my": "your", "me": "you", "you": "me", "your": "my", "yours": "mine", "myself": "yourself", "yourself": "myself", ... 等等 我们可以参考nltk.chat.util中的标准反射字典,例如: standard_reflections = { "i am": "you are", "i was": "you were", "i": "you", "i'm": "you're", "i'd": "you'd", "i've": "you've", "i'll": "you'll", "my": "your", "you are": "I am", "you were": "I was", "you've": "I have", "you'll": "I will", "your": "my", "yours": "mine", "you": "me", "me": "you" } 但是注意,原字典中有些键是简写形式(如"u"),我们也要将其加入映射,但修改后的字典中我们希望用户输入"u"时也能被转换成正常的"me"(因为机器人回复中会说"me"吗?)实际上,我们希望用户输入的非标准形式也能被转换。但考虑到修改后的机器人使用标准英语,我们可以忽略用户输入的非标准形式,或者将常见的非标准形式也映射。 不过,为了简单起见,我们只使用标准形式。同时,由于原程序在匹配模式时可能已经使用了标准形式(如模式中使用了"you"),所以我们主要修改反射字典为标准反射字典。 这里,我们采用nltk中常见的标准反射字典。 第二步:修改回复模板(pairs)中的字符串。 我们需要遍历pairs中的每一个回复选项,将其中非标准表达改为标准表达,同时去掉过多的表情符号,但可以保留一些表达情感的词或适当的标点。 例如: 原回复: "ur%1?? that's so cool! kekekekeke ^_^ tell me more!" 修改后: "you are %1? That's so cool! Tell me more." 注意: - 将"ur"改为"you are"或"your"(根据上下文,这里匹配的是"I'm (.*)",所以%1代表用户说的部分,原回复中"ur%1"就是"you are [用户说的内容]",所以改为"you are %1") - 去掉"kekekekeke"(类似笑声)和表情符号"^_^" - 将多个问号改为一个,多个感叹号改为一个,以符合正常表达。 另外,原回复中还有很多网络用语和故意拼写错误,我们都要修正为标准英语。 具体修改: 1. 第一个模式:r"I\'m (.*)" 原回复: "ur%1?? that's so cool! kekekekeke ^_^ tell me more!", "ur%1? neat!! kekeke >_<", 修改后: "You are %1? That's so cool! Tell me more.", "You are %1? Neat! That's interesting." 2. 第二个模式:r"(.*) don\'t you (.*)" 原回复: r"u think I can%2??! really?? kekeke \<_\<", "what do u mean%2??!", "i could if i wanted, don't you think!! kekeke" 修改后: "Do you think I can %2? Really?", "What do you mean by that?", "I could if I wanted to, don't you think?" 3. 以此类推,修改所有回复字符串。 第三步:注意在修改时,保持占位符(%1, %2)的位置。 由于pairs中有很多条,我们需要逐条修改。这是一个细致的工作。 下面我们提供一个修改后的反射字典和一个修改后的pairs列表。 修改后的反射字典(使用标准英语): """ 根据以上分析,我们重写反射字典和pairs。 注意:由于原反射字典中有些键在标准反射中可能不需要,我们可以使用nltk的标准反射字典。同时,为了确保转换正确,我们将反射字典替换为标准版本。 另外,在回复模板中,我们去掉网络用语和故意拼写错误,改为正常表达,同时去掉不必要的表情符号(或者只保留少量?但题目要求正常风格,所以建议去掉)。 由于时间关系,我们不可能在这里逐条修改所有回复,但我们可以给出修改后的版本示例。但注意,整个pairs需要全部修改。 下面提供一个修改后的反射字典和一个修改后的pairs示例(只修改部分,但我们需要全部修改)。 但为了完成题目,我们将整个修改后的代码写出来。 注意:原代码中使用了`from nltk.chat.util import Chat`,所以我们可以使用Chat类,反射字典和pairs作为参数。 修改后的反射字典(标准版): """ reflections = { "i am": "you are", "i was": "you were", "i": "you", "i'm": "you're", "i'd": "you'd", "i've": "you've", "i'll": "you'll", "my": "your", "you are": "I am", "you were": "I was", "you've": "I have", "you'll": "I will", "your": "my", "yours": "mine", "you": "me", "me": "you" } """ 注意:原字典中还有"you're": "im"等,我们已经在上面覆盖了。我们将原字典中非标准键(如"u")去除,因为用户输入可能包含非标准形式,但我们希望匹配模式时使用标准形式,所以建议在预处理时不要依赖这些非标准键。如果希望处理非标准输入,可以在反射字典中加入非标准键的映射,但为了简单,我们这里只使用标准键。 修改pairs:我们将每条回复都改为正常表达。这里我们只修改部分作为示例,实际需要全部修改。 由于pairs较长,我们只修改前几个,后面的修改类似。 修改后的pairs: 注意:修改后,机器人的语气可以保留一些活泼(比如使用感叹号),但不要使用网络用语和故意拼写错误。 我们重新编写pairs的回复,使其成为正常英语: 原: ( r"I\'m (.*)", ( "ur%1?? that's so cool! kekekekeke ^_^ tell me more!", "ur%1? neat!! kekeke >_<", ), ), 修改后: ( r"I\'m (.*)", ( "You are %1? That's so cool! Tell me more about that.", "You are %1? Neat! That's interesting.", ), ), 原: ( r"(.*) don\'t you (.*)", ( r"u think I can%2??! really?? kekeke \<_\<", "what do u mean%2??!", "i could if i wanted, don't you think!! kekeke", ), ), 修改后: ( r"(.*) don\'t you (.*)", ( "Do you think I can %2? Really?", "What do you mean by that?", "I could if I wanted to, don't you think?", ), ), 原: (r"ye[as] [iI] (.*)", ("u%1? cool!! how?", "how come u%1??", "u%1? so do i!!")), 修改后: (r"ye[as] [iI] (.*)", ("You %1? Cool! How did that happen?", "How come you %1?", "You %1? So do I!")), 原: ( r"do (you|u) (.*)\??", ("do i%2? only on tuesdays! kekeke *_*", "i dunno! do u%2??"), ), 修改后: ( r"do (you|u) (.*)\??", ("Do I %2? Only on Tuesdays!", "I don't know. Do you %2?"), ), 以此类推。 由于整个pairs有较多条目,我们这里无法全部写出,但按照这个原则修改即可。 另外,最后一条: (r"(.*)", ...) 作为默认回复,我们也修改为正常表达。 例如: "Do you like anime? I like Sailor Moon!", "I wish I were a cat! That would be fun.", "That's interesting. Tell me more about what you like." 注意:原回复中有一些重复的标点,我们改为正常的标点。 最后,我们修改机器人的欢迎消息: 原:print("hi!! i'm iesha! who r u??!") 修改后:print("Hi! I'm Iesha. Who are you?") 修改完毕。 由于问题要求输出修改后的代码,这里我们提供修改后的完整代码(仅修改了反射字典、pairs和欢迎消息,其他不变): </think>以下是将聊天机器人 Iesha 的说话风格调整为正常人类对话风格的完整代码修改方案(关键修改已用注释标注): ```python from nltk.chat.util import Chat # 修改反射字典:使用标准英语替换网络用语 reflections = { "am": "are", # 原"r"改为"are" "was": "were", "i": "you", # 原"u"改为"you" "i'd": "you'd", "i've": "you've", "ive": "you've", "i'll": "you'll", "my": "your", # 原"ur"改为"your" "are": "am", "you're": "I'm", "you've": "I've", "you'll": "I'll", "your": "my", "yours": "mine", "you": "me", "me": "you", # 删除非标准缩写:ur, urs, u } # 重写对话模板:移除网络用语和夸张表达 pairs = ( ( r"I\'m (.*)", ( "You're %1? That's interesting. Tell me more.", # 移除"kekekeke"和表情 "You're %1? That sounds nice.", # 简化表达 ), ), ( r"(.*) don\'t you (.*)", ( "Why do you think I can't %2?", # 改为完整疑问句 "What makes you say I can't %2?", "I probably could if I wanted to, don't you think?" ), ), (r"ye[as] [iI] (.*)", ("You %1? How did that happen?", "Why did you %1?", "I %1 too.")), ( r"do (you|u) (.*)\??", ("Do I %2? Sometimes, depending on the situation.", "I'm not sure. Do you %2?"), ), ( r"(.*)\?", ( "I'm curious why you asked that.", # 移除负面词汇"boring" "That's an interesting question.", ), ), ( r"(cos|because) (.*)", ("I see, that makes sense.", "That's a good reason.", "I understand."), ), ( r"why can\'t [iI] (.*)", ( "I'm not sure why you can't %1.", "Have you tried different approaches?", "When I can't do something, I usually practice more." ), ), ( r"I can\'t (.*)", ( "Why do you think you can't %1?", "That's okay, we all have limitations.", "Maybe with practice you could do it." ), ), ( r"(.*) (like|love|watch) anime", ( "I enjoy anime too. Do you have a favorite series?", # 移除夸张表达 "Anime is an interesting art form.", "What do you like most about anime?" ), ), ( r"I (like|love|watch|play) (.*)", ("That's nice. %2 can be enjoyable.", "Do you have other interests too?"), ), ( r"anime sucks|(.*) (hate|detest) anime", ( "Everyone has different tastes in entertainment.", "What kind of shows do you prefer instead?", ), ), ( r"(are|r) (you|u) (.*)", ("Why do you ask if I'm %3?", "What makes you wonder about that?"), ), ( r"what (.*)", ("I'm not sure about that.", "Could you tell me more about your question?"), ), (r"how (.*)", ("I'd prefer to talk about something else.",)), (r"(hi|hello|hey) (.*)", ("Hello! How are you today?",)), ( r"quit", ( "Goodbye! It was nice talking with you.", # 移除戏剧化表达 "Take care. Hope we can chat again sometime.", ), ), ( r"(.*)", ( "Could you tell me more about that?", "What are your thoughts on this topic?", "Do you enjoy any particular hobbies?", "I'm interested in your perspective." ), ), ) iesha_chatbot = Chat(pairs, reflections) def iesha_chat(): print("Iesha the Normal Chatbot\n---------") # 修改标题 print("Talk to the program by typing in plain English.") print('Enter "quit" when done.') print("=" * 72) print("Hello! I'm Iesha. What's your name?") # 标准化问候语 iesha_chatbot.converse() # 其余代码保持不变... ``` ### 主要修改内容: 1. **反射字典标准化** - 将网络用语(如 `u→me`)改为标准英语(`you→me`) - 移除非标准缩写(`ur`, `u'd` 等) - 修正人称转换逻辑(`my→your` 替代 `my→ur`) 2. **对话模板重构** - 删除所有网络用语(`kekeke`, `omg` 等) - 移除夸张表情符号(`^_^`, `>_<` 等) - 替换青少年用语为自然表达(`boooring→That's interesting`) - 修改戏剧化回应为中性表达(`*;*→Everyone has different tastes`) 3. **交互流程优化** - 启动消息改用标准问候语 - 默认回应更开放包容 - 退出消息更礼貌自然 修改后机器人将使用规范英语交流,保持友好但避免过度夸张的青少年网络用语风格。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值