Topic Labeling using GPT
Topic Labeling using OpenAI’s API
Github Repo: github.com/squarra/topic-labeling
Using OpenAI API for topic labeling. The script loads data from the data
directory and extracts the positive and negative topics of the review in a comma-seperated-format.
Important note: The script works best with gpt-4. When using gpt-3.5-turbo, the semicolon separating the good from the bad topics is not always provided. Errorhandling for this can easily be implemented though.
Data
I used a public amazon dataset for this. You can replace it with whatever you need. Just make the correct adjustments to the data loading functionality in main.py
Example
When running the script for the first review of the data set Great product and price!, the positive topics are [‘product’, ‘price] and the negative topics are [”].