Update README.md
Browse files
README.md
CHANGED
@@ -111,4 +111,32 @@ pipeline_tag: text-classification
|
|
111 |
---
|
112 |
## Frequently Asked Questions classifier
|
113 |
This model is trained to determine whether a question/statement is a FAQ, in the domain of products, businesses, website faqs, etc.
|
114 |
-
For e.g `"What is the warranty of your product?"` In contrast, daily questions such as `"how are you?"`, `"what is your name?"`, or simple statements such as `"this is a tree"`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
---
|
112 |
## Frequently Asked Questions classifier
|
113 |
This model is trained to determine whether a question/statement is a FAQ, in the domain of products, businesses, website faqs, etc.
|
114 |
+
For e.g `"What is the warranty of your product?"` In contrast, daily questions such as `"how are you?"`, `"what is your name?"`, or simple statements such as `"this is a tree"`.
|
115 |
+
|
116 |
+
## Usage
|
117 |
+
```python
|
118 |
+
from transformers import pipeline
|
119 |
+
classifier = pipeline("text-classification", "timpal0l/xlm-roberta-base-faq-extractor")
|
120 |
+
label_map = {"LABEL_0" : False, "LABEL_1" : True}
|
121 |
+
|
122 |
+
documents = ["What is the warranty for iPhone15?",
|
123 |
+
"How old are you?",
|
124 |
+
"Nice to meet you",
|
125 |
+
"What is your opening hours?",
|
126 |
+
"What is your name?",
|
127 |
+
"The weather is nice"]
|
128 |
+
|
129 |
+
predictions = classifier(documents)
|
130 |
+
|
131 |
+
for p, d in zip(predictions, documents):
|
132 |
+
print(d, "--->", label_map[p["label"]])
|
133 |
+
```
|
134 |
+
|
135 |
+
```html
|
136 |
+
What is the warranty for iPhone15? ---> True
|
137 |
+
How old are you? ---> False
|
138 |
+
Nice to meet you ---> False
|
139 |
+
What is your opening hours? ---> True
|
140 |
+
What is your name? ---> False
|
141 |
+
The weather is nice ---> False
|
142 |
+
```
|