1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "groupField": "location",
12 "inlineReviews": [
13 {
14 "location": "Downtown",
15 "rating": 5,
16 "text": "The food was delicious and the coffee was fresh. Friendly staff and a cozy atmosphere. Prices felt fair for the quality."
17 },
18 {
19 "location": "Downtown",
20 "rating": 5,
21 "text": "Great food and very friendly service. The wait was short and the room was spotless."
22 },
23 {
24 "location": "Riverside",
25 "rating": 1,
26 "text": "Terrible service. We waited forever, the staff were rude, and the food arrived cold and bland."
27 },
28 {
29 "location": "Riverside",
30 "rating": 3,
31 "text": "The food was good but the wait was slow and the music was too loud. Parking was difficult."
32 },
33 {
34 "location": "Riverside",
35 "rating": 5,
36 "text": "Excellent quality and a beautiful, clean space. The staff were attentive and the dessert was amazing."
37 },
38 {
39 "location": "Downtown",
40 "rating": 2,
41 "text": "Overpriced and disappointing. The portion was tiny, the bathroom was dirty, and the service was slow."
42 }
43 ],
44 "maxReviews": 2000,
45 "ratingField": "rating",
46 "textField": "text"
47};
48
49
50const run = await client.actor("delta_tools/review-theme-analyzer").call(input);
51
52
53console.log('Results from dataset');
54console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
55const { items } = await client.dataset(run.defaultDatasetId).listItems();
56items.forEach((item) => {
57 console.dir(item);
58});
59
60