File size: 3,175 Bytes
145bb63
 
 
 
 
 
 
 
 
 
 
f1a644d
 
88883cd
 
 
3a9abff
 
 
df77de1
3a9abff
 
 
 
 
 
 
c8d776e
3a9abff
 
 
 
 
 
 
 
 
 
 
 
 
 
c8d776e
3a9abff
6f905c5
88883cd
 
3a9abff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language:
- en
base_model:
- google-bert/bert-base-uncased
pipeline_tag: text2text-generation
tags:
- user
- intent
- intention
- recognition
widget:
 - text: "Sounds good. I'm interested in trying the free trial. How do I sign up?"
---

## Get Started

### Usage

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model = AutoModelForSequenceClassification.from_pretrained("Savtale/User-Intention-Recognition")
tokenizer = AutoTokenizer.from_pretrained("Savtale/User-Intention-Recognition")

# User is talking with a chatbot
input_user_text = "Sounds good. I'm interested in trying the free trial. How do I sign up?"

# Tokenizing text
inputs = tokenizer(input_user_text.lower(), return_tensors="pt")

# Predict
with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits

# Prepare result
probabilities = torch.softmax(logits, dim=-1) # Top Match
predicted_class = int(torch.argmax(probabilities)) # Class no.
str_predicted_class = class_dict[str(predicted_class)] # Class String

print(f"Predicted User Intention: {str_predicted_class}") # Predicted User Intention: Request a Demo

```


### Classes
class_dict = {
    "0": "Ask For Technical Support",
    "1": "Ask General Question",
    "2": "Start Conversation",
    "3": "Express Dissatisfaction",
    "4": "Request Product Information",
    "5": "Inquire About Pricing",
    "6": "Negotiate Price",
    "7": "Request Return or Refund",
    "8": "Provide Positive Feedback",
    "9": "Provide Negative Feedback",
    "10": "Seek Recommendation",
    "11": "Request Customization",
    "12": "Ask About Shipping and Delivery",
    "13": "Inquire About Warranty and Support",
    "14": "Express Interest in Upselling",
    "15": "Express Interest in Cross-selling",
    "16": "Request Urgent Assistance",
    "17": "Ask About Promotions and Discounts",
    "18": "Inquire About Loyalty Programs",
    "19": "Request a Callback",
    "20": "Ask About Payment Options",
    "21": "Express Uncertainty",
    "22": "Request Clarification",
    "23": "Confirm Understanding",
    "24": "End Conversation",
    "25": "Express Gratitude",
    "26": "Apologize",
    "27": "Complain About Customer Service",
    "28": "Request a Manager",
    "29": "Ask About Company Policies",
    "30": "Inquire About Job Opportunities",
    "31": "Ask About Corporate Social Responsibility",
    "32": "Express Interest in Investing",
    "33": "Cancellation",
    "34": "Ask About Return Policy",
    "35": "Inquire About Sustainability Practices",
    "36": "Request a Catalog",
    "37": "Ask About Brand History",
    "38": "Express Interest in Partnership",
    "39": "Inquire About Franchise Opportunities",
    "40": "Ask About Corporate Events",
    "41": "Express Interest in Volunteering",
    "42": "Request a Referral",
    "43": "Ask About Gift Cards",
    "44": "Inquire About Product Availability",
    "45": "Request a Personalized Recommendation",
    "46": "Ask About Order Status",
    "47": "Express Interest in a Webinar or Workshop",
    "48": "Request a Demo",
    "49": "Ask About Social Media Channels"
                }


## Authors
- Savta