Kagermanov commited on
Commit
2dc0fbf
1 Parent(s): 3c90ab9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +170 -1
README.md CHANGED
@@ -41,4 +41,173 @@ widget:
41
  text: 'Directions'
42
  - title: Description Example
43
  text: 'Provides: Auto maintenance'
44
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  text: 'Directions'
42
  - title: Description Example
43
  text: 'Provides: Auto maintenance'
44
+ ---
45
+
46
+ <h1 align="center">BERT-based Classification Model for Google Local Listing</h1>
47
+
48
+ <p align="center">
49
+ This repository contains a BERT-based classification model developed using the Hugging Face library, and a dataset gathered by <a href='https://serpapi.com/google-local-api'>SerpApi's Google Local API</a>. The model is designed to classify different texts extracted from Google Local Listings.
50
+ </p>
51
+
52
+ ---
53
+
54
+ <h2 align="center">Usage and Classification for Parsing</h2>
55
+
56
+ <p align="center">
57
+ The example code below represents using it Python with Inference API for prototyping. You may use different programming languages for calling the results, and you may parallelize your work. Prototyping endpoint will have limited amount of calls. For <code>Production Purposes</code> or <code>Large Prototyping Activities</code>, consider setting an <code>Inference API Endpoint from Huggingface</code>, or a <code>Private API Server</code> for serving the model.
58
+ </p>
59
+
60
+ ```py
61
+ API_URL = "https://api-inference.huggingface.co/models/serpapi/bert-base-local-results"
62
+ headers = {"Authorization": "Bearer xxxxx"}
63
+
64
+ def query(payload):
65
+ response = requests.post(API_URL, headers=headers, json=payload)
66
+ return response.json()
67
+
68
+ output = query({
69
+ "inputs": "5540 N Lamar Blvd #12, Austin, TX 78756, United States",
70
+ })
71
+ ```
72
+
73
+ ```
74
+ Output: address
75
+ ```
76
+
77
+ ---
78
+
79
+ <h2 align="center">Strong Features</h2>
80
+
81
+ <div align="center">
82
+ <p>The BERT-based model excels in the following areas:</p>
83
+ <div style="display: flex; justify-content: center;">
84
+ <div style="text-align: left;">
85
+ <ul style="list-style-position: inside;">
86
+ <li><strong>Differentiating difficult semantic similarities with ease</strong>
87
+ <ul style="list-style-type: disc;">
88
+ <li><code>"No Reviews"</code> &rarr; <code>reviews</code></li>
89
+ <li><code>"(5K+)"</code> &rarr; <code>reviews</code></li>
90
+ </ul>
91
+ </li>
92
+ <li><strong>Handling partial texts that can be combined later</strong>
93
+ <ul style="list-style-type: disc;">
94
+ <li><code>"Open ⋅ Closes 5 pm"</code>
95
+ <ul style="list-style-type: circle;">
96
+ <li><code>"Open"</code> &rarr; <code>hours</code></li>
97
+ <li><code>"Closes 5 pm"</code> &rarr; <code>hours</code></li>
98
+ </ul>
99
+ </li>
100
+ </ul>
101
+ </li>
102
+ <li><strong>Handling Vocabulary from diverse areas with ease</strong>
103
+ <ul style="list-style-type: disc;">
104
+ <li><code>"Doctor"</code> &rarr; <code>type</code></li>
105
+ <li><code>"Restaurant"</code> &rarr; <code>type</code></li>
106
+ </ul>
107
+ </li>
108
+ <li><strong>Returning Assurance Score for After-Correction</strong>
109
+ <ul style="list-style-type: disc;">
110
+ <li><code>"Doctor"</code> &rarr; <code>type</code></li>
111
+ <li><code>"Restaurant"</code> &rarr; <code>type</code></li>
112
+ </ul>
113
+ </li>
114
+ <li><strong>Strong Against Grammatical Mistakes</strong>
115
+ <ul style="list-style-type: disc;">
116
+ <li><code>"Krebside Pickup"</code> &rarr; <code>service options</code></li>
117
+ </ul>
118
+ </li>
119
+ </ul>
120
+ </div>
121
+ </div>
122
+ </div>
123
+
124
+
125
+ ---
126
+
127
+ <h2 align="center">Parts Covered and Corresponding Keys in SerpApi Parsers</h2>
128
+
129
+ <div align="center">
130
+
131
+ <ul style="text-align: center; list-style-position: inside;">
132
+ <li><strong>Type of Place:</strong> <code>type</code></li>
133
+ <li><strong>Number of Reviews:</strong> <code>reviews</code></li>
134
+ <li><strong>Phone Number:</strong> <code>phone</code></li>
135
+ <li><strong>Rating:</strong> <code>rating</code></li>
136
+ <li><strong>Address:</strong> <code>address</code></li>
137
+ <li><strong>Operating Hours:</strong> <code>hours</code></li>
138
+ <li><strong>Description or Descriptive Review:</strong> <code>description</code></li>
139
+ <li><strong>Expensiveness:</strong> <code>expensiveness</code></li>
140
+ <li><strong>Service Options:</strong> <code>service options</code></li>
141
+ <li><strong>Button Text:</strong> <code>links</code></li>
142
+ <li><strong>Years in Business:</strong> <code>years_in_business</code></li>
143
+ </ul>
144
+
145
+ </div>
146
+
147
+
148
+
149
+ <p align="center">
150
+ Please refer to the documentation of SerpApi's Google Local API and Google Local Pack API for more details on different parts:
151
+ </p>
152
+
153
+ <div align="center">
154
+
155
+ <strong>References:</strong>
156
+
157
+ <li>SerpApi's Google Local API: <a href ="https://serpapi.com/google-local-api">https://serpapi.com/google-local-api</a></li>
158
+ <li>SerpApi's Google Local Pack API: <a href="https://serpapi.com/local-pack">https://serpapi.com/local-pack</a></li>
159
+
160
+ </div>
161
+
162
+ ---
163
+
164
+ <h2 align="center">Known Limitations</h2>
165
+
166
+ <div align="center">
167
+ <p>The model has a few limitations that should be taken into account:</p>
168
+ <div style="display: flex; justify-content: center;">
169
+ <div style="text-align: left;">
170
+ <ul style="list-style-position: inside;">
171
+ <li>Button text like "Delivery" could be considered <code>service_options</code>. However, this can be easily avoided by checking if a text is in a button in the traditional part of the code. The button text is only used for emergency cases.</li>
172
+ <li>The model does not classify the title of a place. This is because the title often contains many elements that can be easily confused with other parts, even for a human eye.</li>
173
+ <li>The <code>label</code> key is not covered by the model, as it can be easily handled with traditional code.</li>
174
+ <li>In some cases, the model may classify a portion of the description as <code>hours</code> if the description is about operating hours. For example:
175
+ <ul style="list-style-type: disc;">
176
+ <li><code>"Drive through: Open ⋅ Closes 12 AM"</code>
177
+ <ul style="list-style-type: circle">
178
+ <li><code>"Drive through: Open"</code> &rarr; <code>description</code></li>
179
+ <li><code>"Closes 12 AM"</code> &rarr; <code>hours</code></li>
180
+ </ul>
181
+ </li>
182
+ </ul>
183
+ </li>
184
+ <li>The model may be susceptible to error in one word entries. This is a minority of the cases, and it could be fixed with assurance scores.For Example:
185
+ <ul style="list-style-type: circle">
186
+ <li><code>"Sushi"</code> &rarr; <code>address(0.984), type(0.0493)</code></li>
187
+ <li><code>"Diagorou 4"</code> &rarr; <code>address(0.999)</code></li>
188
+ </ul>
189
+ </li>
190
+ <li>The model cannot differentiate between extra parts that are extracted in SerpApi's Google Local API and Google Local Pack API. These parts are not feasible to extract via Classification Models.</li>
191
+ <li>The model is not designed for Listings outside English Language.</li>
192
+ </ul>
193
+ </div>
194
+ </div>
195
+ </div>
196
+
197
+ ---
198
+
199
+ <h2 align="center">Disclaimer</h2>
200
+
201
+ <p align="center">We value full transparency and painful honesty both in our internal and external communications. We believe a world with complete and open transparency is a better world.</p>
202
+ <p align="center">
203
+ However, while we strive for transparency, there are certain situations where sharing specific datasets may not be feasible or advisable. In the case of the dataset used to train our model, which contains different parts of a Google Local Listing including addresses and phone numbers, we have made a careful decision not to share it. We prioritize the well-being and safety of individuals, and sharing this dataset could potentially cause harm to people whose personal information is included.
204
+ </p>
205
+ <p align="center">
206
+ Protecting the privacy and security of individuals is of utmost importance to us. Disclosing personal information, such as addresses and phone numbers, without proper consent or safeguards could lead to privacy violations, identity theft, harassment, or other forms of misuse. Our commitment to responsible data usage means that we handle sensitive information with great care and take appropriate measures to ensure its protection.
207
+ </p>
208
+ <p align="center">
209
+ While we understand the value of transparency, we also recognize the need to strike a balance between transparency and safeguarding individuals' privacy and security. In this particular case, the potential harm that could result from sharing the dataset outweighs the benefits of complete transparency. By prioritizing privacy, we aim to create a safer and more secure environment for all individuals involved.
210
+ </p>
211
+ <p align="center">
212
+ We appreciate your understanding and support in our commitment to responsible and ethical data practices. If you have any further questions or concerns, please feel free to reach out to us.
213
+ </p>