diff --git a/dsRagAnything/Test/Ocr/3、整理后的结果.md b/dsRagAnything/Test/Ocr/3、整理后的结果.md new file mode 100644 index 00000000..a87f5532 --- /dev/null +++ b/dsRagAnything/Test/Ocr/3、整理后的结果.md @@ -0,0 +1,54 @@ +1. +题目序号:1 +题目内容:已知集合 \(A=\left\{x \mid -5 < x^{3} < 5\right\}, B=\left\{-3,-1,0,2,3\right\}\),则 \(A \cap B=\) +选项: +A. \(\{-1,0\}\) +B. \(\{2,3\}\) +C. \(\{-3,-1,0\}\) +D. \(\{-1,0,2\}\) +答案:A +解析:\(A \cap B=\{-1,0\}\),选 A。 + +2. +题目序号:2 +题目内容:若 \(\frac{2}{z-1}=1+i\),则 \(z=\) +选项: +A. \(-1-i\) +B. \(-1+i\) +C. \(1-i\) +D. \(1+i\) +答案:C +解析: + +3. +题目序号:3 +题目内容:已知向量 \(\vec{a}=(0,1)\),\(\vec{b}=(2,x)\),若 \(\vec{b} \perp (\vec{b}-4\vec{a})\),则 \(x=\) +选项: +A. \(-2\) +B. \(-1\) +C. \(1\) +D. \(2\) +答案:D +解析:\(\vec{b}-4\vec{a}=(2,x-4)\),\(\vec{b} \perp (\vec{b}-4\vec{a})\),\(\therefore \vec{b}(\vec{b}-4\vec{a})=0\),\(\therefore 4+x(x-4)=0\),\(\therefore x=2\),选 D。 + +4. +题目序号:4 +题目内容:已知 \(\cos(\alpha+\beta)=m\),\(\tan \alpha \tan \beta=2\),则 \(\cos(\alpha-\beta)=\) +选项: +A. \(-3m\) +B. \(-\frac{m}{3}\) +C. \(\frac{m}{3}\) +D. \(3m\) +答案:A +解析:\(\left\{\begin{array}{l}\cos \alpha \cos \beta-\sin \alpha \sin \beta=m \\\frac{\sin \alpha \sin \beta}{\cos \alpha \cos \beta}=2\end{array}\right.\),\(\therefore \left\{\begin{array}{l}\sin \alpha \sin \beta=-2m \\\cos \alpha \cos \beta=-m\end{array}\right.\),\(\cos(\alpha-\beta)=\cos \alpha \cos \beta+\sin \alpha \sin \beta=-m-2m=-3m\),选 A。 + +5. +题目序号:5 +题目内容:已知圆柱和圆锥的底面半径相等,侧面积相等,且它们的高均为 \(\sqrt{3}\),则圆锥的体积为 +选项: +A. \(2\sqrt{3}\pi\) +B. \(3\sqrt{3}\pi\) +C. \(6\sqrt{3}\pi\) +D. \(9\sqrt{3}\pi\) +答案:B +解析:设它们底面半径为 \(r\),圆锥母线 \(l\),\(\therefore 2\pi r\sqrt{3}=\pi rl\),\(\therefore l=\sqrt{3}\),则圆锥的体积为 \(\frac{1}{3}\pi r^{2}h\)。 \ No newline at end of file diff --git a/dsRagAnything/Test/Ocr/T2_FanYi.py b/dsRagAnything/Test/Ocr/T2_FanYi.py deleted file mode 100644 index a1776f5c..00000000 --- a/dsRagAnything/Test/Ocr/T2_FanYi.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -from openai import OpenAI - -try: - client = OpenAI( - # 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx", - api_key='sk-f6da0c787eff4b0389e4ad03a35a911f', - base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", - ) - # 读取md文件内容 - with open("2、识别出结果.md", "r", encoding="utf-8") as f: - text = f.read() - - completion = client.chat.completions.create( - # 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models - model="qwen-plus", - messages=[ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", - "content": "我将提供一份markdown格式的试卷,帮我整理出每道题的题目序号,内容,答案,解析,并最终输出一共整理了多少道题。内容如下:" + text}, - ], - ) - print(completion.choices[0].message.content) -except Exception as e: - print(f"错误信息:{e}") - print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code") diff --git a/dsRagAnything/Test/Ocr/T2_Translation.py b/dsRagAnything/Test/Ocr/T2_Translation.py new file mode 100644 index 00000000..c4eb5cf6 --- /dev/null +++ b/dsRagAnything/Test/Ocr/T2_Translation.py @@ -0,0 +1,46 @@ +import os +from openai import OpenAI + +try: + client = OpenAI( + # 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx", + api_key='sk-f6da0c787eff4b0389e4ad03a35a911f', + base_url="https://dashscope.aliyuncs.com/compatible-mode/v1", + ) + # 读取md文件内容 + with open("2、识别出结果.md", "r", encoding="utf-8") as f: + text = f.read() + + prompt = """ + 我将提供一份markdown格式的试卷,请帮我整理出每道题的以下内容: + 1. 题目序号 + 2. 题目内容(自动识别并添加$或$$包裹数学公式) + 3. 选项(如果有) + 4. 答案 + 5. 解析 + + 要求: + - 一道题一道题输出,不要使用表格 + - 自动检测数学表达式并用$或$$正确包裹 + - 确保公式中的特殊字符正确转义 + - 除题目内容外,不要输出其它无关信息 + + 内容如下: + """ + prompt += text + completion = client.chat.completions.create( + model="deepseek-v3", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", + "content": prompt}, + ], + ) + print(completion.choices[0].message.content) + # 将上面的返回内容写入到文件 3、整理后的结果.md 中 + with open("3、整理后的结果.md", "w", encoding="utf-8") as f: + f.write(completion.choices[0].message.content) + print("保存成功!") +except Exception as e: + print(f"错误信息:{e}") + print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")