File size: 12,411 Bytes
a52bae4 | 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | # ============================================================================
# training_data.py β 100 labeled customer-feedback sentences across 6 labels
# ============================================================================
#
# PURPOSE
# -------
# Small training dataset used by training.py to demonstrate supervised and
# unsupervised machine learning on text. Customer feedback is chosen because
# students have strong intuitions about what sentences should cluster or
# classify together β no ML jargon required.
#
# 6 labels, ~16-17 sentences each:
# positive_review β the product made the customer happy
# negative_review β the product made the customer unhappy
# question β the customer wants information
# complaint β something is broken or the customer feels wronged
# compliment β praise for support staff, docs, processes (not product)
# feature_request β the customer wants something added or changed
# ============================================================================
TRAINING_LABELS = (
"positive_review",
"negative_review",
"question",
"complaint",
"compliment",
"feature_request",
)
TRAINING_EXAMPLES = [
# ---------- positive_review (17) ----------
{"sentence": "This product exceeded my expectations and works perfectly.", "label": "positive_review"},
{"sentence": "Absolutely love this app, best purchase I made this year.", "label": "positive_review"},
{"sentence": "Great value for the money, highly recommend to everyone.", "label": "positive_review"},
{"sentence": "The quality is outstanding and the build feels premium.", "label": "positive_review"},
{"sentence": "Works exactly as advertised, very happy with my purchase.", "label": "positive_review"},
{"sentence": "Amazing product, will definitely buy again from this brand.", "label": "positive_review"},
{"sentence": "Five stars, this has become part of my daily routine.", "label": "positive_review"},
{"sentence": "Fantastic experience overall, the product is top notch.", "label": "positive_review"},
{"sentence": "Very pleased with this purchase, delivery was also fast.", "label": "positive_review"},
{"sentence": "Excellent product that does exactly what it promises.", "label": "positive_review"},
{"sentence": "Best in its category, much better than the alternatives I tried.", "label": "positive_review"},
{"sentence": "Solid product at a fair price, no complaints at all.", "label": "positive_review"},
{"sentence": "This exceeded my expectations in every possible way.", "label": "positive_review"},
{"sentence": "Really impressed with the quality and performance.", "label": "positive_review"},
{"sentence": "Perfect for my needs, could not be happier with it.", "label": "positive_review"},
{"sentence": "Love everything about this product, truly a game changer.", "label": "positive_review"},
{"sentence": "Great purchase, I use it every day and it still amazes me.", "label": "positive_review"},
# ---------- negative_review (17) ----------
{"sentence": "Complete waste of money, does not work as described.", "label": "negative_review"},
{"sentence": "Terrible product, broke after just two days of use.", "label": "negative_review"},
{"sentence": "Very disappointed, the quality is much worse than expected.", "label": "negative_review"},
{"sentence": "Do not buy this, it is cheaply made and unreliable.", "label": "negative_review"},
{"sentence": "Worst purchase I have made in years, totally useless.", "label": "negative_review"},
{"sentence": "Poorly designed and falls apart easily, avoid this product.", "label": "negative_review"},
{"sentence": "The product arrived damaged and customer service was no help.", "label": "negative_review"},
{"sentence": "Not worth the price at all, save your money and buy something else.", "label": "negative_review"},
{"sentence": "Does not match the description, feels very cheap.", "label": "negative_review"},
{"sentence": "Stopped working after a week, extremely disappointing.", "label": "negative_review"},
{"sentence": "Low quality materials and shoddy construction, returning it.", "label": "negative_review"},
{"sentence": "Terrible experience, the product failed within days.", "label": "negative_review"},
{"sentence": "Complete garbage, nothing works as it should.", "label": "negative_review"},
{"sentence": "Overpriced and underperforming, look elsewhere.", "label": "negative_review"},
{"sentence": "This is a scam, nothing like what the photos showed.", "label": "negative_review"},
{"sentence": "Horrible quality, I regret buying this immediately.", "label": "negative_review"},
{"sentence": "Do not recommend, this is the worst thing I have bought.", "label": "negative_review"},
# ---------- question (17) ----------
{"sentence": "How do I reset my password for the account?", "label": "question"},
{"sentence": "Where can I find the installation manual online?", "label": "question"},
{"sentence": "What is the warranty period for this product?", "label": "question"},
{"sentence": "Can I use this device with other brands of accessories?", "label": "question"},
{"sentence": "How do I cancel my subscription and get a refund?", "label": "question"},
{"sentence": "Is there a way to export my data to a different format?", "label": "question"},
{"sentence": "What payment methods do you accept for international orders?", "label": "question"},
{"sentence": "How long does shipping usually take to my country?", "label": "question"},
{"sentence": "Can someone explain how the subscription renewal works?", "label": "question"},
{"sentence": "Where do I download the latest software update for the device?", "label": "question"},
{"sentence": "Is there a trial version available before I commit to buying?", "label": "question"},
{"sentence": "How do I contact customer support by phone instead of email?", "label": "question"},
{"sentence": "What is the difference between the basic and premium plans?", "label": "question"},
{"sentence": "Can this product be used outdoors in rainy weather?", "label": "question"},
{"sentence": "How do I transfer my license to a new computer?", "label": "question"},
{"sentence": "Is there a discount available for bulk orders or education?", "label": "question"},
{"sentence": "What are the system requirements to run this software?", "label": "question"},
# ---------- complaint (17) ----------
{"sentence": "The app keeps crashing every time I try to open it.", "label": "complaint"},
{"sentence": "Your support team has been ignoring my emails for two weeks.", "label": "complaint"},
{"sentence": "My order was supposed to arrive yesterday but it still has not shipped.", "label": "complaint"},
{"sentence": "The battery drains much faster than advertised in the listing.", "label": "complaint"},
{"sentence": "I was charged twice for the same order and nobody has fixed it.", "label": "complaint"},
{"sentence": "The website is completely broken on mobile and I cannot check out.", "label": "complaint"},
{"sentence": "My refund has not been processed even though it has been a month.", "label": "complaint"},
{"sentence": "The product connects to WiFi but drops the connection constantly.", "label": "complaint"},
{"sentence": "I received the wrong item and the return process is ridiculous.", "label": "complaint"},
{"sentence": "Every time I call customer service I am left on hold forever.", "label": "complaint"},
{"sentence": "The latest software update broke features that used to work fine.", "label": "complaint"},
{"sentence": "My subscription renewed automatically without any warning email.", "label": "complaint"},
{"sentence": "The sync feature has not worked properly for the last three updates.", "label": "complaint"},
{"sentence": "I have been trying to log in for days but the server keeps rejecting me.", "label": "complaint"},
{"sentence": "The product makes a loud buzzing noise that was not mentioned anywhere.", "label": "complaint"},
{"sentence": "My account was locked without explanation and no one will help me.", "label": "complaint"},
{"sentence": "The promised delivery date has passed three times with no update.", "label": "complaint"},
# ---------- compliment (16) ----------
{"sentence": "Your customer support team was incredibly helpful and patient.", "label": "compliment"},
{"sentence": "The technician who helped me today went above and beyond.", "label": "compliment"},
{"sentence": "Thank you for the quick response to my support ticket.", "label": "compliment"},
{"sentence": "I appreciate how transparent your company is about pricing and policies.", "label": "compliment"},
{"sentence": "The onboarding experience was smooth and well designed.", "label": "compliment"},
{"sentence": "Your staff really knows the product inside and out.", "label": "compliment"},
{"sentence": "I am impressed by how quickly you shipped my replacement item.", "label": "compliment"},
{"sentence": "The documentation is clear and well written, thank you.", "label": "compliment"},
{"sentence": "Your team handled my issue with professionalism and care.", "label": "compliment"},
{"sentence": "I just wanted to say the support chat agent was wonderful.", "label": "compliment"},
{"sentence": "The refund was processed without any hassle, really appreciate it.", "label": "compliment"},
{"sentence": "Your tutorial videos made setup so much easier than expected.", "label": "compliment"},
{"sentence": "Kudos to the engineering team for the latest update, it is great.", "label": "compliment"},
{"sentence": "The packaging was thoughtful and environmentally friendly.", "label": "compliment"},
{"sentence": "I am genuinely grateful for how you handled my complaint.", "label": "compliment"},
{"sentence": "Your company sets the standard for customer service in this industry.", "label": "compliment"},
# ---------- feature_request (16) ----------
{"sentence": "It would be great if you could add a dark mode to the app.", "label": "feature_request"},
{"sentence": "Please consider adding support for two factor authentication.", "label": "feature_request"},
{"sentence": "Could you add an option to export data as CSV or Excel.", "label": "feature_request"},
{"sentence": "I would love to see integration with Google Calendar in a future update.", "label": "feature_request"},
{"sentence": "Please add the ability to customize keyboard shortcuts.", "label": "feature_request"},
{"sentence": "It would be useful to have a widget for the home screen.", "label": "feature_request"},
{"sentence": "Can you add support for more languages, especially Spanish and French.", "label": "feature_request"},
{"sentence": "A bulk edit feature would save so much time in daily workflows.", "label": "feature_request"},
{"sentence": "Please allow users to schedule messages to send later.", "label": "feature_request"},
{"sentence": "It would be amazing if the app had offline mode for travel.", "label": "feature_request"},
{"sentence": "Please add a way to share projects with other users in real time.", "label": "feature_request"},
{"sentence": "Could you add more payment options like Apple Pay and crypto.", "label": "feature_request"},
{"sentence": "Please add support for importing from the competing product.", "label": "feature_request"},
{"sentence": "It would be great to have a built in timer or reminder feature.", "label": "feature_request"},
{"sentence": "Can you add a feature to archive old items without deleting them.", "label": "feature_request"},
{"sentence": "Please consider adding voice commands for accessibility.", "label": "feature_request"},
]
# Sanity check at import time β fail loud if counts drift
assert len(TRAINING_EXAMPLES) == 100, f"Expected 100 examples, got {len(TRAINING_EXAMPLES)}"
assert set(e["label"] for e in TRAINING_EXAMPLES) == set(TRAINING_LABELS), "Label mismatch"
|