Commit
·
a7642c6
1
Parent(s):
95b5491
Update license (#2086)
Browse filesSigned-off-by: Jin Hai <[email protected]>
- graphrag/claim_extractor.py +3 -15
- graphrag/claim_prompt.py +2 -15
- graphrag/community_report_prompt.py +2 -15
- graphrag/community_reports_extractor.py +2 -15
- graphrag/description_summary.py +2 -15
- graphrag/entity_embedding.py +2 -15
- graphrag/entity_resolution.py +1 -0
- graphrag/graph_extractor.py +3 -14
- graphrag/graph_prompt.py +3 -15
- graphrag/leiden.py +2 -15
- graphrag/mind_map_extractor.py +1 -0
- graphrag/mind_map_prompt.py +1 -0
- graphrag/utils.py +2 -15
graphrag/claim_extractor.py
CHANGED
|
@@ -1,22 +1,10 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
| 19 |
"""
|
|
|
|
| 20 |
import argparse
|
| 21 |
import json
|
| 22 |
import logging
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
| 6 |
"""
|
| 7 |
+
|
| 8 |
import argparse
|
| 9 |
import json
|
| 10 |
import logging
|
graphrag/claim_prompt.py
CHANGED
|
@@ -1,18 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
graphrag/community_report_prompt.py
CHANGED
|
@@ -1,18 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
graphrag/community_reports_extractor.py
CHANGED
|
@@ -1,18 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
graphrag/description_summary.py
CHANGED
|
@@ -1,18 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
graphrag/entity_embedding.py
CHANGED
|
@@ -1,18 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
graphrag/entity_resolution.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
#
|
|
|
|
| 16 |
import logging
|
| 17 |
import re
|
| 18 |
import traceback
|
|
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
#
|
| 16 |
+
|
| 17 |
import logging
|
| 18 |
import re
|
| 19 |
import traceback
|
graphrag/graph_extractor.py
CHANGED
|
@@ -1,21 +1,10 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
"""
|
| 16 |
Reference:
|
| 17 |
- [graphrag](https://github.com/microsoft/graphrag)
|
| 18 |
"""
|
|
|
|
| 19 |
import logging
|
| 20 |
import numbers
|
| 21 |
import re
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
| 6 |
"""
|
| 7 |
+
|
| 8 |
import logging
|
| 9 |
import numbers
|
| 10 |
import re
|
graphrag/graph_prompt.py
CHANGED
|
@@ -1,22 +1,10 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
| 19 |
"""
|
|
|
|
| 20 |
GRAPH_EXTRACTION_PROMPT = """
|
| 21 |
-Goal-
|
| 22 |
Given a text document that is potentially relevant to this activity and a list of entity types, identify all entities of those types from the text and all relationships among the identified entities.
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
| 6 |
"""
|
| 7 |
+
|
| 8 |
GRAPH_EXTRACTION_PROMPT = """
|
| 9 |
-Goal-
|
| 10 |
Given a text document that is potentially relevant to this activity and a list of entity types, identify all entities of those types from the text and all relationships among the identified entities.
|
graphrag/leiden.py
CHANGED
|
@@ -1,18 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|
graphrag/mind_map_extractor.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
#
|
|
|
|
| 16 |
import collections
|
| 17 |
import logging
|
| 18 |
import re
|
|
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
#
|
| 16 |
+
|
| 17 |
import collections
|
| 18 |
import logging
|
| 19 |
import re
|
graphrag/mind_map_prompt.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
#
|
|
|
|
| 16 |
MIND_MAP_EXTRACTION_PROMPT = """
|
| 17 |
- Role: You're a talent text processor to summarize a piece of text into a mind map.
|
| 18 |
|
|
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
#
|
| 16 |
+
|
| 17 |
MIND_MAP_EXTRACTION_PROMPT = """
|
| 18 |
- Role: You're a talent text processor to summarize a piece of text into a mind map.
|
| 19 |
|
graphrag/utils.py
CHANGED
|
@@ -1,18 +1,5 @@
|
|
| 1 |
-
#
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
#
|
| 16 |
"""
|
| 17 |
Reference:
|
| 18 |
- [graphrag](https://github.com/microsoft/graphrag)
|
|
|
|
| 1 |
+
# Copyright (c) 2024 Microsoft Corporation.
|
| 2 |
+
# Licensed under the MIT License
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
Reference:
|
| 5 |
- [graphrag](https://github.com/microsoft/graphrag)
|