Created
December 19, 2023 16:18
-
-
Save rfeers/706ab391f5b5540ce35f07e5de940b02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def theme_analyzer(review): | |
response = openai.completions.create( | |
model="text-davinci-003", # You can choose the model version | |
prompt=f"""Analyze the following review: \"{review}\". | |
Is it a complain, a experience-based review or a question. | |
Answer with a single word: | |
- Complain | |
- Experience | |
- Question""", | |
max_tokens=60 | |
) | |
df_short["Theme"] = df_short.apply(lambda x:theme_analyzer(x["Text"]), axis=1) | |
df_short |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment