mirror of
https://github.com/leon-ai/leon.git
synced 2024-08-17 06:00:33 +03:00
style: fix new linting
This commit is contained in:
parent
6849e9fc2e
commit
a777ce36af
@ -2,10 +2,12 @@
|
||||
"extends": "airbnb-base",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"browser": true,
|
||||
"jest/globals": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2021
|
||||
},
|
||||
"globals": {
|
||||
"io": true
|
||||
},
|
||||
@ -34,6 +36,8 @@
|
||||
"no-shadow": "off",
|
||||
"import/no-extraneous-dependencies": "off",
|
||||
"import/no-dynamic-require": "off",
|
||||
"prefer-promise-reject-errors": ["off"],
|
||||
"no-async-promise-executor": ["off"],
|
||||
"no-underscore-dangle": ["error", { "allowAfterThis": true }],
|
||||
"space-before-function-paren": ["error", "always"],
|
||||
"prefer-destructuring": ["error", { "array": true, "object": true }],
|
||||
|
@ -17,7 +17,7 @@ listener.listening = (stream, minDecibels, maxBlankTime,
|
||||
|
||||
analyser.getByteFrequencyData(data)
|
||||
|
||||
if (data.some(v => v)) {
|
||||
if (data.some((v) => v)) {
|
||||
if (triggered) {
|
||||
triggered = false
|
||||
|
||||
|
@ -36,38 +36,38 @@ export default () => new Promise(async (resolve, reject) => {
|
||||
can_offline_stt: { title: 'Offline speech-to-text', type: 'warning', v: true }
|
||||
}
|
||||
|
||||
log.title('Checking')
|
||||
log.title('Checking');
|
||||
|
||||
// Environment checking
|
||||
|
||||
;(await Promise.all([
|
||||
(await Promise.all([
|
||||
command('node --version', { shell: true }),
|
||||
command('npm --version', { shell: true }),
|
||||
command('pipenv --version', { shell: true })
|
||||
])).forEach((p) => {
|
||||
log.info(p.command)
|
||||
|
||||
if (p.command.indexOf('node --version') !== -1 &&
|
||||
!semver.satisfies(semver.clean(p.stdout), `>=${nodeMinRequiredVersion}`)) {
|
||||
if (p.command.indexOf('node --version') !== -1
|
||||
&& !semver.satisfies(semver.clean(p.stdout), `>=${nodeMinRequiredVersion}`)) {
|
||||
Object.keys(report).forEach((item) => { if (report[item].type === 'error') report[item].v = false })
|
||||
log.error(`${p.stdout}\nThe Node.js version must be >=${nodeMinRequiredVersion}. Please install it: https://nodejs.org (or use nvm)\n`)
|
||||
} else if (p.command.indexOf('npm --version') !== -1 &&
|
||||
!semver.satisfies(semver.clean(p.stdout), `>=${npmMinRequiredVersion}`)) {
|
||||
} else if (p.command.indexOf('npm --version') !== -1
|
||||
&& !semver.satisfies(semver.clean(p.stdout), `>=${npmMinRequiredVersion}`)) {
|
||||
Object.keys(report).forEach((item) => { if (report[item].type === 'error') report[item].v = false })
|
||||
log.error(`${p.stdout}\nThe npm version must be >=${npmMinRequiredVersion}. Please install it: https://www.npmjs.com/get-npm (or use nvm)\n`)
|
||||
} else {
|
||||
log.success(`${p.stdout}\n`)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
;(await Promise.all([
|
||||
(await Promise.all([
|
||||
command('pipenv --where', { shell: true }),
|
||||
command('pipenv run python --version', { shell: true })
|
||||
])).forEach((p) => {
|
||||
log.info(p.command)
|
||||
|
||||
if (p.command.indexOf('pipenv run python --version') !== -1 &&
|
||||
!semver.satisfies(p.stdout.split(' ')[1], `>=${pythonMinRequiredVersion}`)) {
|
||||
if (p.command.indexOf('pipenv run python --version') !== -1
|
||||
&& !semver.satisfies(p.stdout.split(' ')[1], `>=${pythonMinRequiredVersion}`)) {
|
||||
Object.keys(report).forEach((item) => { if (report[item].type === 'error') report[item].v = false })
|
||||
log.error(`${p.stdout}\nThe Python version must be >=${pythonMinRequiredVersion}. Please install it: https://www.python.org/downloads\n`)
|
||||
} else {
|
||||
|
@ -6,7 +6,7 @@ import log from '@/helpers/log'
|
||||
/**
|
||||
* Update version number in files which need version number
|
||||
*/
|
||||
export default version => new Promise(async (resolve, reject) => {
|
||||
export default (version) => new Promise(async (resolve, reject) => {
|
||||
const changelog = 'CHANGELOG.md'
|
||||
const tmpChangelog = 'TMP-CHANGELOG.md'
|
||||
|
||||
|
@ -5,7 +5,7 @@ import log from '@/helpers/log'
|
||||
/**
|
||||
* Update version number in files which need version number
|
||||
*/
|
||||
export default version => new Promise(async (resolve, reject) => {
|
||||
export default (version) => new Promise(async (resolve, reject) => {
|
||||
log.info('Updating version...')
|
||||
|
||||
const promises = []
|
||||
|
@ -20,14 +20,14 @@ export default () => new Promise((resolve) => {
|
||||
const way = path.join(dir, entities[i])
|
||||
if (fs.statSync(way).isDirectory()) {
|
||||
list(way)
|
||||
} else if (entities[i].indexOf('.sample.json') !== -1 &&
|
||||
!fs.existsSync(`${dir}/${file}`)) { // Clone config from sample in case there is no existing config file
|
||||
} else if (entities[i].indexOf('.sample.json') !== -1
|
||||
&& !fs.existsSync(`${dir}/${file}`)) { // Clone config from sample in case there is no existing config file
|
||||
fs.createReadStream(`${dir}/${entities[i]}`)
|
||||
.pipe(fs.createWriteStream(`${dir}/${file}`))
|
||||
|
||||
log.success(`${file} file created`)
|
||||
} else if (entities[i].indexOf('.sample.json') !== -1 &&
|
||||
fs.existsSync(`${dir}/${file}`)) {
|
||||
} else if (entities[i].indexOf('.sample.json') !== -1
|
||||
&& fs.existsSync(`${dir}/${file}`)) {
|
||||
log.success(`${file} already exists`)
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ export default () => new Promise((resolve, reject) => {
|
||||
const packagesDir = 'packages'
|
||||
// Get packages list
|
||||
const packages = fs.readdirSync(packagesDir)
|
||||
.filter(entity =>
|
||||
fs.statSync(path.join(packagesDir, entity)).isDirectory())
|
||||
.filter((entity) => fs.statSync(path.join(packagesDir, entity)).isDirectory())
|
||||
|
||||
// Browse packages
|
||||
for (let i = 0; i < packages.length; i += 1) {
|
||||
|
@ -37,8 +37,7 @@ export default () => new Promise(async (resolve, reject) => {
|
||||
manager = new NlpManager({ languages: lang })
|
||||
}
|
||||
const packages = fs.readdirSync(packagesDir)
|
||||
.filter(entity =>
|
||||
fs.statSync(path.join(packagesDir, entity)).isDirectory())
|
||||
.filter((entity) => fs.statSync(path.join(packagesDir, entity)).isDirectory())
|
||||
let expressionsObj = { }
|
||||
|
||||
for (let i = 0; i < packages.length; i += 1) {
|
||||
|
@ -34,7 +34,9 @@ downloadController.get = (req, res) => {
|
||||
if (err && err.code === 'ENOENT') {
|
||||
message = 'There is no content to download for this module.'
|
||||
log.error(message)
|
||||
res.json({ success: false, status: 404, code: 'module_dir_not_found', message })
|
||||
res.json({
|
||||
success: false, status: 404, code: 'module_dir_not_found', message
|
||||
})
|
||||
} else {
|
||||
if (err) log.error(err)
|
||||
|
||||
@ -95,12 +97,16 @@ downloadController.get = (req, res) => {
|
||||
} else {
|
||||
message = 'This module does not exist.'
|
||||
log.error(message)
|
||||
res.json({ success: false, status: 404, code: 'module_not_found', message })
|
||||
res.json({
|
||||
success: false, status: 404, code: 'module_not_found', message
|
||||
})
|
||||
}
|
||||
} else {
|
||||
message = 'Bad request.'
|
||||
log.error(message)
|
||||
res.json({ success: false, status: 400, code: 'bad_request', message })
|
||||
res.json({
|
||||
success: false, status: 400, code: 'bad_request', message
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,8 +181,8 @@ class Brain {
|
||||
|
||||
/* istanbul ignore next */
|
||||
// Synchronize the downloaded content if enabled
|
||||
if (this.finalOutput.type === 'end' && this.finalOutput.options.synchronization && this.finalOutput.options.synchronization.enabled &&
|
||||
this.finalOutput.options.synchronization.enabled === true) {
|
||||
if (this.finalOutput.type === 'end' && this.finalOutput.options.synchronization && this.finalOutput.options.synchronization.enabled
|
||||
&& this.finalOutput.options.synchronization.enabled === true) {
|
||||
const sync = new Synchronizer(
|
||||
this,
|
||||
obj.classification,
|
||||
|
@ -17,7 +17,7 @@ class Ner {
|
||||
}
|
||||
|
||||
static logExtraction (entities) {
|
||||
entities.forEach(ent => log.success(`{ value: ${ent.sourceText}, entity: ${ent.entity} }`))
|
||||
entities.forEach((ent) => log.success(`{ value: ${ent.sourceText}, entity: ${ent.entity} }`))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +50,9 @@ class Ner {
|
||||
const entity = actionEntities[i]
|
||||
|
||||
if (!this.supportedEntityTypes.includes(entity.type)) {
|
||||
reject({ type: 'warning', obj: new Error(`"${entity.type}" action entity type not supported`), code: 'random_ner_type_not_supported', data: { '%entity_type%': entity.type } })
|
||||
reject({
|
||||
type: 'warning', obj: new Error(`"${entity.type}" action entity type not supported`), code: 'random_ner_type_not_supported', data: { '%entity_type%': entity.type }
|
||||
})
|
||||
} else if (entity.type === 'regex') {
|
||||
promises.push(this.injectRegexEntity(lang, entity))
|
||||
} else if (entity.type === 'trim') {
|
||||
|
@ -72,7 +72,9 @@ class Nlu {
|
||||
|
||||
const lang = langs[process.env.LEON_LANG].short
|
||||
const result = await this.classifier.process(lang, query)
|
||||
const { domain, intent, score, entities } = result
|
||||
const {
|
||||
domain, intent, score, entities
|
||||
} = result
|
||||
const [moduleName, actionName] = intent.split('.')
|
||||
let obj = {
|
||||
query,
|
||||
|
@ -25,7 +25,6 @@ class Server {
|
||||
this.server = { }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Server entry point
|
||||
*/
|
||||
|
@ -92,11 +92,11 @@ class Synchronizer {
|
||||
// Browse entities
|
||||
for (let i = 0; i < list.data.files.length; i += 1) {
|
||||
// In case the module folder exists
|
||||
if (list.data.files[i].mimeType === folderMimeType &&
|
||||
list.data.files[i].name === driveFolderName) {
|
||||
if (list.data.files[i].mimeType === folderMimeType
|
||||
&& list.data.files[i].name === driveFolderName) {
|
||||
folderId = list.data.files[i].id
|
||||
return cb(null, true, folderId)
|
||||
} else if ((i + 1) === list.data.files.length) {
|
||||
} else if ((i + 1) === list.data.files.length) { // eslint-disable-line no-else-return
|
||||
return cb(null, false, folderId)
|
||||
}
|
||||
// TODO: UI toolbox to reach this scope
|
||||
@ -106,6 +106,7 @@ class Synchronizer {
|
||||
log.title('Synchronizer'); log.success(`"${list.data.files[i].id}" deleted`)
|
||||
}, 200 * i) */
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
(folderExists, folderId, cb) => {
|
||||
|
@ -4,9 +4,9 @@ import date from '@/helpers/date'
|
||||
|
||||
const log = { }
|
||||
|
||||
log.success = value => console.log('\x1b[32m✔ %s\x1b[0m', value)
|
||||
log.success = (value) => console.log('\x1b[32m✔ %s\x1b[0m', value)
|
||||
|
||||
log.info = value => console.info('\x1b[36m➡ %s\x1b[0m', value)
|
||||
log.info = (value) => console.info('\x1b[36m➡ %s\x1b[0m', value)
|
||||
|
||||
log.error = (value) => {
|
||||
const path = `${__dirname}/../../../logs/errors.log`
|
||||
@ -29,10 +29,10 @@ log.error = (value) => {
|
||||
return console.error('\x1b[31m✖ %s\x1b[0m', value)
|
||||
}
|
||||
|
||||
log.warning = value => console.warn('\x1b[33m❗ %s\x1b[0m', value)
|
||||
log.warning = (value) => console.warn('\x1b[33m❗ %s\x1b[0m', value)
|
||||
|
||||
log.title = value => console.log('\n---\n\n\x1b[7m.: %s :.\x1b[0m\n', value.toUpperCase())
|
||||
log.title = (value) => console.log('\n---\n\n\x1b[7m.: %s :.\x1b[0m\n', value.toUpperCase())
|
||||
|
||||
log.default = value => console.log('%s', value)
|
||||
log.default = (value) => console.log('%s', value)
|
||||
|
||||
export default log
|
||||
|
@ -3,27 +3,27 @@ const string = { }
|
||||
/**
|
||||
* Parse, map (with object) and replace value(s) in a string
|
||||
*/
|
||||
string.pnr = (s, obj) => s.replace(new RegExp(Object.keys(obj).join('|'), 'gi'), matched => obj[matched])
|
||||
string.pnr = (s, obj) => s.replace(new RegExp(Object.keys(obj).join('|'), 'gi'), (matched) => obj[matched])
|
||||
|
||||
/**
|
||||
* Uppercase for the first letter
|
||||
*/
|
||||
string.ucfirst = s => s.charAt(0).toUpperCase() + s.substr(1)
|
||||
string.ucfirst = (s) => s.charAt(0).toUpperCase() + s.substr(1)
|
||||
|
||||
/**
|
||||
* Transform snake_case string to PascalCase
|
||||
*/
|
||||
string.snakeToPascalCase = s => s.split('_').map(chunk => string.ucfirst(chunk)).join('')
|
||||
string.snakeToPascalCase = (s) => s.split('_').map((chunk) => string.ucfirst(chunk)).join('')
|
||||
|
||||
/**
|
||||
* Random string
|
||||
*/
|
||||
string.random = n => Math.random().toString(36).slice(-n)
|
||||
string.random = (n) => Math.random().toString(36).slice(-n)
|
||||
|
||||
/**
|
||||
* Remove accents
|
||||
*/
|
||||
string.removeAccents = s => s.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
|
||||
string.removeAccents = (s) => s.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
|
||||
|
||||
/**
|
||||
* Remove end-punctuation
|
||||
|
@ -41,7 +41,7 @@ parser.parse = async (buffer, cb) => {
|
||||
audio,
|
||||
config: parser.conf
|
||||
})
|
||||
const string = res[0].results.map(data => data.alternatives[0].transcript).join('\n')
|
||||
const string = res[0].results.map((data) => data.alternatives[0].transcript).join('\n')
|
||||
|
||||
cb({ string })
|
||||
} catch (e) {
|
||||
|
@ -33,8 +33,8 @@ class Stt {
|
||||
/* istanbul ignore next */
|
||||
if (this.provider === 'google-cloud-stt' && typeof process.env.GOOGLE_APPLICATION_CREDENTIALS === 'undefined') {
|
||||
process.env.GOOGLE_APPLICATION_CREDENTIALS = `${__dirname}/../config/voice/google-cloud.json`
|
||||
} else if (typeof process.env.GOOGLE_APPLICATION_CREDENTIALS !== 'undefined' &&
|
||||
process.env.GOOGLE_APPLICATION_CREDENTIALS.indexOf('config/voice/google-cloud.json') === -1) {
|
||||
} else if (typeof process.env.GOOGLE_APPLICATION_CREDENTIALS !== 'undefined'
|
||||
&& process.env.GOOGLE_APPLICATION_CREDENTIALS.indexOf('config/voice/google-cloud.json') === -1) {
|
||||
log.warning(`The "GOOGLE_APPLICATION_CREDENTIALS" env variable is already settled with the following value: "${process.env.GOOGLE_APPLICATION_CREDENTIALS}"`)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ parser.parse = async (buffer, cb) => {
|
||||
|
||||
client.recognize(parser.conf)
|
||||
.then(({ result }) => {
|
||||
const string = result.results.map(data => data.alternatives[0].transcript).join('\n')
|
||||
const string = result.results.map((data) => data.alternatives[0].transcript).join('\n')
|
||||
|
||||
cb({ string })
|
||||
})
|
||||
@ -56,7 +56,7 @@ parser.parse = async (buffer, cb) => {
|
||||
if (err) {
|
||||
log.error(`Watson STT: ${err}`)
|
||||
} else {
|
||||
const string = res.results.map(data => data.alternatives[0].transcript).join('\n')
|
||||
const string = res.results.map((data) => data.alternatives[0].transcript).join('\n')
|
||||
|
||||
cb({ string })
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ class Tts {
|
||||
/* istanbul ignore next */
|
||||
if (this.provider === 'google-cloud-tts' && typeof process.env.GOOGLE_APPLICATION_CREDENTIALS === 'undefined') {
|
||||
process.env.GOOGLE_APPLICATION_CREDENTIALS = `${__dirname}/../config/voice/google-cloud.json`
|
||||
} else if (typeof process.env.GOOGLE_APPLICATION_CREDENTIALS !== 'undefined' &&
|
||||
process.env.GOOGLE_APPLICATION_CREDENTIALS.indexOf('config/voice/google-cloud.json') === -1) {
|
||||
} else if (typeof process.env.GOOGLE_APPLICATION_CREDENTIALS !== 'undefined'
|
||||
&& process.env.GOOGLE_APPLICATION_CREDENTIALS.indexOf('config/voice/google-cloud.json') === -1) {
|
||||
log.warning(`The "GOOGLE_APPLICATION_CREDENTIALS" env variable is already settled with the following value: "${process.env.GOOGLE_APPLICATION_CREDENTIALS}"`)
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,7 @@ describe('NLU modules', () => {
|
||||
const { langs } = JSON.parse(fs.readFileSync(path.join(global.paths.root, 'core', 'langs.json'), 'utf8'))
|
||||
const langKeys = Object.keys(langs)
|
||||
const packages = fs.readdirSync(global.paths.packages)
|
||||
.filter(entity =>
|
||||
fs.statSync(path.join(global.paths.packages, entity)).isDirectory())
|
||||
.filter((entity) => fs.statSync(path.join(global.paths.packages, entity)).isDirectory())
|
||||
|
||||
for (let i = 0; i < langKeys.length; i += 1) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
|
@ -20,7 +20,7 @@ describe('are JSON files valid', () => {
|
||||
} else if (entities[i].indexOf('.json') !== -1) {
|
||||
const jsonFile = path.join(global.paths.root, dir, entities[i])
|
||||
test(`${jsonFile} has valid JSON syntax`, () => {
|
||||
try {
|
||||
try { // eslint-disable-line no-useless-catch
|
||||
JSON.parse(fs.readFileSync(jsonFile, 'utf8'))
|
||||
|
||||
expect(true).toBe(true)
|
||||
|
@ -6,7 +6,7 @@ describe('no punctuation', () => {
|
||||
'server/src/data/expressions'
|
||||
]
|
||||
const punctuations = ['.', ';', ':', '?', '!']
|
||||
const findPunctuation = s => punctuations.includes(s[s.length - 1])
|
||||
const findPunctuation = (s) => punctuations.includes(s[s.length - 1])
|
||||
const findString = (iterable) => {
|
||||
const keys = Object.keys(iterable)
|
||||
|
||||
@ -33,8 +33,8 @@ describe('no punctuation', () => {
|
||||
const way = path.join(dir, entities[i])
|
||||
if (fs.statSync(way).isDirectory()) {
|
||||
list(way)
|
||||
} else if (entities[i].indexOf('.json') !== -1 &&
|
||||
entities[i].indexOf('classifier.json') === -1) {
|
||||
} else if (entities[i].indexOf('.json') !== -1
|
||||
&& entities[i].indexOf('classifier.json') === -1) {
|
||||
const jsonFile = path.join(global.paths.root, dir, entities[i])
|
||||
const json = JSON.parse(fs.readFileSync(jsonFile, 'utf8'))
|
||||
|
||||
|
@ -6,7 +6,7 @@ describe('punctuation', () => {
|
||||
'packages'
|
||||
]
|
||||
const punctuations = ['.', ';', ':', '?', '!', '>']
|
||||
const findPunctuation = s => punctuations.includes(s[s.length - 1])
|
||||
const findPunctuation = (s) => punctuations.includes(s[s.length - 1])
|
||||
const findString = (iterable) => {
|
||||
const keys = Object.keys(iterable)
|
||||
|
||||
@ -33,8 +33,8 @@ describe('punctuation', () => {
|
||||
const way = path.join(dir, entities[i])
|
||||
if (fs.statSync(way).isDirectory()) {
|
||||
list(way)
|
||||
} else if (way.indexOf('data/answers') !== -1 &&
|
||||
entities[i].indexOf('.json') !== -1) {
|
||||
} else if (way.indexOf('data/answers') !== -1
|
||||
&& entities[i].indexOf('.json') !== -1) {
|
||||
const jsonFile = path.join(global.paths.root, dir, entities[i])
|
||||
const json = JSON.parse(fs.readFileSync(jsonFile, 'utf8'))
|
||||
|
||||
|
@ -140,8 +140,8 @@ describe('NER', () => {
|
||||
expect(Ner.logExtraction).toHaveBeenCalledTimes(1)
|
||||
console.log('entities', entities)
|
||||
expect(entities.length).toBe(2)
|
||||
expect(entities.map(e => e.entity)).toEqual(['start', 'animal'])
|
||||
expect(entities.map(e => e.sourceText)).toEqual(['Please whistle as a', 'bird'])
|
||||
expect(entities.map((e) => e.entity)).toEqual(['start', 'animal'])
|
||||
expect(entities.map((e) => e.sourceText)).toEqual(['Please whistle as a', 'bird'])
|
||||
})
|
||||
|
||||
test('extracts regex custom entities', async () => {
|
||||
@ -165,8 +165,8 @@ describe('NER', () => {
|
||||
|
||||
expect(Ner.logExtraction).toHaveBeenCalledTimes(1)
|
||||
expect(entities.length).toBe(3)
|
||||
expect(entities.map(e => e.entity)).toEqual(['color', 'color', 'color'])
|
||||
expect(entities.map(e => e.sourceText)).toEqual(['blue', 'white', 'red'])
|
||||
expect(entities.map((e) => e.entity)).toEqual(['color', 'color', 'color'])
|
||||
expect(entities.map((e) => e.sourceText)).toEqual(['blue', 'white', 'red'])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -97,7 +97,9 @@ describe('NLU', () => {
|
||||
}
|
||||
|
||||
expect(Nlu.fallback(obj, [
|
||||
{ words: ['query', 'example', 'test', 'fallbacks'], package: 'fake-pkg', module: 'fake-module', action: 'fake-action' }
|
||||
{
|
||||
words: ['query', 'example', 'test', 'fallbacks'], package: 'fake-pkg', module: 'fake-module', action: 'fake-action'
|
||||
}
|
||||
]).classification).toContainEntries([['package', 'fake-pkg'], ['module', 'fake-module'], ['action', 'fake-action'], ['confidence', 1]])
|
||||
})
|
||||
})
|
||||
|
@ -4,8 +4,8 @@ import parser from '@/stt/deepspeech/parser'
|
||||
|
||||
describe('DeepSpeech STT parser', () => {
|
||||
// Only run these tests if the models exist
|
||||
if (fs.existsSync(`${global.paths.root}/bin/deepspeech/deepspeech.pbmm`) &&
|
||||
fs.existsSync(`${global.paths.root}/bin/deepspeech/deepspeech.scorer`)) {
|
||||
if (fs.existsSync(`${global.paths.root}/bin/deepspeech/deepspeech.pbmm`)
|
||||
&& fs.existsSync(`${global.paths.root}/bin/deepspeech/deepspeech.scorer`)) {
|
||||
describe('init()', () => {
|
||||
test('returns error cannot find model', () => {
|
||||
expect(parser.init({
|
||||
|
Loading…
Reference in New Issue
Block a user