1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "reviews": [
12 {
13 "location": "Harbor Cafe - North",
14 "text": "Long wait at the counter, but the coffee was great.",
15 "stars": 3
16 },
17 {
18 "location": "Harbor Cafe - North",
19 "text": "Waited 30 minutes for a simple order. Slow service.",
20 "stars": 2
21 },
22 {
23 "location": "Harbor Cafe - North",
24 "text": "Friendly staff and clean tables.",
25 "stars": 5
26 },
27 {
28 "location": "Harbor Cafe - North",
29 "text": "Wrong order again and the line was very slow.",
30 "stars": 2
31 },
32 {
33 "location": "Harbor Cafe - North",
34 "text": "Nice place, a bit pricey.",
35 "stars": 4
36 },
37 {
38 "location": "Harbor Cafe - South",
39 "text": "Quick service and lovely staff.",
40 "stars": 5
41 },
42 {
43 "location": "Harbor Cafe - South",
44 "text": "Tables were dirty and the restroom smelled.",
45 "stars": 2
46 },
47 {
48 "location": "Harbor Cafe - South",
49 "text": "Great coffee, fair price.",
50 "stars": 5
51 },
52 {
53 "location": "Harbor Cafe - South",
54 "text": "Very noisy inside, hard to talk.",
55 "stars": 3
56 },
57 {
58 "location": "Harbor Cafe - South",
59 "text": "Dirty floor but fast and polite.",
60 "stars": 3
61 }
62 ],
63 "customTopics": {
64 "loyalty_program": [
65 "loyalty card",
66 "points",
67 "stamp card"
68 ]
69 },
70 "minReviewsPerLocation": 5
71};
72
73
74const run = await client.actor("practical_ai_lab_jp/pal-maps-reviews-issue-matrix").call(input);
75
76
77console.log('Results from dataset');
78console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
79const { items } = await client.dataset(run.defaultDatasetId).listItems();
80items.forEach((item) => {
81 console.dir(item);
82});
83
84