1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "content": [
12 {
13 "id": "demo1",
14 "text": "The quick brown fox jumps over the lazy dog"
15 },
16 {
17 "id": "demo2",
18 "text": "A quick brown fox jumps over a lazy dog"
19 },
20 {
21 "id": "demo3",
22 "text": "The fast brown fox leaps over the sleepy dog"
23 },
24 {
25 "id": "demo4",
26 "text": "Artificial intelligence is transforming modern technology"
27 },
28 {
29 "id": "demo5",
30 "text": "AI is revolutionizing contemporary tech solutions"
31 }
32 ],
33 "similarityThreshold": 0.8,
34 "algorithms": {
35 "cosine": true,
36 "levenshtein": true,
37 "fuzzy": true,
38 "jaccard": true
39 },
40 "caseSensitive": false,
41 "ignoreWhitespace": true,
42 "minLength": 10,
43 "groupByDuplicate": true
44};
45
46
47const run = await client.actor("fiery_dream/content-similarity-finder").call(input);
48
49
50console.log('Results from dataset');
51console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
52const { items } = await client.dataset(run.defaultDatasetId).listItems();
53items.forEach((item) => {
54 console.dir(item);
55});
56
57