synonym-optimizer
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -39,4 +39,3 @@ "use strict"; | ||
default: | ||
languageSyn = new LanguageSynOther_1.LanguageSynOther(); | ||
languageSyn.iso2 = iso2; | ||
languageSyn = new LanguageSynOther_1.LanguageSynOther(iso2); | ||
break; | ||
@@ -43,0 +42,0 @@ } |
@@ -11,5 +11,6 @@ /** | ||
iso2: string; | ||
stemmer: Stemmer; | ||
stemmer: Stemmer | null; | ||
constructor(iso2: string, stemmer: Stemmer | null); | ||
abstract getStandardStopWords(): string[]; | ||
extractWords(input: string): string[]; | ||
} |
@@ -7,10 +7,18 @@ "use strict"; | ||
*/ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LanguageSyn = void 0; | ||
const tokenizer = require("wink-tokenizer"); | ||
// import * as tokenizer from 'wink-tokenizer'; | ||
const wink_tokenizer_1 = __importDefault(require("wink-tokenizer")); | ||
const rosaenlg_filter_1 = require("rosaenlg-filter"); | ||
class LanguageSyn { | ||
constructor(iso2, stemmer) { | ||
this.iso2 = iso2; | ||
this.stemmer = stemmer; | ||
} | ||
extractWords(input) { | ||
// console.log(`tokenizing: ${input}`); | ||
const myTokenizer = new tokenizer(); | ||
const myTokenizer = new wink_tokenizer_1.default(); | ||
myTokenizer.defineConfig({ | ||
@@ -17,0 +25,0 @@ currency: false, |
@@ -8,5 +8,4 @@ /** | ||
export declare class LanguageSynEnglish extends LanguageSyn { | ||
iso2: string; | ||
constructor(); | ||
getStandardStopWords(): string[]; | ||
} |
@@ -7,2 +7,25 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,8 +35,6 @@ exports.LanguageSynEnglish = void 0; | ||
const stopwordsEn = require("stopwords-en"); | ||
const englishStemmer = require("snowball-stemmer.jsx/dest/english-stemmer.common.js"); | ||
const englishStemmer = __importStar(require("snowball-stemmer.jsx/dest/english-stemmer.common.js")); | ||
class LanguageSynEnglish extends LanguageSyn_1.LanguageSyn { | ||
constructor() { | ||
super(); | ||
this.iso2 = 'en'; | ||
this.stemmer = new englishStemmer.EnglishStemmer(); | ||
super('en', new englishStemmer.EnglishStemmer()); | ||
} | ||
@@ -20,0 +41,0 @@ getStandardStopWords() { |
@@ -8,3 +8,2 @@ /** | ||
export declare class LanguageSynFrench extends LanguageSyn { | ||
iso2: string; | ||
constructor(); | ||
@@ -11,0 +10,0 @@ getStandardStopWords(): string[]; |
@@ -7,2 +7,25 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,8 +35,6 @@ exports.LanguageSynFrench = void 0; | ||
const stopwordsFr = require("stopwords-fr"); | ||
const frenchStemmer = require("snowball-stemmer.jsx/dest/french-stemmer.common.js"); | ||
const frenchStemmer = __importStar(require("snowball-stemmer.jsx/dest/french-stemmer.common.js")); | ||
class LanguageSynFrench extends LanguageSyn_1.LanguageSyn { | ||
constructor() { | ||
super(); | ||
this.iso2 = 'fr'; | ||
this.stemmer = new frenchStemmer.FrenchStemmer(); | ||
super('fr', new frenchStemmer.FrenchStemmer()); | ||
} | ||
@@ -20,0 +41,0 @@ getStandardStopWords() { |
@@ -8,5 +8,4 @@ /** | ||
export declare class LanguageSynGerman extends LanguageSyn { | ||
iso2: string; | ||
constructor(); | ||
getStandardStopWords(): string[]; | ||
} |
@@ -7,2 +7,25 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,8 +35,6 @@ exports.LanguageSynGerman = void 0; | ||
const stopwordsDe = require("stopwords-de"); | ||
const germanStemmer = require("snowball-stemmer.jsx/dest/german-stemmer.common.js"); | ||
const germanStemmer = __importStar(require("snowball-stemmer.jsx/dest/german-stemmer.common.js")); | ||
class LanguageSynGerman extends LanguageSyn_1.LanguageSyn { | ||
constructor() { | ||
super(); | ||
this.iso2 = 'de'; | ||
this.stemmer = new germanStemmer.GermanStemmer(); | ||
super('de', new germanStemmer.GermanStemmer()); | ||
} | ||
@@ -20,0 +41,0 @@ getStandardStopWords() { |
@@ -8,5 +8,4 @@ /** | ||
export declare class LanguageSynItalian extends LanguageSyn { | ||
iso2: string; | ||
constructor(); | ||
getStandardStopWords(): string[]; | ||
} |
@@ -7,2 +7,25 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,8 +35,6 @@ exports.LanguageSynItalian = void 0; | ||
const stopwordsIt = require("stopwords-it"); | ||
const italianStemmer = require("snowball-stemmer.jsx/dest/italian-stemmer.common.js"); | ||
const italianStemmer = __importStar(require("snowball-stemmer.jsx/dest/italian-stemmer.common.js")); | ||
class LanguageSynItalian extends LanguageSyn_1.LanguageSyn { | ||
constructor() { | ||
super(); | ||
this.iso2 = 'it'; | ||
this.stemmer = new italianStemmer.ItalianStemmer(); | ||
super('it', new italianStemmer.ItalianStemmer()); | ||
} | ||
@@ -20,0 +41,0 @@ getStandardStopWords() { |
@@ -8,3 +8,4 @@ /** | ||
export declare class LanguageSynOther extends LanguageSyn { | ||
constructor(iso2: string); | ||
getStandardStopWords(): string[]; | ||
} |
@@ -11,2 +11,5 @@ "use strict"; | ||
class LanguageSynOther extends LanguageSyn_1.LanguageSyn { | ||
constructor(iso2) { | ||
super(iso2, null); | ||
} | ||
getStandardStopWords() { | ||
@@ -13,0 +16,0 @@ return []; |
@@ -8,5 +8,4 @@ /** | ||
export declare class LanguageSynSpanish extends LanguageSyn { | ||
iso2: string; | ||
constructor(); | ||
getStandardStopWords(): string[]; | ||
} |
@@ -7,2 +7,25 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,8 +35,6 @@ exports.LanguageSynSpanish = void 0; | ||
const stopwordsEs = require("stopwords-es"); | ||
const spanishStemmer = require("snowball-stemmer.jsx/dest/spanish-stemmer.common.js"); | ||
const spanishStemmer = __importStar(require("snowball-stemmer.jsx/dest/spanish-stemmer.common.js")); | ||
class LanguageSynSpanish extends LanguageSyn_1.LanguageSyn { | ||
constructor() { | ||
super(); | ||
this.iso2 = 'es'; | ||
this.stemmer = new spanishStemmer.SpanishStemmer(); | ||
super('es', new spanishStemmer.SpanishStemmer()); | ||
} | ||
@@ -20,0 +41,0 @@ getStandardStopWords() { |
@@ -7,4 +7,27 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = require("fs"); | ||
const fs = __importStar(require("fs")); | ||
const helper_1 = require("./helper"); | ||
@@ -17,3 +40,3 @@ function generateStopWordsDoc(dest) { | ||
stream.write(`== ${language}\n\n`); | ||
const languageSyn = helper_1.buildLanguageSyn(helper_1.getIso2fromLocale(language)); | ||
const languageSyn = (0, helper_1.buildLanguageSyn)((0, helper_1.getIso2fromLocale)(language)); | ||
const stopWords = languageSyn.getStandardStopWords(); | ||
@@ -20,0 +43,0 @@ stream.write(stopWords.join(' - ')); |
@@ -13,7 +13,7 @@ /** | ||
export interface DebugHolder { | ||
filteredAlt?: string[]; | ||
identicals?: string[][]; | ||
identicalsMap?: IdenticalsMap; | ||
wordsWithPos?: WordsWithPos; | ||
score?: number; | ||
filteredAlt?: string[] | null; | ||
identicals?: string[][] | null; | ||
identicalsMap?: IdenticalsMap | null; | ||
wordsWithPos?: WordsWithPos | null; | ||
score?: number | null; | ||
} | ||
@@ -23,4 +23,4 @@ export declare class SynOptimizer { | ||
constructor(language: string); | ||
getStopWords(stopWordsToAdd: string[], stopWordsToRemove: string[], stopWordsOverride: string[]): string[]; | ||
scoreAlternative(alternative: string, stopWordsToAdd: string[], stopWordsToRemove: string[], stopWordsOverride: string[], identicals: string[][], debugHolder: DebugHolder): number; | ||
getStopWords(stopWordsToAdd: string[] | null | undefined, stopWordsToRemove: string[] | null | undefined, stopWordsOverride: string[] | null | undefined): string[]; | ||
scoreAlternative(alternative: string, stopWordsToAdd: string[] | null | undefined, stopWordsToRemove: string[] | null | undefined, stopWordsOverride: string[] | null | undefined, identicals: string[][] | null | undefined, debugHolder: DebugHolder | null | undefined): number; | ||
getStemmedWords(text: string, stopwords: string[]): string[]; | ||
@@ -30,4 +30,4 @@ getBest(alternatives: string[], stopWordsToAdd: string[], stopWordsToRemove: string[], stopWordsOverride: string[], identicals: string[][]): number; | ||
stemWord(word: string): string; | ||
getWordsWithPos(words: string[], identicals: string[][], debugHolder: DebugHolder): WordsWithPos; | ||
getWordsWithPos(words: string[], identicals: string[][] | null | undefined, debugHolder: DebugHolder | null | undefined): WordsWithPos; | ||
} | ||
export {}; |
@@ -12,3 +12,3 @@ "use strict"; | ||
constructor(language) { | ||
this.languageSyn = helper_1.buildLanguageSyn(helper_1.getIso2fromLocale(language)); | ||
this.languageSyn = (0, helper_1.buildLanguageSyn)((0, helper_1.getIso2fromLocale)(language)); | ||
} | ||
@@ -15,0 +15,0 @@ getStopWords(stopWordsToAdd, stopWordsToRemove, stopWordsOverride) { |
{ | ||
"name": "synonym-optimizer", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "Finds the text which has the least number of repetitions", | ||
@@ -55,3 +55,3 @@ "main": "dist/index.js", | ||
"@types/wink-tokenizer": "^4.0.1", | ||
"rosaenlg-filter": "5.1.0", | ||
"rosaenlg-filter": "5.2.0", | ||
"snowball-stemmer.jsx": "^0.2.3", | ||
@@ -69,3 +69,3 @@ "stopwords-de": "^0.3.0", | ||
}, | ||
"gitHead": "11645a24749c02832b29d6ef71cdf943f89ea81a" | ||
"gitHead": "e4e8082280b13351e9b82b8ff49beebf56103ea9" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51589
39
672
+ Addedenglish-a-an@3.2.0(transitive)
+ Addedenglish-a-an-list@3.2.0(transitive)
+ Addedfrench-contractions@5.2.0(transitive)
+ Addedrosaenlg-commons@3.2.0(transitive)
+ Addedrosaenlg-filter@5.2.0(transitive)
- Removedenglish-a-an@3.1.0(transitive)
- Removedenglish-a-an-list@3.1.0(transitive)
- Removedfrench-contractions@5.1.0(transitive)
- Removedrosaenlg-commons@3.1.0(transitive)
- Removedrosaenlg-filter@5.1.0(transitive)
Updatedrosaenlg-filter@5.2.0