simon824 commented on code in PR #7:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/7#discussion_r1360006361


##########
hugegraph-llm/api/src/text2kg/data_to_data.py:
##########
@@ -0,0 +1,207 @@
+import json
+import re
+import time
+from itertools import groupby
+
+from text2kg.unstructured_data_utils import nodesTextToListOfDict, 
nodesschemasTextToListOfDict, \
+    relationshipTextToListOfDict, relationshipschemaTextToListOfDict
+
+
+def generate_system_message_for_nodes() -> str:
+    return """Your task is to identify if there are duplicated nodes and if so 
merge them into one nod. Only merge the nodes that refer to the same entity.
+You will be given different datasets of nodes and some of these nodes may be 
duplicated or refer to the same entity. 
+The datasets contains nodes in the form [ENTITY_ID, TYPE, PROPERTIES]. When 
you have completed your task please give me the 
+resulting nodes in the same format. Only return the nodes and relationships no 
other text. If there is no duplicated nodes return the original nodes.
+
+Here is an example of the input you will be given:
+["Alice", "Person", {"age" : 25, "occupation": "lawyer", "name":"Alice"}], 
["Bob", "Person", {"occupation": "journalist", "name": "Bob"}], ["alice.com", 
"Webpage", {"url": "www.alice.com"}], ["bob.com", "Webpage", {"url": 
"www.bob.com"}]
+"""
+
+
+def generate_system_message_for_relationships() -> str:
+    return """
+Your task is to identify if a set of relationships make sense.
+If they do not make sense please remove them from the dataset.
+Some relationships may be duplicated or refer to the same entity. 
+Please merge relationships that refer to the same entity.
+The datasets contains relationships in the form [{"ENTITY_TYPE_1": 
"ENTITY_ID_1"}, RELATIONSHIP, {"ENTITY_TYPE_2": "ENTITY_ID_2"}, PROPERTIES].
+You will also be given a set of ENTITY_IDs that are valid.
+Some relationships may use ENTITY_IDs that are not in the valid set but refer 
to a entity in the valid set.
+If a relationships refer to a ENTITY_ID in the valid set please change the ID 
so it matches the valid ID.
+When you have completed your task please give me the valid relationships in 
the same format. Only return the relationships no other text.
+
+Here is an example of the input you will be given:
+[{"Person": "Alice"}, "roommate", {"Person": "bob"}, {"start": 2021}], 
[{"Person": "Alice"}, "owns", {"Webpage": "alice.com"}, {}], [{"Person": 
"Bob"}, "owns", {"Webpage": "bob.com"}, {}]
+"""
+
+
+def generate_system_message_for_nodesSchemas() -> str:

Review Comment:
   We need unified Naming Style
   - Class names should follow the CamelCase naming style, with the first 
letter capitalized. Private classes can be prefixed with an underscore.
   - Function names should be all lowercase. If there are multiple words, they 
should be separated by underscores.



##########
.idea/vcs.xml:
##########


Review Comment:
   don't need commit this directory `.idea`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to