-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentity match.py
47 lines (40 loc) · 1.34 KB
/
entity match.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import openai
import pandas as pd
openai.api_key = ""
# def few_shot():
#
#
def zero_shot():
query = "guess what is the city?"
return query
def read_dataset():
df = pd.read_csv('dataset/Amazon-GoogleProducts/Amazon_GoogleProducts_perfectMapping.csv')
dfA = pd.read_csv('dataset/Amazon-GoogleProducts/Amazon.csv',encoding='cp1252')
dfB = pd.read_csv('dataset/Amazon-GoogleProducts/GoogleProducts.csv', encoding='cp1252')
mergedA = pd.merge(df, dfA, right_on="id", left_on="idAmazon")
merged = pd.merge(
mergedA,
dfB,
right_on="id",
left_on="idGoogleBase",
suffixes=("_A", "_B"),
)
info = merged.iloc[0,:-1]
return info
def func():
# while True:
content = str(read_dataset()) + zero_shot()
print(content)
# messages = [
# {"role": "system", "content": "you are a data scientist and you are doing imputation work"},
# {"role": "user", "content": content}
# ]
# completion = openai.ChatCompletion.create(
# model="gpt-3.5-turbo",
# messages= messages
# )
# chat_response = completion.choices[0].message.content
# print(f'ChatGPT: {chat_response}')
# messages.append({"role": "assistant", "content": chat_response})
if __name__ == '__main__':
func()