n8n-nodes-fasttext-language-detector 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ import { ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class FastTextModel implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FastTextModel = void 0;
4
+ class FastTextModel {
5
+ constructor() {
6
+ this.name = 'fastTextModelApi';
7
+ this.displayName = 'FastText Model API';
8
+ this.documentationUrl = 'https://fasttext.cc/docs/en/language-identification.html';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Model Path',
12
+ name: 'modelPath',
13
+ type: 'string',
14
+ default: '',
15
+ description: 'Absolute path to fastText language identification model (.bin file). Download from https://fasttext.cc/docs/en/language-identification.html.',
16
+ placeholder: '/path/to/lid.176.bin',
17
+ },
18
+ ];
19
+ }
20
+ }
21
+ exports.FastTextModel = FastTextModel;
@@ -0,0 +1,6 @@
1
+ import { IExecuteFunctions, INodeType, INodeTypeDescription, INodeExecutionData } from 'n8n-workflow';
2
+ export declare class FastTextLanguageDetector implements INodeType {
3
+ description: INodeTypeDescription;
4
+ private static modelCache;
5
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
6
+ }
@@ -0,0 +1,299 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.FastTextLanguageDetector = void 0;
37
+ const n8n_workflow_1 = require("n8n-workflow");
38
+ const fastText = __importStar(require("fasttext.js"));
39
+ const fs = __importStar(require("fs"));
40
+ class FastTextLanguageDetector {
41
+ constructor() {
42
+ this.description = {
43
+ displayName: 'FastText Language Detector',
44
+ name: 'fastTextLanguageDetector',
45
+ icon: 'file:fasttext.svg',
46
+ group: ['transform'],
47
+ version: 1,
48
+ subtitle: '={{$parameter["operation"]}}',
49
+ description: 'Detect language of text using fastText',
50
+ defaults: {
51
+ name: 'FastText Language Detector',
52
+ },
53
+ inputs: ['main'],
54
+ outputs: ['main'],
55
+ credentials: [
56
+ {
57
+ name: 'fastTextModelApi',
58
+ required: false,
59
+ },
60
+ ],
61
+ properties: [
62
+ {
63
+ displayName: 'Text Source',
64
+ name: 'textSource',
65
+ type: 'options',
66
+ options: [
67
+ {
68
+ name: 'From Input Field',
69
+ value: 'field',
70
+ },
71
+ {
72
+ name: 'From Expression',
73
+ value: 'expression',
74
+ },
75
+ ],
76
+ default: 'field',
77
+ description: 'Where to get the text from',
78
+ },
79
+ {
80
+ displayName: 'Input Field Name',
81
+ name: 'inputField',
82
+ type: 'string',
83
+ default: 'text',
84
+ displayOptions: {
85
+ show: {
86
+ textSource: ['field'],
87
+ },
88
+ },
89
+ description: 'Name of the input field containing text to analyze',
90
+ },
91
+ {
92
+ displayName: 'Text Expression',
93
+ name: 'textExpression',
94
+ type: 'string',
95
+ default: '={{$json.text}}',
96
+ displayOptions: {
97
+ show: {
98
+ textSource: ['expression'],
99
+ },
100
+ },
101
+ description: 'Expression to get the text (e.g., {{$JSON.text}})',
102
+ },
103
+ {
104
+ displayName: 'Model Path',
105
+ name: 'modelPath',
106
+ type: 'string',
107
+ default: '',
108
+ description: 'Path to fastText language identification model (.bin file). Leave empty to use default or credentials.',
109
+ placeholder: '/path/to/lid.176.bin',
110
+ },
111
+ {
112
+ displayName: 'Confidence Threshold',
113
+ name: 'confidenceThreshold',
114
+ type: 'number',
115
+ typeOptions: {
116
+ minValue: 0,
117
+ maxValue: 1,
118
+ },
119
+ default: 0.5,
120
+ description: 'Minimum confidence threshold (0-1) for language detection',
121
+ },
122
+ {
123
+ displayName: 'Return Top K',
124
+ name: 'topK',
125
+ type: 'number',
126
+ typeOptions: {
127
+ minValue: 1,
128
+ maxValue: 10,
129
+ },
130
+ default: 1,
131
+ description: 'Number of top language predictions to return',
132
+ },
133
+ {
134
+ displayName: 'Output Field Name',
135
+ name: 'outputField',
136
+ type: 'string',
137
+ default: 'language',
138
+ description: 'Name of the output field for detected language',
139
+ },
140
+ {
141
+ displayName: 'Include Confidence',
142
+ name: 'includeConfidence',
143
+ type: 'boolean',
144
+ default: true,
145
+ description: 'Whether to include confidence scores in the output',
146
+ },
147
+ ],
148
+ };
149
+ }
150
+ async execute() {
151
+ const items = this.getInputData();
152
+ const returnData = [];
153
+ const textSource = this.getNodeParameter('textSource', 0);
154
+ const confidenceThreshold = this.getNodeParameter('confidenceThreshold', 0);
155
+ const topK = this.getNodeParameter('topK', 0);
156
+ const outputField = this.getNodeParameter('outputField', 0);
157
+ const includeConfidence = this.getNodeParameter('includeConfidence', 0);
158
+ // Загружаем модель один раз для всех элементов
159
+ let model = null;
160
+ let modelPath = '';
161
+ try {
162
+ // Получаем путь к модели
163
+ const modelPathParam = this.getNodeParameter('modelPath', 0);
164
+ if (modelPathParam && modelPathParam.trim() !== '') {
165
+ modelPath = modelPathParam.trim();
166
+ }
167
+ else {
168
+ try {
169
+ const credentials = await this.getCredentials('fastTextModelApi');
170
+ if (credentials && credentials.modelPath) {
171
+ modelPath = credentials.modelPath;
172
+ }
173
+ }
174
+ catch (error) {
175
+ // Credentials не обязательны
176
+ }
177
+ if (!modelPath) {
178
+ const defaultModelPath = process.env.FASTTEXT_MODEL_PATH || '';
179
+ if (defaultModelPath && fs.existsSync(defaultModelPath)) {
180
+ modelPath = defaultModelPath;
181
+ }
182
+ }
183
+ }
184
+ if (!modelPath) {
185
+ throw new n8n_workflow_1.ApplicationError('Model path not specified. Please provide model path in node settings or credentials.', { level: 'error' });
186
+ }
187
+ // Проверяем кэш
188
+ const cachedModel = FastTextLanguageDetector.modelCache.get(modelPath);
189
+ if (cachedModel) {
190
+ model = cachedModel;
191
+ }
192
+ else {
193
+ // Проверяем существование файла
194
+ if (!fs.existsSync(modelPath)) {
195
+ throw new n8n_workflow_1.ApplicationError(`Model file not found: ${modelPath}`, { level: 'error' });
196
+ }
197
+ // Загружаем модель
198
+ model = new fastText.Classifier(modelPath);
199
+ FastTextLanguageDetector.modelCache.set(modelPath, model);
200
+ }
201
+ }
202
+ catch (error) {
203
+ const errorMessage = error instanceof Error ? error.message : String(error);
204
+ throw new n8n_workflow_1.ApplicationError(`Failed to initialize model: ${errorMessage}`, { level: 'error' });
205
+ }
206
+ // Обрабатываем каждый элемент
207
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
208
+ const item = items[itemIndex];
209
+ const json = item.json;
210
+ try {
211
+ // Получаем текст для анализа
212
+ let text = '';
213
+ if (textSource === 'field') {
214
+ const inputField = this.getNodeParameter('inputField', itemIndex);
215
+ const fieldValue = json[inputField];
216
+ if (fieldValue === undefined || fieldValue === null) {
217
+ throw new n8n_workflow_1.ApplicationError(`Field "${inputField}" not found in input data`, { level: 'warning' });
218
+ }
219
+ text = String(fieldValue);
220
+ }
221
+ else {
222
+ // Для выражений getNodeParameter автоматически обрабатывает выражения типа {{$json.text}}
223
+ const textExpressionValue = this.getNodeParameter('textExpression', itemIndex);
224
+ // Преобразуем значение в строку
225
+ if (textExpressionValue === null || textExpressionValue === undefined) {
226
+ text = '';
227
+ }
228
+ else if (typeof textExpressionValue === 'object') {
229
+ text = JSON.stringify(textExpressionValue);
230
+ }
231
+ else {
232
+ text = String(textExpressionValue);
233
+ }
234
+ }
235
+ if (!text || text.trim() === '') {
236
+ throw new n8n_workflow_1.ApplicationError('Text is empty. Please provide text to analyze.', { level: 'warning' });
237
+ }
238
+ // Предобработка текста
239
+ const processedText = text.trim().substring(0, 1000); // Ограничиваем длину
240
+ // Проверяем, что модель загружена
241
+ if (!model) {
242
+ throw new n8n_workflow_1.ApplicationError('Model not initialized', { level: 'error' });
243
+ }
244
+ // Определяем язык
245
+ const predictions = await model.predict(processedText, topK);
246
+ // Фильтруем по порогу уверенности
247
+ const filteredPredictions = predictions.filter((pred) => pred.probability >= confidenceThreshold);
248
+ if (filteredPredictions.length === 0) {
249
+ // Если нет предсказаний выше порога, возвращаем лучшее
250
+ const result = {
251
+ ...json,
252
+ [outputField]: predictions[0]?.label?.replace('__label__', '') || 'unknown',
253
+ };
254
+ if (includeConfidence) {
255
+ result[`${outputField}Confidence`] = predictions[0]?.probability || 0;
256
+ result[`${outputField}All`] = predictions.map((p) => ({
257
+ language: p.label?.replace('__label__', '') || 'unknown',
258
+ confidence: p.probability || 0,
259
+ }));
260
+ }
261
+ returnData.push({ json: result });
262
+ continue;
263
+ }
264
+ // Формируем результат
265
+ const topPrediction = filteredPredictions[0];
266
+ const result = {
267
+ ...json,
268
+ [outputField]: topPrediction.label?.replace('__label__', '') || 'unknown',
269
+ };
270
+ if (includeConfidence) {
271
+ result[`${outputField}Confidence`] = topPrediction.probability || 0;
272
+ if (topK > 1) {
273
+ result[`${outputField}All`] = filteredPredictions.map((p) => ({
274
+ language: p.label?.replace('__label__', '') || 'unknown',
275
+ confidence: p.probability || 0,
276
+ }));
277
+ }
278
+ }
279
+ returnData.push({ json: result });
280
+ }
281
+ catch (error) {
282
+ if (error instanceof n8n_workflow_1.ApplicationError) {
283
+ throw error;
284
+ }
285
+ const errorMessage = error instanceof Error ? error.message : String(error);
286
+ returnData.push({
287
+ json: {
288
+ ...json,
289
+ error: errorMessage,
290
+ [outputField]: 'error',
291
+ },
292
+ });
293
+ }
294
+ }
295
+ return [returnData];
296
+ }
297
+ }
298
+ exports.FastTextLanguageDetector = FastTextLanguageDetector;
299
+ FastTextLanguageDetector.modelCache = new Map();
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
3
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg"
5
+ width="1280.000000pt" height="763.000000pt" viewBox="0 0 1280.000000 763.000000"
6
+ preserveAspectRatio="xMidYMid meet">
7
+ <metadata>
8
+ Created by potrace 1.15, written by Peter Selinger 2001-2017
9
+ </metadata>
10
+ <g transform="translate(0.000000,763.000000) scale(0.100000,-0.100000)"
11
+ fill="#000000" stroke="none">
12
+ <path d="M2755 6493 c-395 -51 -784 -240 -1160 -563 -128 -110 -368 -359 -384
13
+ -398 -12 -29 -12 -35 2 -50 15 -15 19 -14 42 8 14 13 25 18 25 12 0 -6 -4 -14
14
+ -10 -17 -15 -9 -12 -41 4 -54 28 -24 84 22 202 164 27 33 82 97 121 142 40 45
15
+ 73 85 73 88 0 23 -204 -130 -294 -220 l-69 -70 54 65 c77 94 280 294 379 373
16
+ 279 224 571 367 890 434 114 25 144 27 345 27 206 0 226 -2 319 -27 158 -42
17
+ 338 -142 411 -228 11 -12 -2 -5 -30 18 -90 73 -245 120 -489 148 -197 22 -386
18
+ 21 -520 -5 -110 -22 -291 -80 -310 -101 -8 -8 -6 -10 9 -6 199 55 438 89 635
19
+ 90 196 2 255 -10 405 -83 100 -49 247 -156 278 -204 l16 -25 -127 -42 c-545
20
+ -180 -955 -439 -1378 -870 -286 -293 -460 -545 -570 -829 -74 -193 -112 -438
21
+ -94 -602 5 -46 7 -91 4 -102 -3 -10 -2 -16 2 -13 5 3 9 -23 10 -56 3 -234 198
22
+ -451 465 -518 120 -30 343 -37 469 -15 326 57 630 230 930 529 466 465 718
23
+ 968 760 1518 12 157 -3 394 -28 459 -3 8 -18 69 -33 134 -24 107 -26 122 -13
24
+ 142 27 41 64 48 217 41 242 -11 585 -62 947 -143 200 -45 689 -169 730 -186
25
+ l31 -13 -111 -69 c-520 -323 -1035 -848 -1529 -1558 l-102 -148 -90 0 c-103 0
26
+ -218 -21 -304 -56 -145 -59 -286 -170 -325 -256 -25 -54 -26 -113 -4 -122 9
27
+ -4 14 -9 11 -13 -4 -3 -2 -14 4 -24 18 -34 49 -22 108 42 145 158 167 177 222
28
+ 193 29 9 76 16 105 16 45 0 56 -4 73 -26 11 -15 18 -31 14 -38 -68 -116 -300
29
+ -450 -441 -636 -236 -310 -517 -616 -720 -784 -409 -336 -852 -499 -1362 -499
30
+ -200 0 -317 16 -467 64 -222 71 -423 207 -522 352 -35 51 -66 118 -54 115 5
31
+ -1 21 2 37 7 19 5 46 2 81 -9 146 -46 280 11 353 149 23 43 27 62 27 141 0 52
32
+ -5 97 -11 105 -6 8 -14 36 -16 62 -14 128 -97 197 -238 197 -66 0 -86 -4 -138
33
+ -31 -109 -54 -198 -179 -223 -314 -6 -33 -12 -127 -13 -210 -1 -140 1 -155 26
34
+ -223 38 -105 83 -176 163 -257 196 -201 481 -307 948 -355 175 -18 509 -8 666
35
+ 20 406 72 799 237 1201 505 218 145 339 242 490 395 188 189 341 410 597 863
36
+ 132 233 164 276 225 308 71 37 163 17 192 -42 16 -32 15 -33 -20 -98 -107
37
+ -195 -227 -331 -338 -381 -90 -41 -87 -70 6 -70 32 0 38 -3 30 -13 -72 -87 22
38
+ -140 146 -82 163 76 303 227 415 451 81 161 123 193 296 224 292 53 448 176
39
+ 452 356 5 180 4 189 -19 226 -29 47 -58 65 -134 84 -77 20 -175 14 -269 -15
40
+ -140 -44 -276 -174 -368 -350 l-43 -84 -65 6 c-111 11 -183 28 -183 44 0 9 41
41
+ 86 91 172 200 342 378 609 558 835 212 267 637 656 770 707 103 39 170 45 279
42
+ 26 761 -135 1156 -176 1562 -164 296 10 470 36 668 102 214 72 377 181 420
43
+ 282 23 54 29 212 11 270 -24 75 -153 158 -321 207 -169 49 -287 61 -598 61
44
+ -296 0 -415 -10 -660 -56 -229 -44 -593 -146 -788 -223 l-64 -25 -211 50
45
+ c-654 154 -1041 239 -1206 264 -358 54 -864 40 -1239 -34 l-143 -28 -34 47
46
+ c-47 64 -167 176 -240 225 -118 77 -300 142 -468 164 -73 10 -365 13 -432 4z
47
+ m5870 -477 c238 -41 416 -119 456 -200 8 -15 4 -13 -13 6 -48 56 -224 116
48
+ -428 144 -58 9 -213 18 -345 21 -354 8 -576 -22 -1016 -137 -266 -70 -376 -93
49
+ -397 -85 -22 9 21 28 190 85 284 95 621 160 958 184 124 9 507 -3 595 -18z
50
+ m-29 -131 c220 -36 407 -117 429 -186 4 -11 11 -16 18 -12 7 3 3 -3 -7 -16
51
+ -49 -55 -244 -121 -417 -142 -314 -36 -919 34 -1443 169 -63 16 -68 19 -53 34
52
+ 53 52 472 134 807 158 312 22 512 20 666 -5z m-5019 -21 c-3 -3 -12 -4 -19 -1
53
+ -8 3 -5 6 6 6 11 1 17 -2 13 -5z m-77 -21 c-167 -60 -229 -88 -359 -156 -498
54
+ -262 -952 -663 -1256 -1107 -32 -47 -64 -90 -70 -95 -15 -13 -85 -152 -110
55
+ -218 -10 -26 -20 -45 -22 -43 -6 6 70 184 109 254 112 202 243 368 467 593
56
+ 366 366 707 591 1121 740 58 21 112 38 120 38 13 -1 13 -1 0 -6z m330 -112
57
+ c50 -26 75 -69 101 -174 41 -165 25 -517 -31 -712 -84 -291 -261 -616 -501
58
+ -915 -390 -487 -779 -739 -1186 -765 -185 -13 -317 35 -438 159 -120 122 -175
59
+ 262 -175 445 0 125 10 212 21 186 6 -13 7 -1 4 30 -3 37 -2 43 4 25 l9 -25 1
60
+ 24 c2 42 59 197 110 298 124 246 330 499 609 745 404 355 804 572 1237 671
61
+ 134 31 189 33 235 8z m5170 -186 c0 -6 -97 -55 -107 -55 -4 1 17 14 47 30 61
62
+ 32 60 32 60 25z m-7336 -1399 c-3 -15 -8 -25 -11 -23 -2 3 -1 17 3 31 3 15 8
63
+ 25 11 23 2 -3 1 -17 -3 -31z m-17 -58 c-3 -8 -6 -5 -6 6 -1 11 2 17 5 13 3 -3
64
+ 4 -12 1 -19z m-10 -40 c-3 -8 -6 -5 -6 6 -1 11 2 17 5 13 3 -3 4 -12 1 -19z
65
+ m4109 -104 c39 -19 64 -59 64 -101 0 -17 -3 -23 -8 -16 -4 7 -28 15 -52 19
66
+ l-45 7 26 -30 c14 -17 31 -44 38 -62 8 -17 18 -28 23 -25 5 4 3 -7 -6 -24 -39
67
+ -75 -170 -143 -322 -168 -135 -22 -143 -19 -108 46 32 60 155 194 214 235 39
68
+ 27 41 30 23 43 -12 9 -40 12 -91 10 -72 -3 -72 -3 -50 15 13 10 46 29 73 43
69
+ 61 29 168 33 221 8z m-1521 -353 c-6 -6 -66 -26 -134 -45 -119 -34 -374 -142
70
+ -415 -175 -37 -30 19 42 68 87 97 89 237 136 426 140 40 1 60 -2 55 -7z m1505
71
+ -47 c-25 -25 -66 -57 -92 -70 -103 -52 -249 -71 -281 -36 -15 17 -12 18 74 30
72
+ 109 15 228 53 289 92 25 16 47 29 50 29 2 1 -16 -20 -40 -45z m-832 -49 c65
73
+ -7 93 -24 45 -27 -54 -3 -83 2 -115 23 -19 12 -24 18 -13 15 11 -2 48 -8 83
74
+ -11z m-3107 -292 c13 -16 12 -17 -3 -4 -17 13 -22 21 -14 21 2 0 10 -8 17 -17z
75
+ m239 -99 c57 -12 114 -15 235 -12 l160 5 -85 -20 c-57 -14 -123 -21 -200 -21
76
+ -113 -1 -116 0 -190 36 -41 20 -91 51 -110 67 l-35 31 75 -35 c42 -19 109 -42
77
+ 150 -51z m-1134 -1570 c103 -47 246 -90 381 -116 105 -20 150 -23 398 -23 247
78
+ 0 270 -1 200 -11 -44 -6 -120 -17 -170 -24 -130 -18 -407 -8 -505 19 -143 39
79
+ -221 76 -377 179 -85 55 -117 84 -40 35 23 -14 74 -41 113 -59z"/>
80
+ <path d="M11863 6295 c-404 -109 -1151 -890 -1694 -1770 l-86 -140 -64 -6
81
+ c-35 -4 -126 -7 -201 -8 -125 -1 -138 -3 -148 -20 -5 -11 -10 -22 -10 -25 0
82
+ -3 86 -6 190 -6 181 0 190 -1 179 -18 -6 -10 -42 -32 -79 -49 l-68 -32 24 -46
83
+ 23 -47 -26 -52 c-30 -60 -699 -1279 -875 -1595 -450 -807 -584 -1007 -859
84
+ -1278 -349 -345 -685 -520 -1037 -540 -94 -5 -132 -2 -231 17 -66 12 -127 20
85
+ -136 16 -29 -11 -15 -57 25 -81 32 -18 52 -20 220 -20 143 0 204 4 270 19 140
86
+ 30 290 84 442 157 79 37 135 63 124 56 -10 -6 -57 -40 -104 -75 -175 -129
87
+ -286 -181 -432 -203 -101 -14 -280 -6 -364 16 -65 18 -108 13 -137 -16 -25
88
+ -25 -9 -62 36 -84 65 -30 262 -13 445 39 170 48 387 116 450 142 325 132 688
89
+ 405 1061 801 459 487 798 1019 1444 2273 92 179 179 340 192 358 41 55 98 89
90
+ 187 112 109 29 115 33 92 59 -10 10 -16 30 -14 43 l3 23 186 3 c184 2 186 3
91
+ 197 26 l10 23 -96 6 c-54 4 -143 7 -200 7 l-102 0 30 34 c17 19 59 49 93 67
92
+ 357 189 842 612 1089 949 118 162 188 318 188 417 -1 47 -1 48 -16 23 -10 -17
93
+ -13 -18 -8 -5 50 145 57 175 58 255 1 99 -17 141 -74 171 -42 23 -122 24 -197
94
+ 4z m185 -52 c66 -41 46 -179 -49 -345 -166 -285 -665 -812 -1096 -1155 -141
95
+ -113 -167 -130 -156 -107 6 11 27 54 47 96 44 91 267 466 357 600 136 203 300
96
+ 408 493 617 89 97 116 135 102 148 -10 10 -112 -20 -146 -44 -59 -41 58 62
97
+ 126 112 128 94 250 123 322 78z m-998 -1487 c0 -2 -8 -10 -17 -17 -16 -13 -17
98
+ -12 -4 4 13 16 21 21 21 13z m-106 -90 c-110 -101 -134 -119 -159 -122 -13 -1
99
+ -30 -6 -37 -10 -32 -18 9 14 129 101 70 52 130 94 133 94 2 1 -27 -28 -66 -63z"/>
100
+ </g>
101
+ </svg>
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ nodes: [
3
+ require('./dist/nodes/FastTextLanguageDetector/FastTextLanguageDetector.node.js'),
4
+ ],
5
+ credentials: [
6
+ require('./dist/credentials/FastTextModel.credentials.js'),
7
+ ],
8
+ };
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "n8n-nodes-fasttext-language-detector",
3
+ "version": "0.1.0",
4
+ "description": "n8n node for language detection using fastText",
5
+ "author": {
6
+ "name": "Your Name",
7
+ "email": "your.email@example.com"
8
+ },
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "n8n-community-node-package",
12
+ "fasttext",
13
+ "language-detection",
14
+ "nlp"
15
+ ],
16
+ "main": "index.js",
17
+ "scripts": {
18
+ "build": "rm -rf dist && tsc && gulp build:icons",
19
+ "dev": "npm run build && npx n8n",
20
+ "dev:watch": "tsc --watch",
21
+ "format": "prettier nodes credentials --write",
22
+ "lint": "eslint \"nodes/**/*.ts\" \"credentials/**/*.ts\" \"package.json\"",
23
+ "lintfix": "eslint \"nodes/**/*.ts\" \"credentials/**/*.ts\" \"package.json\" --fix",
24
+ "prepublishOnly": "npm run build && npm run lint -s"
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "n8n": {
30
+ "n8nNodesApiVersion": 1,
31
+ "credentials": [
32
+ "dist/credentials/FastTextModel.credentials.js"
33
+ ],
34
+ "nodes": [
35
+ "dist/nodes/FastTextLanguageDetector/FastTextLanguageDetector.node.js"
36
+ ]
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20.10.0",
40
+ "@typescript-eslint/parser": "^6.13.0",
41
+ "@typescript-eslint/eslint-plugin": "^6.13.0",
42
+ "eslint": "^8.57.1",
43
+ "eslint-plugin-n8n-nodes-base": "^1.11.0",
44
+ "gulp": "^4.0.2",
45
+ "n8n": "*",
46
+ "n8n-workflow": "*",
47
+ "prettier": "^3.1.0",
48
+ "typescript": "^5.3.0"
49
+ },
50
+ "dependencies": {
51
+ "fasttext.js": "^1.1.4"
52
+ },
53
+ "peerDependencies": {
54
+ "n8n-workflow": "*"
55
+ }
56
+ }