@vannizhang/living-atlas-content-validator 1.5.13 → 1.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data/TitleSummaryMatchingPatterns.json +1901 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/layers/scoringConfig.js +1 -1
- package/dist/lib/recommendedText/checkRecommendedText.d.ts +15 -0
- package/dist/lib/recommendedText/checkRecommendedText.js +95 -0
- package/dist/lib/recommendedText/checkRecommendedText.js.map +1 -0
- package/dist/lib/recommendedText/helpers.d.ts +8 -0
- package/dist/lib/recommendedText/helpers.js +44 -0
- package/dist/lib/recommendedText/helpers.js.map +1 -0
- package/dist/lib/recommendedText/matchDateTimeInfo.d.ts +9 -0
- package/dist/lib/recommendedText/matchDateTimeInfo.js +80 -0
- package/dist/lib/recommendedText/matchDateTimeInfo.js.map +1 -0
- package/dist/lib/recommendedText/matchLocationInfo.d.ts +9 -0
- package/dist/lib/recommendedText/matchLocationInfo.js +744 -0
- package/dist/lib/recommendedText/matchLocationInfo.js.map +1 -0
- package/dist/lib/recommendedText/matchSourceInfo.d.ts +9 -0
- package/dist/lib/recommendedText/matchSourceInfo.js +31 -0
- package/dist/lib/recommendedText/matchSourceInfo.js.map +1 -0
- package/dist/lib/recommendedText/matchTopicInfo.d.ts +9 -0
- package/dist/lib/recommendedText/matchTopicInfo.js +31 -0
- package/dist/lib/recommendedText/matchTopicInfo.js.map +1 -0
- package/dist/lib/recommendedText/scoringConfig.d.ts +11 -0
- package/dist/lib/recommendedText/scoringConfig.js +16 -0
- package/dist/lib/recommendedText/scoringConfig.js.map +1 -0
- package/dist/lib/ssl/scoringConfig.js +1 -1
- package/dist/lib/tags/scoringConfig.js +1 -1
- package/dist/lib/tags/scoringConfig.js.map +1 -1
- package/dist/lib/thumbnail/scoringConfig.js +1 -1
- package/dist/lib/userProfileDescription/scoringConfig.js +9 -9
- package/dist/lib/userProfileName/scoringConfig.js +3 -3
- package/dist/lib/userProfileThumbnail/scoringConfig.js +1 -1
- package/dist/lib/util/getScoringRules.d.ts +8 -0
- package/dist/lib/util/getScoringRules.js +28 -1
- package/dist/lib/util/getScoringRules.js.map +1 -1
- package/dist/lib/util/isLayer.d.ts +12 -0
- package/dist/lib/util/isLayer.js +26 -0
- package/dist/lib/util/isLayer.js.map +1 -0
- package/dist/lib/util/shouldValidateByBetaRules.d.ts +10 -0
- package/dist/lib/util/shouldValidateByBetaRules.js +53 -0
- package/dist/lib/util/shouldValidateByBetaRules.js.map +1 -0
- package/dist/lib/validate/validate.js +5 -0
- package/dist/lib/validate/validate.js.map +1 -1
- package/dist/locale/de.json +11 -1
- package/dist/locale/en.json +10 -0
- package/dist/locale/es.json +10 -0
- package/dist/locale/fr.json +10 -0
- package/dist/locale/ja.json +10 -0
- package/dist/locale/pt-br.json +10 -0
- package/dist/package-info.json +1 -1
- package/dist/types/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.matchLocationInfo = void 0;
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
8
|
+
const TitleSummaryMatchingPatterns_json_1 = __importDefault(require("../../data/TitleSummaryMatchingPatterns.json"));
|
|
9
|
+
const WORLD_COUNTRIES = [
|
|
10
|
+
'Afghanistan',
|
|
11
|
+
'Albania',
|
|
12
|
+
'Algeria',
|
|
13
|
+
'American Samoa',
|
|
14
|
+
'Andorra',
|
|
15
|
+
'Angola',
|
|
16
|
+
'Anguilla',
|
|
17
|
+
'Antarctica',
|
|
18
|
+
'Antigua and Barbuda',
|
|
19
|
+
'Argentina',
|
|
20
|
+
'Armenia',
|
|
21
|
+
'Aruba',
|
|
22
|
+
'Australia',
|
|
23
|
+
'Austria',
|
|
24
|
+
'Azerbaijan',
|
|
25
|
+
'Azores',
|
|
26
|
+
'Bahamas',
|
|
27
|
+
'Bahrain',
|
|
28
|
+
'Bangladesh',
|
|
29
|
+
'Barbados',
|
|
30
|
+
'Belarus',
|
|
31
|
+
'Belgium',
|
|
32
|
+
'Belize',
|
|
33
|
+
'Benin',
|
|
34
|
+
'Bermuda',
|
|
35
|
+
'Bhutan',
|
|
36
|
+
'Bolivia',
|
|
37
|
+
'Bonaire',
|
|
38
|
+
'Bosnia and Herzegovina',
|
|
39
|
+
'Botswana',
|
|
40
|
+
'Bouvet Island',
|
|
41
|
+
'Brazil',
|
|
42
|
+
'British Indian Ocean Territory',
|
|
43
|
+
'British Virgin Islands',
|
|
44
|
+
'Brunei Darussalam',
|
|
45
|
+
'Bulgaria',
|
|
46
|
+
'Burkina Faso',
|
|
47
|
+
'Burundi',
|
|
48
|
+
'Cabo Verde',
|
|
49
|
+
'Cambodia',
|
|
50
|
+
'Cameroon',
|
|
51
|
+
'Canada',
|
|
52
|
+
'Canarias',
|
|
53
|
+
'Cayman Islands',
|
|
54
|
+
'Central African Republic',
|
|
55
|
+
'Chad',
|
|
56
|
+
'Chile',
|
|
57
|
+
'China',
|
|
58
|
+
'Christmas Island',
|
|
59
|
+
'Cocos Islands',
|
|
60
|
+
'Colombia',
|
|
61
|
+
'Comoros',
|
|
62
|
+
'Congo',
|
|
63
|
+
'Congo DRC',
|
|
64
|
+
'Cook Islands',
|
|
65
|
+
'Costa Rica',
|
|
66
|
+
"Côte d'Ivoire",
|
|
67
|
+
'Croatia',
|
|
68
|
+
'Cuba',
|
|
69
|
+
'Curacao',
|
|
70
|
+
'Cyprus',
|
|
71
|
+
'Czech Republic',
|
|
72
|
+
'Denmark',
|
|
73
|
+
'Djibouti',
|
|
74
|
+
'Dominica',
|
|
75
|
+
'Dominican Republic',
|
|
76
|
+
'Ecuador',
|
|
77
|
+
'Egypt',
|
|
78
|
+
'El Salvador',
|
|
79
|
+
'Equatorial Guinea',
|
|
80
|
+
'Eritrea',
|
|
81
|
+
'Estonia',
|
|
82
|
+
'Eswatini',
|
|
83
|
+
'Ethiopia',
|
|
84
|
+
'Falkland Islands',
|
|
85
|
+
'Faroe Islands',
|
|
86
|
+
'Fiji',
|
|
87
|
+
'Finland',
|
|
88
|
+
'France',
|
|
89
|
+
'French Guiana',
|
|
90
|
+
'French Polynesia',
|
|
91
|
+
'French Southern Territories',
|
|
92
|
+
'Gabon',
|
|
93
|
+
'Gambia',
|
|
94
|
+
'Georgia',
|
|
95
|
+
'Germany',
|
|
96
|
+
'Ghana',
|
|
97
|
+
'Gibraltar',
|
|
98
|
+
'Glorioso Islands',
|
|
99
|
+
'Greece',
|
|
100
|
+
'Greenland',
|
|
101
|
+
'Grenada',
|
|
102
|
+
'Guadeloupe',
|
|
103
|
+
'Guam',
|
|
104
|
+
'Guatemala',
|
|
105
|
+
'Guernsey',
|
|
106
|
+
'Guinea',
|
|
107
|
+
'Guinea-Bissau',
|
|
108
|
+
'Guyana',
|
|
109
|
+
'Haiti',
|
|
110
|
+
'Heard Island and McDonald Islands',
|
|
111
|
+
'Honduras',
|
|
112
|
+
'Hungary',
|
|
113
|
+
'Iceland',
|
|
114
|
+
'India',
|
|
115
|
+
'Indonesia',
|
|
116
|
+
'Iran',
|
|
117
|
+
'Iraq',
|
|
118
|
+
'Ireland',
|
|
119
|
+
'Isle of Man',
|
|
120
|
+
'Israel',
|
|
121
|
+
'Italy',
|
|
122
|
+
'Jamaica',
|
|
123
|
+
'Japan',
|
|
124
|
+
'Jersey',
|
|
125
|
+
'Jordan',
|
|
126
|
+
'Juan De Nova Island',
|
|
127
|
+
'Kazakhstan',
|
|
128
|
+
'Kenya',
|
|
129
|
+
'Kiribati',
|
|
130
|
+
'Kuwait',
|
|
131
|
+
'Kyrgyzstan',
|
|
132
|
+
'Laos',
|
|
133
|
+
'Latvia',
|
|
134
|
+
'Lebanon',
|
|
135
|
+
'Lesotho',
|
|
136
|
+
'Liberia',
|
|
137
|
+
'Libya',
|
|
138
|
+
'Liechtenstein',
|
|
139
|
+
'Lithuania',
|
|
140
|
+
'Luxembourg',
|
|
141
|
+
'Madagascar',
|
|
142
|
+
'Madeira',
|
|
143
|
+
'Malawi',
|
|
144
|
+
'Malaysia',
|
|
145
|
+
'Maldives',
|
|
146
|
+
'Mali',
|
|
147
|
+
'Malta',
|
|
148
|
+
'Marshall Islands',
|
|
149
|
+
'Martinique',
|
|
150
|
+
'Mauritania',
|
|
151
|
+
'Mauritius',
|
|
152
|
+
'Mayotte',
|
|
153
|
+
'Mexico',
|
|
154
|
+
'Micronesia',
|
|
155
|
+
'Moldova',
|
|
156
|
+
'Monaco',
|
|
157
|
+
'Mongolia',
|
|
158
|
+
'Montenegro',
|
|
159
|
+
'Montserrat',
|
|
160
|
+
'Morocco',
|
|
161
|
+
'Mozambique',
|
|
162
|
+
'Myanmar',
|
|
163
|
+
'Namibia',
|
|
164
|
+
'Nauru',
|
|
165
|
+
'Nepal',
|
|
166
|
+
'Netherlands',
|
|
167
|
+
'New Caledonia',
|
|
168
|
+
'New Zealand',
|
|
169
|
+
'Nicaragua',
|
|
170
|
+
'Niger',
|
|
171
|
+
'Nigeria',
|
|
172
|
+
'Niue',
|
|
173
|
+
'Norfolk Island',
|
|
174
|
+
'North Korea',
|
|
175
|
+
'North Macedonia',
|
|
176
|
+
'Northern Mariana Islands',
|
|
177
|
+
'Norway',
|
|
178
|
+
'Oman',
|
|
179
|
+
'Pakistan',
|
|
180
|
+
'Palau',
|
|
181
|
+
'Palestinian Territory',
|
|
182
|
+
'Panama',
|
|
183
|
+
'Papua New Guinea',
|
|
184
|
+
'Paraguay',
|
|
185
|
+
'Peru',
|
|
186
|
+
'Philippines',
|
|
187
|
+
'Pitcairn',
|
|
188
|
+
'Poland',
|
|
189
|
+
'Portugal',
|
|
190
|
+
'Puerto Rico',
|
|
191
|
+
'Qatar',
|
|
192
|
+
'Réunion',
|
|
193
|
+
'Romania',
|
|
194
|
+
'Russian Federation',
|
|
195
|
+
'Rwanda',
|
|
196
|
+
'Saba',
|
|
197
|
+
'Saint Barthelemy',
|
|
198
|
+
'Saint Eustatius',
|
|
199
|
+
'Saint Helena',
|
|
200
|
+
'Saint Kitts and Nevis',
|
|
201
|
+
'Saint Lucia',
|
|
202
|
+
'Saint Martin',
|
|
203
|
+
'Saint Pierre and Miquelon',
|
|
204
|
+
'Saint Vincent and the Grenadines',
|
|
205
|
+
'Samoa',
|
|
206
|
+
'San Marino',
|
|
207
|
+
'Sao Tome and Principe',
|
|
208
|
+
'Saudi Arabia',
|
|
209
|
+
'Senegal',
|
|
210
|
+
'Serbia',
|
|
211
|
+
'Seychelles',
|
|
212
|
+
'Sierra Leone',
|
|
213
|
+
'Singapore',
|
|
214
|
+
'Sint Maarten',
|
|
215
|
+
'Slovakia',
|
|
216
|
+
'Slovenia',
|
|
217
|
+
'Solomon Islands',
|
|
218
|
+
'Somalia',
|
|
219
|
+
'South Africa',
|
|
220
|
+
'South Georgia and South Sandwich Islands',
|
|
221
|
+
'South Korea',
|
|
222
|
+
'South Sudan',
|
|
223
|
+
'Spain',
|
|
224
|
+
'Sri Lanka',
|
|
225
|
+
'Sudan',
|
|
226
|
+
'Suriname',
|
|
227
|
+
'Svalbard',
|
|
228
|
+
'Sweden',
|
|
229
|
+
'Switzerland',
|
|
230
|
+
'Syria',
|
|
231
|
+
'Tajikistan',
|
|
232
|
+
'Tanzania',
|
|
233
|
+
'Thailand',
|
|
234
|
+
'Timor-Leste',
|
|
235
|
+
'Togo',
|
|
236
|
+
'Tokelau',
|
|
237
|
+
'Tonga',
|
|
238
|
+
'Trinidad and Tobago',
|
|
239
|
+
'Tunisia',
|
|
240
|
+
'Turkiye',
|
|
241
|
+
'Turkmenistan',
|
|
242
|
+
'Turks and Caicos Islands',
|
|
243
|
+
'Tuvalu',
|
|
244
|
+
'Uganda',
|
|
245
|
+
'Ukraine',
|
|
246
|
+
'United Arab Emirates',
|
|
247
|
+
'United Kingdom',
|
|
248
|
+
'United States',
|
|
249
|
+
'Uruguay',
|
|
250
|
+
'US Virgin Islands',
|
|
251
|
+
'Uzbekistan',
|
|
252
|
+
'Vanuatu',
|
|
253
|
+
'Vatican City',
|
|
254
|
+
'Venezuela',
|
|
255
|
+
'Vietnam',
|
|
256
|
+
'Wallis and Futuna',
|
|
257
|
+
'Yemen',
|
|
258
|
+
'Zambia',
|
|
259
|
+
'Zimbabwe',
|
|
260
|
+
];
|
|
261
|
+
const US_STATES = [
|
|
262
|
+
'Alabama',
|
|
263
|
+
'Alaska',
|
|
264
|
+
'Arizona',
|
|
265
|
+
'Arkansas',
|
|
266
|
+
'California',
|
|
267
|
+
'Colorado',
|
|
268
|
+
'Connecticut',
|
|
269
|
+
'Delaware',
|
|
270
|
+
'District of Columbia',
|
|
271
|
+
'Florida',
|
|
272
|
+
'Georgia',
|
|
273
|
+
'Hawaii',
|
|
274
|
+
'Idaho',
|
|
275
|
+
'Illinois',
|
|
276
|
+
'Indiana',
|
|
277
|
+
'Iowa',
|
|
278
|
+
'Kansas',
|
|
279
|
+
'Kentucky',
|
|
280
|
+
'Louisiana',
|
|
281
|
+
'Maine',
|
|
282
|
+
'Maryland',
|
|
283
|
+
'Massachusetts',
|
|
284
|
+
'Michigan',
|
|
285
|
+
'Minnesota',
|
|
286
|
+
'Mississippi',
|
|
287
|
+
'Missouri',
|
|
288
|
+
'Montana',
|
|
289
|
+
'Nebraska',
|
|
290
|
+
'Nevada',
|
|
291
|
+
'New Hampshire',
|
|
292
|
+
'New Jersey',
|
|
293
|
+
'New Mexico',
|
|
294
|
+
'New York',
|
|
295
|
+
'North Carolina',
|
|
296
|
+
'North Dakota',
|
|
297
|
+
'Ohio',
|
|
298
|
+
'Oklahoma',
|
|
299
|
+
'Oregon',
|
|
300
|
+
'Pennsylvania',
|
|
301
|
+
'Rhode Island',
|
|
302
|
+
'South Carolina',
|
|
303
|
+
'South Dakota',
|
|
304
|
+
'Tennessee',
|
|
305
|
+
'Texas',
|
|
306
|
+
'Utah',
|
|
307
|
+
'Vermont',
|
|
308
|
+
'Virginia',
|
|
309
|
+
'Washington',
|
|
310
|
+
'West Virginia',
|
|
311
|
+
'Wisconsin',
|
|
312
|
+
'Wyoming',
|
|
313
|
+
'Washington, D.C',
|
|
314
|
+
];
|
|
315
|
+
/**
|
|
316
|
+
* Major cities with population greater than 100K
|
|
317
|
+
* @see https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_Major_Cities_/FeatureServer/0
|
|
318
|
+
*/
|
|
319
|
+
const US_MAJOR_CITIES = [
|
|
320
|
+
'Roanoke',
|
|
321
|
+
'Nampa',
|
|
322
|
+
'Edinburg',
|
|
323
|
+
'Federal Way',
|
|
324
|
+
'New Bedford',
|
|
325
|
+
"Lee's Summit",
|
|
326
|
+
'Lynn',
|
|
327
|
+
'Chico',
|
|
328
|
+
'Quincy',
|
|
329
|
+
'Davenport',
|
|
330
|
+
'Wichita Falls',
|
|
331
|
+
'Vacaville',
|
|
332
|
+
'Menifee',
|
|
333
|
+
'Norwalk',
|
|
334
|
+
'Spokane Valley',
|
|
335
|
+
'Highlands Ranch',
|
|
336
|
+
'South Bend',
|
|
337
|
+
'Rialto',
|
|
338
|
+
'Rio Rancho',
|
|
339
|
+
'Allen',
|
|
340
|
+
'Columbia',
|
|
341
|
+
'Daly City',
|
|
342
|
+
'Jurupa Valley',
|
|
343
|
+
'Concord',
|
|
344
|
+
'Brockton',
|
|
345
|
+
'San Mateo',
|
|
346
|
+
'Davie',
|
|
347
|
+
'Tyler',
|
|
348
|
+
'El Cajon',
|
|
349
|
+
'Hillsboro',
|
|
350
|
+
'Renton',
|
|
351
|
+
'Burbank',
|
|
352
|
+
'Green Bay',
|
|
353
|
+
'Riverview',
|
|
354
|
+
'South Fulton',
|
|
355
|
+
'Inglewood',
|
|
356
|
+
'Sandy Springs',
|
|
357
|
+
'Boulder',
|
|
358
|
+
'Centennial',
|
|
359
|
+
'Sparks',
|
|
360
|
+
'Greeley',
|
|
361
|
+
'El Monte',
|
|
362
|
+
'West Covina',
|
|
363
|
+
'Santa Maria',
|
|
364
|
+
'Dearborn',
|
|
365
|
+
'Temecula',
|
|
366
|
+
'Everett',
|
|
367
|
+
'San Buenaventura',
|
|
368
|
+
'Murrieta',
|
|
369
|
+
'Sugar Land',
|
|
370
|
+
'Las Cruces',
|
|
371
|
+
'Miami Gardens',
|
|
372
|
+
'Lewisville',
|
|
373
|
+
'Pueblo',
|
|
374
|
+
'Costa Mesa',
|
|
375
|
+
'Pompano Beach',
|
|
376
|
+
'Lakeland',
|
|
377
|
+
'Lansing',
|
|
378
|
+
'Peoria',
|
|
379
|
+
'Broken Arrow',
|
|
380
|
+
'Spring Hill',
|
|
381
|
+
'High Point',
|
|
382
|
+
'Gresham',
|
|
383
|
+
'Lehigh Acres',
|
|
384
|
+
'Downey',
|
|
385
|
+
'League City',
|
|
386
|
+
'Springfield',
|
|
387
|
+
'Waterbury',
|
|
388
|
+
'Odessa',
|
|
389
|
+
'The Woodlands',
|
|
390
|
+
'Brandon',
|
|
391
|
+
'Carlsbad',
|
|
392
|
+
'Elgin',
|
|
393
|
+
'North Charleston',
|
|
394
|
+
'Provo',
|
|
395
|
+
'Beaumont',
|
|
396
|
+
'Antioch',
|
|
397
|
+
'Wilmington',
|
|
398
|
+
'Lowell',
|
|
399
|
+
'Manchester',
|
|
400
|
+
'Westminster',
|
|
401
|
+
'Richmond',
|
|
402
|
+
'West Jordan',
|
|
403
|
+
'Billings',
|
|
404
|
+
'Clearwater',
|
|
405
|
+
'Evansville',
|
|
406
|
+
'West Palm Beach',
|
|
407
|
+
'Meridian',
|
|
408
|
+
'Cambridge',
|
|
409
|
+
'East Los Angeles',
|
|
410
|
+
'Round Rock',
|
|
411
|
+
'Richardson',
|
|
412
|
+
'Palm Bay',
|
|
413
|
+
'Fairfield',
|
|
414
|
+
'Clovis',
|
|
415
|
+
'College Station',
|
|
416
|
+
'Hartford',
|
|
417
|
+
'Lafayette',
|
|
418
|
+
'Rochester',
|
|
419
|
+
'Independence',
|
|
420
|
+
'Ann Arbor',
|
|
421
|
+
'Berkeley',
|
|
422
|
+
'Arvada',
|
|
423
|
+
'Abilene',
|
|
424
|
+
'Concord',
|
|
425
|
+
'Pearland',
|
|
426
|
+
'Allentown',
|
|
427
|
+
'Fargo',
|
|
428
|
+
'Vallejo',
|
|
429
|
+
'Columbia',
|
|
430
|
+
'Simi Valley',
|
|
431
|
+
'Topeka',
|
|
432
|
+
'Thousand Oaks',
|
|
433
|
+
'Athens',
|
|
434
|
+
'Santa Clara',
|
|
435
|
+
'Norman',
|
|
436
|
+
'Midland',
|
|
437
|
+
'Carrollton',
|
|
438
|
+
'New Haven',
|
|
439
|
+
'Sterling Heights',
|
|
440
|
+
'Coral Springs',
|
|
441
|
+
'Miramar',
|
|
442
|
+
'Victorville',
|
|
443
|
+
'Stamford',
|
|
444
|
+
'Kent',
|
|
445
|
+
'Columbia',
|
|
446
|
+
'Hampton',
|
|
447
|
+
'Elizabeth',
|
|
448
|
+
'Dayton',
|
|
449
|
+
'Cedar Rapids',
|
|
450
|
+
'Waco',
|
|
451
|
+
'Pasadena',
|
|
452
|
+
'Warren',
|
|
453
|
+
'Denton',
|
|
454
|
+
'Orange',
|
|
455
|
+
'West Valley City',
|
|
456
|
+
'Gainesville',
|
|
457
|
+
'Olathe',
|
|
458
|
+
'Visalia',
|
|
459
|
+
'Thornton',
|
|
460
|
+
'McAllen',
|
|
461
|
+
'Surprise',
|
|
462
|
+
'Metairie',
|
|
463
|
+
'Fullerton',
|
|
464
|
+
'Torrance',
|
|
465
|
+
'Roseville',
|
|
466
|
+
'Savannah',
|
|
467
|
+
'Syracuse',
|
|
468
|
+
'Bridgeport',
|
|
469
|
+
'Rockford',
|
|
470
|
+
'Naperville',
|
|
471
|
+
'Mesquite',
|
|
472
|
+
'Charleston',
|
|
473
|
+
'Joliet',
|
|
474
|
+
'Escondido',
|
|
475
|
+
'Pomona',
|
|
476
|
+
'Bellevue',
|
|
477
|
+
'Pasadena',
|
|
478
|
+
'Murfreesboro',
|
|
479
|
+
'Hollywood',
|
|
480
|
+
'Killeen',
|
|
481
|
+
'Jackson',
|
|
482
|
+
'Sunnyvale',
|
|
483
|
+
'Springfield',
|
|
484
|
+
'Lakewood',
|
|
485
|
+
'Kansas City',
|
|
486
|
+
'Corona',
|
|
487
|
+
'Macon-Bibb County',
|
|
488
|
+
'Alexandria',
|
|
489
|
+
'Paterson',
|
|
490
|
+
'Hayward',
|
|
491
|
+
'Salinas',
|
|
492
|
+
'Clarksville',
|
|
493
|
+
'Springfield',
|
|
494
|
+
'Palmdale',
|
|
495
|
+
'Fort Collins',
|
|
496
|
+
'Pembroke Pines',
|
|
497
|
+
'Garden Grove',
|
|
498
|
+
'Lancaster',
|
|
499
|
+
'Oceanside',
|
|
500
|
+
'Rancho Cucamonga',
|
|
501
|
+
'Cary',
|
|
502
|
+
'Ontario',
|
|
503
|
+
'Salem',
|
|
504
|
+
'Elk Grove',
|
|
505
|
+
'Eugene',
|
|
506
|
+
'Santa Rosa',
|
|
507
|
+
'Aurora',
|
|
508
|
+
'Tempe',
|
|
509
|
+
'Chattanooga',
|
|
510
|
+
'Fort Lauderdale',
|
|
511
|
+
'Newport News',
|
|
512
|
+
'Brownsville',
|
|
513
|
+
// 'Mobile',
|
|
514
|
+
'Shreveport',
|
|
515
|
+
'Akron',
|
|
516
|
+
'Knoxville',
|
|
517
|
+
'Vancouver',
|
|
518
|
+
'Providence',
|
|
519
|
+
'Peoria',
|
|
520
|
+
'Paradise',
|
|
521
|
+
'Sioux Falls',
|
|
522
|
+
'Cape Coral',
|
|
523
|
+
'McKinney',
|
|
524
|
+
'Grand Prairie',
|
|
525
|
+
'Tallahassee',
|
|
526
|
+
'Glendale',
|
|
527
|
+
'Overland Park',
|
|
528
|
+
'Huntington Beach',
|
|
529
|
+
'Grand Rapids',
|
|
530
|
+
'Salt Lake City',
|
|
531
|
+
'Amarillo',
|
|
532
|
+
'Frisco',
|
|
533
|
+
'Montgomery',
|
|
534
|
+
'Birmingham',
|
|
535
|
+
'Oxnard',
|
|
536
|
+
'Augusta',
|
|
537
|
+
'Little Rock',
|
|
538
|
+
'Port St. Lucie',
|
|
539
|
+
'Sunrise Manor',
|
|
540
|
+
'Worcester',
|
|
541
|
+
'Columbus',
|
|
542
|
+
'Fontana',
|
|
543
|
+
'Fayetteville',
|
|
544
|
+
'Moreno Valley',
|
|
545
|
+
'Rochester',
|
|
546
|
+
'Yonkers',
|
|
547
|
+
'Des Moines',
|
|
548
|
+
'Huntsville',
|
|
549
|
+
'Spring Valley',
|
|
550
|
+
'Modesto',
|
|
551
|
+
'Tacoma',
|
|
552
|
+
'Enterprise',
|
|
553
|
+
'San Bernardino',
|
|
554
|
+
'Hialeah',
|
|
555
|
+
'Richmond',
|
|
556
|
+
'Baton Rouge',
|
|
557
|
+
'Santa Clarita',
|
|
558
|
+
'Spokane',
|
|
559
|
+
'Fremont',
|
|
560
|
+
'Boise City',
|
|
561
|
+
'Norfolk',
|
|
562
|
+
'Arlington',
|
|
563
|
+
'Scottsdale',
|
|
564
|
+
'Garland',
|
|
565
|
+
'Louisville',
|
|
566
|
+
'Glendale',
|
|
567
|
+
'Chesapeake',
|
|
568
|
+
'Winston-Salem',
|
|
569
|
+
'Laredo',
|
|
570
|
+
'Irving',
|
|
571
|
+
'Lubbock',
|
|
572
|
+
'St. Petersburg',
|
|
573
|
+
'North Las Vegas',
|
|
574
|
+
'Fort Wayne',
|
|
575
|
+
'Reno',
|
|
576
|
+
'Gilbert',
|
|
577
|
+
'Madison',
|
|
578
|
+
'Toledo',
|
|
579
|
+
'Chula Vista',
|
|
580
|
+
'Chandler',
|
|
581
|
+
'Buffalo',
|
|
582
|
+
'Durham',
|
|
583
|
+
'Plano',
|
|
584
|
+
'Lincoln',
|
|
585
|
+
'Anchorage',
|
|
586
|
+
'Jersey City',
|
|
587
|
+
'Greensboro',
|
|
588
|
+
'St. Louis',
|
|
589
|
+
'Pittsburgh',
|
|
590
|
+
'Orlando',
|
|
591
|
+
'Irvine',
|
|
592
|
+
'Cincinnati',
|
|
593
|
+
'Santa Ana',
|
|
594
|
+
'St. Paul',
|
|
595
|
+
'Newark',
|
|
596
|
+
'Riverside',
|
|
597
|
+
'Henderson',
|
|
598
|
+
'Corpus Christi',
|
|
599
|
+
'Stockton',
|
|
600
|
+
'Lexington-Fayette',
|
|
601
|
+
'Anaheim',
|
|
602
|
+
'Urban Honolulu',
|
|
603
|
+
'Cleveland',
|
|
604
|
+
'New Orleans',
|
|
605
|
+
'Tampa',
|
|
606
|
+
'Aurora',
|
|
607
|
+
'Louisville',
|
|
608
|
+
'Arlington',
|
|
609
|
+
'Wichita',
|
|
610
|
+
'Bakersfield',
|
|
611
|
+
'Tulsa',
|
|
612
|
+
'Minneapolis',
|
|
613
|
+
'Oakland',
|
|
614
|
+
'Miami',
|
|
615
|
+
'Virginia Beach',
|
|
616
|
+
'Long Beach',
|
|
617
|
+
'Raleigh',
|
|
618
|
+
'Colorado Springs',
|
|
619
|
+
'Omaha',
|
|
620
|
+
'Atlanta',
|
|
621
|
+
'Mesa',
|
|
622
|
+
'Kansas City',
|
|
623
|
+
'Sacramento',
|
|
624
|
+
'Fresno',
|
|
625
|
+
'Tucson',
|
|
626
|
+
'Albuquerque',
|
|
627
|
+
'Milwaukee',
|
|
628
|
+
'Baltimore',
|
|
629
|
+
'Memphis',
|
|
630
|
+
'Detroit',
|
|
631
|
+
'Las Vegas',
|
|
632
|
+
'Portland',
|
|
633
|
+
'Boston',
|
|
634
|
+
'El Paso',
|
|
635
|
+
'Oklahoma City',
|
|
636
|
+
'Nashville',
|
|
637
|
+
'Washington',
|
|
638
|
+
'Denver',
|
|
639
|
+
'Seattle',
|
|
640
|
+
'San Francisco',
|
|
641
|
+
'Charlotte',
|
|
642
|
+
'Indianapolis',
|
|
643
|
+
'Columbus',
|
|
644
|
+
'Fort Worth',
|
|
645
|
+
'Jacksonville',
|
|
646
|
+
'Austin',
|
|
647
|
+
'San Jose',
|
|
648
|
+
'Dallas',
|
|
649
|
+
'San Diego',
|
|
650
|
+
'San Antonio',
|
|
651
|
+
'Philadelphia',
|
|
652
|
+
'Phoenix',
|
|
653
|
+
'Houston',
|
|
654
|
+
'Chicago',
|
|
655
|
+
'Los Angeles',
|
|
656
|
+
'New York',
|
|
657
|
+
];
|
|
658
|
+
const WORLD_REGIONS = [
|
|
659
|
+
'Antarctica',
|
|
660
|
+
'Caribbean',
|
|
661
|
+
'Central America',
|
|
662
|
+
'Central Asia',
|
|
663
|
+
'Eastern Africa',
|
|
664
|
+
'Eastern Asia',
|
|
665
|
+
'Eastern Europe',
|
|
666
|
+
'European Russia',
|
|
667
|
+
'Melanesia',
|
|
668
|
+
'Micronesia',
|
|
669
|
+
'Middle Africa',
|
|
670
|
+
'Northern Africa',
|
|
671
|
+
'Northern America',
|
|
672
|
+
'Northern Europe',
|
|
673
|
+
'Polynesia',
|
|
674
|
+
'South America',
|
|
675
|
+
'Southeastern Asia',
|
|
676
|
+
'Southern Africa',
|
|
677
|
+
'Southern Asia',
|
|
678
|
+
'Southern Europe',
|
|
679
|
+
'Western Africa',
|
|
680
|
+
'Western Asia',
|
|
681
|
+
'Western Europe',
|
|
682
|
+
];
|
|
683
|
+
const OTHER_LOCATIONS = [
|
|
684
|
+
'U.S',
|
|
685
|
+
'US',
|
|
686
|
+
'United States',
|
|
687
|
+
'USA',
|
|
688
|
+
'U.S. Virgin Islands',
|
|
689
|
+
'World',
|
|
690
|
+
'Global',
|
|
691
|
+
'North America',
|
|
692
|
+
'South America',
|
|
693
|
+
'Europe',
|
|
694
|
+
'Africa',
|
|
695
|
+
'Asia',
|
|
696
|
+
'Oceania',
|
|
697
|
+
'Antarctic',
|
|
698
|
+
'Arctic',
|
|
699
|
+
'Atlantic',
|
|
700
|
+
'Pacific',
|
|
701
|
+
'Lake Michigan',
|
|
702
|
+
'Lake Ontario',
|
|
703
|
+
'Lake Huron',
|
|
704
|
+
'Lake superior',
|
|
705
|
+
'Lake erie',
|
|
706
|
+
'Gulf of Mexico',
|
|
707
|
+
'New England',
|
|
708
|
+
'Hong Kong',
|
|
709
|
+
'Taiwan',
|
|
710
|
+
'Hudson Bay,',
|
|
711
|
+
];
|
|
712
|
+
const WorldCounrtiesPattern = WORLD_COUNTRIES.join('|');
|
|
713
|
+
const USStatesPattern = US_STATES.join('|');
|
|
714
|
+
const USCitiesPattern = US_MAJOR_CITIES.join('|');
|
|
715
|
+
const WorldRegionsPattern = WORLD_REGIONS.join('|');
|
|
716
|
+
const OthersPattern = OTHER_LOCATIONS.join('|');
|
|
717
|
+
const PatternsFromTextLabelingTool = TitleSummaryMatchingPatterns_json_1.default.locations.join('|');
|
|
718
|
+
// Combine patterns into one
|
|
719
|
+
let matchingPatterns = `${WorldCounrtiesPattern}|${USStatesPattern}|${USCitiesPattern}|${WorldRegionsPattern}|${OthersPattern}|${PatternsFromTextLabelingTool}`;
|
|
720
|
+
/**
|
|
721
|
+
* Matches location information from an item's title and snippet using predefined or custom matching patterns.
|
|
722
|
+
*
|
|
723
|
+
* @param {IItem} item - The item containing title and snippet to search for location information.
|
|
724
|
+
* @param {string[]} [customMatchingPattenrs] - Optional custom matching patterns to be included in the search.
|
|
725
|
+
* @returns {string[]} - An array of matched location strings after deduplication and removing overlaps.
|
|
726
|
+
*/
|
|
727
|
+
const matchLocationInfo = (item, customMatchingPattenrs) => {
|
|
728
|
+
if (customMatchingPattenrs) {
|
|
729
|
+
matchingPatterns = `${matchingPatterns}|${customMatchingPattenrs.join('|')}`;
|
|
730
|
+
}
|
|
731
|
+
const combinedRegex = new RegExp(`\\b(${matchingPatterns})\\b`, 'gi');
|
|
732
|
+
const title = item.title || '';
|
|
733
|
+
const snippet = item.snippet || '';
|
|
734
|
+
const matchedLocationsFromTitle = title.match(combinedRegex) || [];
|
|
735
|
+
const matchedLocationsFromSnippet = snippet.match(combinedRegex) || [];
|
|
736
|
+
const matchedLocations = [
|
|
737
|
+
...matchedLocationsFromTitle,
|
|
738
|
+
...matchedLocationsFromSnippet,
|
|
739
|
+
];
|
|
740
|
+
const candidates = (0, helpers_1.deduplicate)(matchedLocations);
|
|
741
|
+
return (0, helpers_1.removeOverlapped)(candidates);
|
|
742
|
+
};
|
|
743
|
+
exports.matchLocationInfo = matchLocationInfo;
|
|
744
|
+
//# sourceMappingURL=matchLocationInfo.js.map
|