@telefonica/language-model-converter
Advanced tools
Comparing version 2.4.1 to 2.4.2
"use strict"; | ||
const commander = require('commander'); | ||
const glob = require('glob'); | ||
const parser_1 = require('./parser'); | ||
const commander = require("commander"); | ||
const glob = require("glob"); | ||
const parser_1 = require("./parser"); | ||
const cli = commander | ||
@@ -6,0 +6,0 @@ .description('Convert language files defined to LUIS format') |
"use strict"; | ||
const fs = require('fs'); | ||
const yaml = require('js-yaml'); | ||
const _ = require('lodash'); | ||
const fs = require("fs"); | ||
const yaml = require("js-yaml"); | ||
const _ = require("lodash"); | ||
class LanguageModelParser { | ||
@@ -10,11 +10,11 @@ constructor() { | ||
parse(files, culture) { | ||
try { | ||
files.forEach(file => { | ||
files.forEach(file => { | ||
try { | ||
let yamlFileContents = fs.readFileSync(file, 'utf8'); | ||
mergeDeep(this.doc, yaml.safeLoad(yamlFileContents)); | ||
}); | ||
} | ||
catch (err) { | ||
throw new Error('Not able to parse language model: ' + err); | ||
} | ||
} | ||
catch (err) { | ||
throw new Error('File "' + file + '": ' + err.message); | ||
} | ||
}); | ||
this.culture = culture; | ||
@@ -163,3 +163,6 @@ let luisModel = { | ||
tokenize(sentence) { | ||
return String(sentence) | ||
if (sentence === '') { | ||
return []; | ||
} | ||
let tokenized = String(sentence) | ||
.replace(/[^\w\u00C0-\u017F]/g, capture => ` ${capture} `) | ||
@@ -172,2 +175,3 @@ .replace(/_/g, capture => ` ${capture} `) | ||
.split(' '); | ||
return tokenized; | ||
} | ||
@@ -174,0 +178,0 @@ buildUtterance(sentence, intent) { |
{ | ||
"name": "@telefonica/language-model-converter", | ||
"version": "2.4.1", | ||
"description": "Language model converter for yot-bot", | ||
"license": "UNLICENSED", | ||
"version": "2.4.2", | ||
"description": "Language model converter yaml <-> json for LUIS", | ||
"license": "Apache-2.0", | ||
"repository": "https://github.com/Telefonica/yot-bot/tree/master/language-model-converter", | ||
@@ -11,9 +11,4 @@ "author": "TDAF <tdaf@tid.es>", | ||
}, | ||
"files": [ | ||
"lib", | ||
"bin" | ||
], | ||
"keywords": [ | ||
"luis", | ||
"fourth platform" | ||
"luis" | ||
], | ||
@@ -20,0 +15,0 @@ "main": "lib/index.js", |
# language-model-converter | ||
This is a tool to convert language files defined in yaml language model into the (LUIS)(http://luis.ai) internal JSON representation. | ||
This is a tool to convert language files defined in yaml language model into the [LUIS](http://luis.ai) internal JSON representation. | ||
@@ -99,4 +99,18 @@ ### The language model | ||
Notice that you can use [luis-cli](../luis-cli) to import or update the generated LUIS models. | ||
Notice that you can use [luis-cli](https://github.com/Telefonica/luis-cli) to import or update the generated LUIS models. | ||
## LICENSE | ||
Copyright 2016 [Telefónica I+D](http://www.tid.es) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Explicitly Unlicensed Item
License(Experimental) Something was found which is explicitly marked as unlicensed.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
60241
20
0
0
0
100
690
115
1