codecritique 1.2.3 → 2.0.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.
@@ -105,7 +105,9 @@ class OpenZeroShotClassifier {
105
105
  */
106
106
  async initialize() {
107
107
  // If already initialized, return immediately
108
- if (this.isInitialized) return;
108
+ if (this.isInitialized) {
109
+ return;
110
+ }
109
111
 
110
112
  // If currently initializing, wait for the existing initialization
111
113
  if (this.initializationPromise) {
@@ -117,7 +119,8 @@ class OpenZeroShotClassifier {
117
119
 
118
120
  try {
119
121
  await this.initializationPromise;
120
- } finally {
122
+ }
123
+ finally {
121
124
  // Clean up the promise after initialization (success or failure)
122
125
  this.initializationPromise = null;
123
126
  }
@@ -133,7 +136,8 @@ class OpenZeroShotClassifier {
133
136
 
134
137
  this.isInitialized = true;
135
138
  verboseLog({}, '✓ Open-ended zero-shot classifier initialized successfully');
136
- } catch (error) {
139
+ }
140
+ catch (error) {
137
141
  console.error('Error initializing classifier:', error);
138
142
  this.isInitialized = false;
139
143
  throw error;
@@ -174,7 +178,8 @@ class OpenZeroShotClassifier {
174
178
  for (const value of Object.values(obj)) {
175
179
  if (Array.isArray(value)) {
176
180
  value.forEach((tech) => techs.add(tech.toLowerCase()));
177
- } else if (typeof value === 'object') {
181
+ }
182
+ else if (typeof value === 'object') {
178
183
  addTechsFromObject(value);
179
184
  }
180
185
  }
@@ -234,7 +239,9 @@ class OpenZeroShotClassifier {
234
239
  const word = words[i].replace(/[.,;:!?'"()[\]{}]/g, '');
235
240
 
236
241
  // Skip if it's a common word
237
- if (this.commonWords.has(word.toLowerCase())) continue;
242
+ if (this.commonWords.has(word.toLowerCase())) {
243
+ continue;
244
+ }
238
245
 
239
246
  // Check if word is capitalized and not at sentence start
240
247
  if (i > 0 && /^[A-Z][a-zA-Z]+/.test(word) && word.length > 2 && word.length < 20) {
@@ -302,7 +309,8 @@ class OpenZeroShotClassifier {
302
309
 
303
310
  this.cache.set(cacheKey, classifications);
304
311
  return classifications;
305
- } catch (error) {
312
+ }
313
+ catch (error) {
306
314
  console.error('Error in technology classification:', error);
307
315
  return [];
308
316
  }
@@ -368,7 +376,8 @@ class OpenZeroShotClassifier {
368
376
 
369
377
  this.cache.set(cacheKey, classifications);
370
378
  return classifications;
371
- } catch (error) {
379
+ }
380
+ catch (error) {
372
381
  console.error('Error in domain classification:', error);
373
382
  return [];
374
383
  }