12 lines
1.1 KiB
Python
12 lines
1.1 KiB
Python
from sawaw.openai_gpt import SentimentResult, query
|
|
|
|
|
|
def test_query():
|
|
comment = "Our meal was accompanied by a Zweigelt, an Austrian red wine. Spicy, and delicious! The restaurant has a few cocktails and wines, but you are welcome to bring your own for a $20 corkage fee. Each course was presented beautifully, as our server would poured the accenting sauce on our plates. The crudo was refreshing (loved those blood oranges!), and my salmon was dead on. They nailed it! Not too tough and the buerre blanc sauce complimented it nicely. It was served on a bed of wild rice which was a bit crunchy for my taste, but it worked with the dish The desserts were ok, and I unluckily chose the creme caramel which basically melted in my mouth (I prefer a little more texture, so I think it is not that satisfactory). Overall, a great experience and I will definitely be back!"
|
|
aspect_words = ["creme caramel", "wine"]
|
|
results = query(comment, aspect_words)
|
|
assert results["creme caramel"] == SentimentResult.NEGATIVE
|
|
assert results["wine"] == SentimentResult.POSITIVE
|
|
result = query(comment, "machine gun")
|
|
assert result == SentimentResult.NONE
|