Socket
Socket
Sign inDemoInstall

@telefonica/language-model-converter

Package Overview
Dependencies
Maintainers
14
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telefonica/language-model-converter - npm Package Compare versions

Comparing version 2.7.0 to 3.0.0

23

lib/parser.js

@@ -41,13 +41,2 @@ "use strict";

let keys = Object.keys(this.doc);
let intentNames = keys
.filter(intentName => !intentName.startsWith('list.'))
.filter(intentName => !intentName.startsWith('phraselist'))
.filter(intentName => !intentName.startsWith('builtin'))
.map(intentName => {
if (intentName.length > 50) {
let err = `Intent "${intentName}" should be less than 50 characters. was ${intentName.length}`;
this.emitError(err);
}
return intentName;
});
let replacements = new Map();

@@ -62,4 +51,14 @@ keys.filter(listKey => listKey.startsWith('list.'))

let utterancesMap = new Map();
let intentNames = this.doc.intents ?
Object.keys(this.doc.intents)
.map(intentName => {
if (intentName.length > 50) {
let err = `Intent "${intentName}" should be less than 50 characters. was ${intentName.length}`;
this.emitError(err);
}
return intentName;
}) :
[];
intentNames.forEach(intent => {
let sentences = this.doc[intent];
let sentences = this.doc.intents[intent];
sentences

@@ -66,0 +65,0 @@ .map((sentence) => this.searchMissedVariables(sentence, replacements, missedReplacements))

{
"name": "@telefonica/language-model-converter",
"version": "2.7.0",
"version": "3.0.0",
"description": "Language model converter yaml <-> json for LUIS",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -75,15 +75,2 @@ /**

let intentNames = keys
// remove the lists: lines starting by "list." that are not intents
.filter(intentName => !intentName.startsWith('list.'))
.filter(intentName => !intentName.startsWith('phraselist'))
.filter(intentName => !intentName.startsWith('builtin'))
.map(intentName => {
if (intentName.length > 50) {
let err = `Intent "${intentName}" should be less than 50 characters. was ${intentName.length}`;
this.emitError(err);
}
return intentName;
});
let replacements = new Map<string, string[]>();

@@ -103,4 +90,15 @@ keys.filter(listKey => listKey.startsWith('list.'))

let intentNames = this.doc.intents ?
Object.keys(this.doc.intents)
.map(intentName => {
if (intentName.length > 50) {
let err = `Intent "${intentName}" should be less than 50 characters. was ${intentName.length}`;
this.emitError(err);
}
return intentName;
}) :
[];
intentNames.forEach(intent => {
let sentences = this.doc[intent];
let sentences = this.doc.intents[intent];

@@ -185,3 +183,3 @@ sentences

private searchMissedVariables(sentence: string, variables: Map<string, string[]>, missedVariables: Set<string>): string  {
private searchMissedVariables(sentence: string, variables: Map<string, string[]>, missedVariables: Set<string>): string {
let match = sentence.match(/\${(.+?)}/);

@@ -197,3 +195,3 @@ if (match) {

}
private expandVariables(sentence: string, variables: Map<string, string[]>, usedVariables: Set<string>): string[] {
private expandVariables(sentence: string, variables: Map<string, string[]>, usedVariables: Set<string>): string[]  {
let expandedSentences = new Set([sentence]);

@@ -221,3 +219,3 @@ expandedSentences.forEach(sentence => {

private extractEntities(sentence: string): any[] {
private extractEntities(sentence: string): any[]  {
let regexEntity = /\[(.+?):(.+?)\]/g; // entities are tagged as [entityValue:entityType], ex. [Burgos:city]

@@ -309,3 +307,3 @@

// Leaving the remaining alphabets for another brave person
;
;
// A word is any number > 0 of WORD_CHARS

@@ -428,3 +426,3 @@ const WORD = new RegExp(`^[${WORD_CHARS}]+`);

function isObject(item: any) {
return (item && typeof item === 'object' && !Array.isArray(item));
return (item && typeof item === 'object' && !Array.isArray(item));
}

@@ -431,0 +429,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc