1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
10
11
12
|
-
-
+
+
+
+
+
|
//// STRING TRANSFORMATION
/*jslint esversion: 6*/
// STRING TRANSFORMATION
/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global exports, console */
"use strict";
// Note: 48 is the ASCII code for "0"
var str_transform = {
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
-
+
|
let [sPfxCode, sSfxCode] = sAffCode.split('/');
sWord = sPfxCode.slice(1) + sWord.slice(sPfxCode.charCodeAt(0)-48);
return sSfxCode[0] == '0' ? sWord + sSfxCode.slice(1) : sWord.slice(0, -(sSfxCode.charCodeAt(0)-48)) + sSfxCode.slice(1);
}
};
if (typeof(exports) !== 'undefined') {
if (typeof exports !== 'undefined') {
exports.longestCommonSubstring = str_transform.longestCommonSubstring;
exports.distanceDamerauLevenshtein = str_transform.distanceDamerauLevenshtein;
exports.distanceDamerauLevenshtein2 = str_transform.distanceDamerauLevenshtein2;
exports.showDistance = str_transform.showDistance;
exports.changeWordWithSuffixCode = str_transform.changeWordWithSuffixCode;
exports.changeWordWithAffixCode = str_transform.changeWordWithAffixCode;
exports.defineAffixCode = str_transform.defineAffixCode;
exports.defineSuffixCode = str_transform.defineSuffixCode;
}
|