diff --git a/dsLightRag/Test/__init__.py b/dsLightRag/Test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dsLightRag/Test/testPg.py b/dsLightRag/Test/testPg.py new file mode 100644 index 00000000..244b6d92 --- /dev/null +++ b/dsLightRag/Test/testPg.py @@ -0,0 +1,51 @@ +import os +import asyncio +from lightrag.kg.postgres_impl import PGGraphStorage +from lightrag.utils import EmbeddingFunc + +from Config.Config import EMBED_DIM, EMBED_MAX_TOKEN_SIZE +from Util.LightRagUtil import embedding_func + +######### +# Uncomment the below two lines if running in a jupyter notebook to handle the async nature of rag.insert() +# import nest_asyncio +# nest_asyncio.apply() +######### + +WORKING_DIR = "./local_neo4jWorkDir" + +if not os.path.exists(WORKING_DIR): + os.mkdir(WORKING_DIR) + +# AGE +os.environ["AGE_GRAPH_NAME"] = "dickens" + +os.environ["POSTGRES_HOST"] = "10.10.14.208" +os.environ["POSTGRES_PORT"] = "5432" +os.environ["POSTGRES_USER"] = "postgres" +os.environ["POSTGRES_PASSWORD"] = "postgres" +os.environ["POSTGRES_DATABASE"] = "rag" + + +async def main(): + graph_db = PGGraphStorage( + namespace="dickens", + embedding_func=EmbeddingFunc( + embedding_dim=EMBED_DIM, + max_token_size=EMBED_MAX_TOKEN_SIZE, + func=embedding_func + ), + global_config={}, + ) + await graph_db.initialize() + labels = await graph_db.get_all_labels() + print("all labels", labels) + + res = await graph_db.get_knowledge_graph("FEZZIWIG") + print("knowledge graphs", res) + + await graph_db.finalize() + + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/dsLightRag/output/数学OCR整理后的结果.md b/dsLightRag/output/数学OCR整理后的结果.md index 3fa10e11..587ca708 100644 --- a/dsLightRag/output/数学OCR整理后的结果.md +++ b/dsLightRag/output/数学OCR整理后的结果.md @@ -1,67 +1,91 @@ -### 题目1 +### 第1题 -**题目序号**: 1 -**题目内容**: 已知集合 $A=\left\{x \mid -5 < x^{3} < 5\right\}, B=\left\{-3,-1,0,2,3\right\}$,则 $A \cap B=$ -**选项**: +**题目内容**: +已知集合 $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。 + +**答案**:A + +**解析**: +$A \cap B=\{-1,0\}$,选 A。 --- -### 题目2 +### 第2题 -**题目序号**: 2 -**题目内容**: 若 $\frac{2}{z-1}=1+i$,则 $z=$ -**选项**: +**题目内容**: +若 $\frac{2}{z-1}=1+i$,则 $z=$ + +**选项**: A. $-1-i$ B. $-1+i$ C. $1-i$ D. $1+i$ -**答案**: C -**解析**: 无 + +**答案**:C + +**解析**: +暂无解析。 --- -### 题目3 +### 第3题 + +**题目内容**: +已知向量 $\vec{a}=(0,1)$,$\vec{b}=(2,x)$,若 $\vec{b} \perp (\vec{b}-4\vec{a})$,则 $x=$ -**题目序号**: 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。 + +**答案**: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)=$ -**题目序号**: 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。 + +**答案**: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}$,则圆锥的体积为 -**题目序号**: 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 + +**答案**: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