@interslavic/database-engine-core
Advanced tools
Comparing version 1.0.5 to 1.0.6
import { Lemma } from '../lemma'; | ||
export declare function parseSynset(rawStr: string): { | ||
export declare function parseSynset(rawString: string): { | ||
verified: boolean; | ||
lemmas: Lemma[]; | ||
}; |
@@ -6,8 +6,9 @@ "use strict"; | ||
const metacharacters_1 = require("./metacharacters"); | ||
function parseSynset(rawStr) { | ||
const verified = (0, metacharacters_1.isVerified)(rawStr); | ||
const annotations = rawStr.includes('(') | ||
function parseSynset(rawString) { | ||
const sanitized = sanitize(rawString); | ||
const verified = (0, metacharacters_1.isVerified)(sanitized); | ||
const annotations = sanitized.includes('(') | ||
? new AnnotationHelper() | ||
: new NoopAnnotationHelper(); | ||
const lemmaString = annotations.stash((0, metacharacters_1.stripMetacharacters)(rawStr).trim()); | ||
const lemmaString = annotations.stash((0, metacharacters_1.stripMetacharacters)(sanitized).trim()); | ||
const lemmas = lemmaString.length > 0 | ||
@@ -24,2 +25,7 @@ ? lemmaString | ||
exports.parseSynset = parseSynset; | ||
function sanitize(str) { | ||
// Remove 00-31 and 7F | ||
// eslint-disable-next-line no-control-regex | ||
return str.replace(/[\u0000-\u001F\u007F]/g, ''); | ||
} | ||
class AnnotationHelper { | ||
@@ -26,0 +32,0 @@ constructor() { |
{ | ||
"name": "@interslavic/database-engine-core", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"repository": { | ||
@@ -23,6 +23,6 @@ "type": "git", | ||
"devDependencies": { | ||
"@interslavic/eslint-config-database-engine": "1.0.5", | ||
"@interslavic/jest-config-database-engine": "1.0.5", | ||
"@interslavic/prettier-config-database-engine": "1.0.5", | ||
"@interslavic/typescript-config-database-engine": "1.0.5", | ||
"@interslavic/eslint-config-database-engine": "1.0.6", | ||
"@interslavic/jest-config-database-engine": "1.0.6", | ||
"@interslavic/prettier-config-database-engine": "1.0.6", | ||
"@interslavic/typescript-config-database-engine": "1.0.6", | ||
"ts-node": "^10.9.1", | ||
@@ -44,3 +44,3 @@ "typescript": "^4.9.5" | ||
}, | ||
"gitHead": "3e51a643c6456b716711c9b74208676ad307f61e" | ||
"gitHead": "bfa27175cbc8efb681f06cc662440ea1221d672c" | ||
} |
@@ -5,9 +5,10 @@ import { Lemma } from '../lemma'; | ||
export function parseSynset(rawStr: string) { | ||
const verified = isVerified(rawStr); | ||
const annotations = rawStr.includes('(') | ||
export function parseSynset(rawString: string) { | ||
const sanitized = sanitize(rawString); | ||
const verified = isVerified(sanitized); | ||
const annotations = sanitized.includes('(') | ||
? new AnnotationHelper() | ||
: new NoopAnnotationHelper(); | ||
const lemmaString = annotations.stash(stripMetacharacters(rawStr).trim()); | ||
const lemmaString = annotations.stash(stripMetacharacters(sanitized).trim()); | ||
const lemmas = | ||
@@ -26,2 +27,8 @@ lemmaString.length > 0 | ||
function sanitize(str: string) { | ||
// Remove 00-31 and 7F | ||
// eslint-disable-next-line no-control-regex | ||
return str.replace(/[\u0000-\u001F\u007F]/g, ''); | ||
} | ||
class AnnotationHelper { | ||
@@ -28,0 +35,0 @@ map = new Map<string, string>(); |
94067
1681