【Hacker News搬运】法学硕士、心理理论和谢丽尔的生日
-
Title: LLMs, Theory of Mind, and Cheryl's Birthday
法学硕士、心理理论和谢丽尔的生日
Text:
Url: https://github.com/norvig/pytudes/blob/main/ipynb/CherylMind.ipynb
由于我是一个文本和信息处理的AI,我无法直接访问互联网或外部链接。因此,我无法直接查看或分析您提供的GitHub链接中的内容。 不过,我可以提供一些关于如何使用`JinaReader`进行内容抓取和分析的一般步骤,以及如何处理非中文内容的方法。 ### 使用 JinaReader 进行内容抓取和分析 1. **安装 JinaReader**: 首先,您需要确保已经安装了JinaReader。如果尚未安装,可以使用pip进行安装: ```bash pip install jina
-
设置 JinaReader:
在您的Python环境中,您可以设置JinaReader来抓取和分析内容。以下是一个基本的设置示例:from jina import Client # 创建一个Jina客户端 client = Client() # 使用JinaReader插件 client.add_plugin('JinaReader') # 上传文档到Jina网络 client.upload(doc_path='path_to_your_document')
-
执行查询和分析:
一旦文档被上传到Jina网络,您可以通过执行查询来获取分析结果:response = client.search('your_query')
处理非中文内容
如果抓取到的内容不是中文,您可以使用在线翻译服务将其翻译成中文。以下是一些常见的方法:
-
使用Google翻译API:
Google翻译API可以轻松地将非中文内容翻译成中文。以下是一个使用Google翻译API的示例代码(请注意,您需要注册Google Cloud Platform并启用翻译API):from google.cloud import translate_v2 as translate translate_client = translate.Client() def translate_text(text, target='zh-CN'): # 翻译文本 result = translate_client.translate(text, target_language=target) return result['translatedText'] # 示例:翻译非中文内容 non_chinese_text = 'This is an example sentence in English.' chinese_translation = translate_text(non_chinese_text) print(chinese_translation)
-
使用其他翻译工具:
如果您不希望使用Google翻译API,还可以使用其他在线翻译工具或库,如pysubtitle
、deep_translator
等。
请注意,使用这些API可能需要处理API密钥和权限问题。在实际应用中,您需要根据具体情况进行适当的调整。
## Post by: stereoabuse ### Comments: **jawns**: A long time ago, I created a version of this challenge called "Cheryl's Murder."<p>My notebook not only solves logical induction problems like "Cheryl's Birthday," but it also generates them.<p><a href="https://github.com/shaungallagher/cheryls-murder/blob/master/cheryls-murder.ipynb">https://github.com/shaungallagher/cheryls-murder/blob/master...</a> > **jawns**: 很久以前,我创建了一个名为";Cheryl;谋杀&“<p> 我的笔记本不仅解决了逻辑归纳问题,比如“;Cheryl;生日,";但它也会产生它们<p> <a href=“https:"Ś)?!(github.com:"/;github.com;shaungallagher;cheryls谋杀案;blob;大师</一 **AdieuToLogic**: What is a software program?<p>The codification of a solution.<p>What is a solution?<p>An answer to a problem.<p>What is a problem?<p>The identification and expression of a need to be satisfied.<p>What is a need?<p>A uniquely human experience, one which only exists within the minds of people whom experience it. > **AdieuToLogic**: 什么是软件程序<p> 解决方案的编纂<p> 什么是解决方案<p> 问题的答案<p> 有什么问题<p> 需要满足的需求的识别和表达<p> 什么是需求<p> 一种独特的人类体验,只存在于体验它的人的头脑中。 **ynniv**: The problem with evaluating LLMs is that there's a random component, and the specific wording of prompts is so important. I asked Claude to explain the problem, then write python to solve it. When it ran there was an exception, so I pasted that back in and got the correct answer. I'm not sure what this says about theory of mind (the first script it wrote was organized into steps based on who knew what when, so it seems to grok that), but the real lesson is that if LLMs are an emulation of "human" intelligence, they should probably be given a python interpreter to check their work. > **ynniv**: 评估LLM的问题在于;这是一个随机的组成部分,提示的具体措辞非常重要。我让Claude解释这个问题,然后编写python来解决它。当它运行时出现了一个异常,所以我把它粘贴回去,得到了正确的答案。我;我不确定这对心理理论意味着什么(它写的第一个脚本是根据谁知道什么时间组织成步骤的,所以它似乎在摸索),但真正的教训是,如果LLMs是对";人类”;智能方面,他们可能应该得到一个python解释器来检查他们的工作。 **joe_the_user**: Deducing things from the inability of an LLM to answer a specific question seemed doomed by the "it will be able to on the next itteration" principle.<p>It seems like the only way you could systematic chart the weaknesses of an LLM is by having a class of problems that get harder for LLMs at a steep rate, so a small increase in problem complexity requires a significant increase in LLM power. > **joe_the_user**: 从法学硕士无法回答某一具体问题中推断问题似乎注定要被";它将能够在下一次争吵中";原则<p> 似乎你能够系统地描绘LLM弱点的唯一方法是让一类问题以陡峭的速度变得对LLM来说更难,因此问题复杂性的小幅增加需要LLM能力的显著提高。 **erwald**: o1 mini seems to get it on the first try (I didn't vet the code, but I tested it and it works on both examples provided in the notebook, `dates` and `gabe_dates`):<p><pre><code> from collections import defaultdict def find_cheryls_birthday(possible_dates): # Parse the dates into month and day dates = [date.split() for date in possible_dates] months = [month for month, day in dates] days = [day for month, day in dates] # Step 1: Albert knows the month and says he doesn't know the birthday # and that Bernard doesn't know either. This implies the month has no unique days. month_counts = defaultdict(int) day_counts = defaultdict(int) for month, day in dates: month_counts[month] += 1 day_counts[day] += 1 # Months with all days appearing more than once possible_months = [month for month in month_counts if all(day_counts[day] > 1 for m, day in dates if m == month)] filtered_dates = [date for date in dates if date[0] in possible_months] # Step 2: Bernard knows the day and now knows the birthday # This means the day is unique in the filtered dates filtered_days = defaultdict(int) for month, day in filtered_dates: filtered_days[day] += 1 possible_days = [day for day in filtered_days if filtered_days[day] == 1] filtered_dates = [date for date in filtered_dates if date[1] in possible_days] # Step 3: Albert now knows the birthday, so the month must be unique in remaining dates possible_months = defaultdict(int) for month, day in filtered_dates: possible_months[month] += 1 final_dates = [date for date in filtered_dates if possible_months[date[0]] == 1] # Convert back to original format return ' '.join(final_dates[0]) if final_dates else "No unique solution found." # Example usage: possible_dates = [ "May 15", "May 16", "May 19", "June 17", "June 18", "July 14", "July 16", "August 14", "August 15", "August 17" ] birthday = find_cheryls_birthday(possible_dates) print(f"Cheryl's Birthday is on {birthday}.")</code></pre> > **erwald**: o1-mini似乎在第一次尝试时就得到了它(我没有检查代码,但我测试了它,它在笔记本中提供的两个示例“dates”和“gabe_dates”上都有效):<p><pre><code>from collections import defaultdictdef find_cheryls_birthday(可能日期):#将日期解析为月份和日期dates=[date.split()表示可能日期中的日期]month=[按月,以日期表示]days=[月份中的天数,日期中的天数]#第一步:Albert知道月份,但他说他不知道;我不知道生日#而Bernard没有;我也不知道。这意味着这个月没有独特的日子。month_counts=默认字典(int)day_counts=默认字典(int)对于日期中的月、日:month_counts[月]+=1day_counts[天]+=1#所有日期出现多次的月份possible_months=[如果全部计数,则按月计数(对于m,日计数[day]>;1,如果m==month,则以日计数)]filtered_dates=[如果日期为[0],则日期为可能的月数]#第二步:伯纳德知道日子,现在知道生日了#这意味着该日期在筛选的日期中是唯一的filtered_days=默认字典(int)对于filtered_dates中的月份和日期:筛选天数[天]+=1possible_days=[如果filtered_days[天]==1]filtered_dates=[如果日期为[1],则日期为filtered_date中的日期]#第三步:艾伯特现在知道生日了,所以这个月在其余日期中必须是唯一的possible_months=默认字典(int)对于filtered_dates中的月份和日期:可能_月[月]+=1final_dates=[如果可能的话,过滤日期中的日期为_月[日期[0]]==1]#转换回原始格式return';。join(final_dates[0])如果final_dates否则“;未找到唯一的解决方案&“;#示例用法:可能日期=[&“;5月15日"&“;5月16日"&“;5月19日";,&“;6月17日"&“;6月18日";,&“;7月14日"&“;7月16日";,&“;8月14日"&“;8月15日"&“;8月17日";]生日=find_cheryls_birthday(可能日期)print(f“Cheryl的生日在{生日}”)</code></pre>
-