diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e254d45..fa707f0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@master - - name: Git Unshalow + - name: Git Unshallow run: git fetch --prune --unshallow - name: Fetch Node Packages run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c7e57b..3378fd09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ - **nlu-engine:** stop progress watchdog when done or error ([#214](https://github.com/botpress/nlu/issues/214)) ([0661abd](https://github.com/botpress/nlu/commit/0661abd043c22f03381f77561020de64d78b15bc)) - **nlu-server:** ensure forward slashes in app id wont break fs model repo ([#173](https://github.com/botpress/nlu/issues/173)) ([889aa7c](https://github.com/botpress/nlu/commit/889aa7c447f1647d9da1483d5157fc279d543c63)) - **nlu-server:** fix send training_time using db config ([6225ef1](https://github.com/botpress/nlu/commit/6225ef124ecc719385afe667f5904885404f6418)) -- no more dupplicated issues in in-mem linting repo ([46cc134](https://github.com/botpress/nlu/commit/46cc13464b4aeaf51289a7f30f1992c377341b47)) +- no more duplicated issues in in-mem linting repo ([46cc134](https://github.com/botpress/nlu/commit/46cc13464b4aeaf51289a7f30f1992c377341b47)) - **worker:** do not reuse a process if it exited since last usage ([#135](https://github.com/botpress/nlu/issues/135)) ([9c3ab74](https://github.com/botpress/nlu/commit/9c3ab74c1c798fccd5e52e87bda9c4a34ac3d6b2)) ### Features @@ -141,7 +141,7 @@ - **lint:** applied linting to code ([774d32c](https://github.com/botpress/nlu/commit/774d32c4f5b414ebd4d22cbd8b4de027feee5f62)) - **sentry:** use sentry enabled instead of DSN for the configuration ([e89301c](https://github.com/botpress/nlu/commit/e89301cb5d633b6ba9649bb0d9164235885e9308)) - **style:** fix codestyle for tests, lint & formatting ([c9c572a](https://github.com/botpress/nlu/commit/c9c572a76110c6c54ef8a60bd727ae33e65eb018)) -- **worker:** fix node typings to pass environement variables correctly when spawning new thread ([#76](https://github.com/botpress/nlu/issues/76)) ([853a3f3](https://github.com/botpress/nlu/commit/853a3f3d7de38471cf4539dc395c6bf7b8ee9a27)) +- **worker:** fix node typings to pass environment variables correctly when spawning new thread ([#76](https://github.com/botpress/nlu/issues/76)) ([853a3f3](https://github.com/botpress/nlu/commit/853a3f3d7de38471cf4539dc395c6bf7b8ee9a27)) - run unit tests of all yarn packages from the root ([26670d3](https://github.com/botpress/nlu/commit/26670d30de797f3fa8c95b55330270157a79f1d1)) - **style:** fix codestyle for tests, lint & formatting ([cacbf94](https://github.com/botpress/nlu/commit/cacbf948a5f8589ce5bfd6402d3578b48c816497)) - undefined logger in slot tagger ([b2c688d](https://github.com/botpress/nlu/commit/b2c688dbef69fbda677adc701a23843f47504499)) @@ -157,7 +157,7 @@ ### Bug Fixes - exact matcher now works even with different entities ([#56](https://github.com/botpress/nlu/issues/56)) ([6c14b8c](https://github.com/botpress/nlu/commit/6c14b8ce6b14398fcdc621455382c0e18aaa0570)) -- **training:** porgress now won't skip steps ([#55](https://github.com/botpress/nlu/issues/55)) ([4073d61](https://github.com/botpress/nlu/commit/4073d617edf19d683833ee8394ead2376c94fdfa)) +- **training:** progress now won't skip steps ([#55](https://github.com/botpress/nlu/issues/55)) ([4073d61](https://github.com/botpress/nlu/commit/4073d617edf19d683833ee8394ead2376c94fdfa)) ### Features @@ -221,7 +221,7 @@ - **api:** no need for min 1 context ([e17ae84](https://github.com/botpress/nlu/commit/e17ae84df4d9d1c9d2102ecf3c470547bcf35147)) - **engine:** spell-checker does not replace entities anymore ([0e0d75a](https://github.com/botpress/nlu/commit/0e0d75a8efa2bb00d9b5c3c08f5873cc66425251)) - **logger:** no log filter should log all messages ([86e693c](https://github.com/botpress/nlu/commit/86e693c579e5a2a88648dc9810f55821db69b00d)) -- logger attach error no longuer throws ([b84f39a](https://github.com/botpress/nlu/commit/b84f39abd6eea9f8bdd56ec1dbaf5dad5a5e75d4)) +- logger attach error no longer throws ([b84f39a](https://github.com/botpress/nlu/commit/b84f39abd6eea9f8bdd56ec1dbaf5dad5a5e75d4)) - nanoid is default import from nanoid ([45ca517](https://github.com/botpress/nlu/commit/45ca517250002b230f455049a409867b60cc8836)) ### Features diff --git a/packages/bitfan/readme.md b/packages/bitfan/readme.md index 12dcccdd..939a4c55 100644 --- a/packages/bitfan/readme.md +++ b/packages/bitfan/readme.md @@ -62,7 +62,7 @@ interface Engine { } ``` -The `Criteria` abstraction act as a decision function that decides weither or not the test is failing or passing. It exists because engines are not responsible for electing a label. +The `Criteria` abstraction act as a decision function that decides whether or not the test is failing or passing. It exists because engines are not responsible for electing a label. ```ts interface Criteria { diff --git a/packages/bitfan/src/bitfan.d.ts b/packages/bitfan/src/bitfan.d.ts index f5d88b82..e7d82511 100644 --- a/packages/bitfan/src/bitfan.d.ts +++ b/packages/bitfan/src/bitfan.d.ts @@ -95,7 +95,7 @@ export namespace sampling { dataset: DataSet, trainPercent: number, seed: number, - options?: { stratificate: boolean } + options?: { stratify: boolean } ) => { trainSet: DataSet testSet: DataSet @@ -105,7 +105,7 @@ export namespace sampling { dataset: DataSet, percent: number, seed: number, - options?: { stratificate: boolean } + options?: { stratify: boolean } ) => DataSet export const sampleClasses: ( @@ -132,7 +132,7 @@ export namespace labels { } export namespace tables { - export const tabelize: ( + export const tablize: ( data: D[], disposition: { row: (d: D) => string @@ -249,7 +249,7 @@ export type Prediction = { } /** - * @description Function that decides weither or not a test should pass or fail. + * @description Function that decides whether or not a test should pass or fail. * @returns A number between 0 and 1 where 0 means that the test has failed. * For multi-class problems, this number will often be, neither 1 or 0, but a fraction. */ diff --git a/packages/bitfan/src/builtin/sampling/samplesClasses.ts b/packages/bitfan/src/builtin/sampling/samplesClasses.ts index 7f7f5130..116b9701 100644 --- a/packages/bitfan/src/builtin/sampling/samplesClasses.ts +++ b/packages/bitfan/src/builtin/sampling/samplesClasses.ts @@ -23,7 +23,7 @@ export const sampleClasses: typeof sdk.sampling.sampleClasses = allClasses.length) { throw new Error(`Can't subsample ${nClass} classes out of ${allClasses.length} class.`) diff --git a/packages/bitfan/src/builtin/sampling/trainTestSplit.ts b/packages/bitfan/src/builtin/sampling/trainTestSplit.ts index 294ee314..d50111af 100644 --- a/packages/bitfan/src/builtin/sampling/trainTestSplit.ts +++ b/packages/bitfan/src/builtin/sampling/trainTestSplit.ts @@ -7,7 +7,7 @@ export const subSample: typeof sampling.subSample = ( dataset: DataSet, percent: number, seed: number, - options = { stratificate: true } + options = { stratify: true } ): DataSet => { const { trainSet } = trainTestSplit(dataset, percent, seed, options) return trainSet @@ -17,7 +17,7 @@ export const trainTestSplit: typeof sampling.trainTestSplit = , trainPercent: number, seed: number, - options = { stratificate: true } + options = { stratify: true } ): { trainSet: DataSet testSet: DataSet @@ -39,7 +39,7 @@ export const trainTestSplit: typeof sampling.trainTestSplit = [] = [] const testSamples: Sample[] = [] - if (options.stratificate) { + if (options.stratify) { // preserve proportions of each class for (const c of allClasses) { const samplesOfClass = dataset.samples.filter((r) => areSame(r.label, c)) diff --git a/packages/bitfan/src/builtin/tables/init.test.ts b/packages/bitfan/src/builtin/tables/init.test.ts index 9c070b28..103ba284 100644 --- a/packages/bitfan/src/builtin/tables/init.test.ts +++ b/packages/bitfan/src/builtin/tables/init.test.ts @@ -1,6 +1,6 @@ import { initDic } from './init' -test('initDictionnary', () => { +test('initDictionary', () => { // arrange // act diff --git a/packages/bitfan/src/builtin/tables/tabelize.test.ts b/packages/bitfan/src/builtin/tables/tablize.test.ts similarity index 88% rename from packages/bitfan/src/builtin/tables/tabelize.test.ts rename to packages/bitfan/src/builtin/tables/tablize.test.ts index e931257a..62fb4dd0 100644 --- a/packages/bitfan/src/builtin/tables/tabelize.test.ts +++ b/packages/bitfan/src/builtin/tables/tablize.test.ts @@ -1,5 +1,5 @@ import * as sdk from '../../bitfan' -import { tabelize } from './tabelize' +import { tablize } from './tablize' test('toTable', () => { // arrange @@ -14,7 +14,7 @@ test('toTable', () => { } // act - const table = tabelize(performanceReport.scores, { + const table = tablize(performanceReport.scores, { row: (d) => d.metric, column: (d) => `${d.seed}`, score: (d) => d.score diff --git a/packages/bitfan/src/builtin/tables/tabelize.ts b/packages/bitfan/src/builtin/tables/tablize.ts similarity index 94% rename from packages/bitfan/src/builtin/tables/tabelize.ts rename to packages/bitfan/src/builtin/tables/tablize.ts index 1b735fbd..052a17f1 100644 --- a/packages/bitfan/src/builtin/tables/tabelize.ts +++ b/packages/bitfan/src/builtin/tables/tablize.ts @@ -2,7 +2,7 @@ import * as sdk from 'bitfan/sdk' import _ from 'lodash' import { initTable } from './init' -export const tabelize: typeof sdk.tables.tabelize = ( +export const tablize: typeof sdk.tables.tablize = ( data: D[], disposition: { row: (d: D) => string diff --git a/packages/bitfan/src/builtin/visualisation/report.ts b/packages/bitfan/src/builtin/visualisation/report.ts index add7919f..b74259de 100644 --- a/packages/bitfan/src/builtin/visualisation/report.ts +++ b/packages/bitfan/src/builtin/visualisation/report.ts @@ -2,7 +2,7 @@ import * as sdk from 'bitfan/sdk' import chalk from 'chalk' import _ from 'lodash' import { roundTable } from '../tables/round' -import { tabelize } from '../tables/tabelize' +import { tablize } from '../tables/tablize' const DEFAULT_OPT: { groupBy: 'seed' | 'problem' | 'all' @@ -18,7 +18,7 @@ export const showPerformanceReport: typeof sdk.visualisation.showPerformanceRepo ) => { const options = { ...DEFAULT_OPT, ...(opt ?? {}) } - let table = tabelize(report.scores, { + let table = tablize(report.scores, { row: (s) => s.metric, column: (s) => (options.groupBy === 'seed' ? `${s.seed}` : options.groupBy === 'problem' ? s.problem : 'all'), score: (s) => s.score diff --git a/packages/bitfan/src/index.ts b/packages/bitfan/src/index.ts index 41c81a79..aaf98aef 100644 --- a/packages/bitfan/src/index.ts +++ b/packages/bitfan/src/index.ts @@ -23,7 +23,7 @@ import { trainTestSplit, subSample } from './builtin/sampling/trainTestSplit' import { isAllDefined } from './builtin/tables/guards' import { initDic, initTable } from './builtin/tables/init' import { roundDic, roundTable } from './builtin/tables/round' -import { tabelize } from './builtin/tables/tabelize' +import { tablize } from './builtin/tables/tablize' import { transposeTable } from './builtin/tables/transpose' import { showClassDistribution, showDatasetsSummary } from './builtin/visualisation/dataset' import { showOOSConfusion } from './builtin/visualisation/oos' @@ -104,7 +104,7 @@ const impl: typeof sdk = { }, tables: { - tabelize, + tablize, initDic, initTable, roundDic, diff --git a/packages/bitfan/src/services/bp-provider/stan-provider.ts b/packages/bitfan/src/services/bp-provider/stan-provider.ts index 2f2b7080..9ed803a8 100644 --- a/packages/bitfan/src/services/bp-provider/stan-provider.ts +++ b/packages/bitfan/src/services/bp-provider/stan-provider.ts @@ -65,7 +65,7 @@ export class StanProvider { public async predict(utterances: string[]): Promise { const predOutput = await this._client.predict(APP_ID, this._modelId ?? '', { utterances }) if (!predOutput.success) { - throw new Error(`An error occured at prediction: ${predOutput.error.message}.`) + throw new Error(`An error occurred at prediction: ${predOutput.error.message}.`) } return predOutput.predictions } diff --git a/packages/bitfan/src/solution.ts b/packages/bitfan/src/solution.ts index 99f0296b..1810304f 100644 --- a/packages/bitfan/src/solution.ts +++ b/packages/bitfan/src/solution.ts @@ -42,7 +42,7 @@ const makeSolutionRunner = ( // eslint-disable-next-line no-console console.log( chalk.red( - `The following error occured when solving problem ${problem.name} with seed ${seed}:\n${err.message}\n${err.stack}` + `The following error occurred when solving problem ${problem.name} with seed ${seed}:\n${err.message}\n${err.stack}` ) ) process.exit(1) diff --git a/packages/distributed/readme.md b/packages/distributed/readme.md index 52f1a08f..0960684e 100644 --- a/packages/distributed/readme.md +++ b/packages/distributed/readme.md @@ -8,7 +8,7 @@ Locks prevent multiple types of race conditions. Race conditions can occur: - in single-threaded apps when using asynchronous code - in multi-threaded/multi-process apps -- in mutli-instances apps +- in multi-instances apps ## Queues @@ -16,4 +16,4 @@ A Distributed Task Queue can run tasks on multiple instances without the need fo ## Licensing -This software is protected by the same license as the [main Botpress repository](https://github.com/botpress/botpress). You can find the license file [here](https://github.com/botpress/botpress/blob/master/LICENSE). +This software is protected by the same [license](https://github.com/botpress/botpress/blob/master/LICENSE) as the [main Botpress repository](https://github.com/botpress/botpress). diff --git a/packages/distributed/src/locks/in-mem-trx-locker.ts b/packages/distributed/src/locks/in-mem-trx-locker.ts index f2b97f51..ccb511b2 100644 --- a/packages/distributed/src/locks/in-mem-trx-locker.ts +++ b/packages/distributed/src/locks/in-mem-trx-locker.ts @@ -2,7 +2,7 @@ import _ from 'lodash' import { TransactionLocker, Logger, Transaction } from './typings' /** - * For race conditions occuring because of the event loop in a single-threaded application + * For race conditions occurring because of the event loop in a single-threaded application */ export class InMemoryTransactionLocker implements TransactionLocker { private _tasks: Transaction[] = [] diff --git a/packages/distributed/src/locks/pg-trx-locker.ts b/packages/distributed/src/locks/pg-trx-locker.ts index e0e7cc5a..e349a4cc 100644 --- a/packages/distributed/src/locks/pg-trx-locker.ts +++ b/packages/distributed/src/locks/pg-trx-locker.ts @@ -7,7 +7,7 @@ import { TransactionLocker, Transaction, Logger } from './typings' const TRX_LOCK_KEY = 'trx_lock' /** - * For race conditions occuring in distributed applications + * For race conditions occurring in distributed applications */ export class PGTransactionLocker implements TransactionLocker { private client: Client diff --git a/packages/distributed/src/locks/typings.ts b/packages/distributed/src/locks/typings.ts index 62cfbe84..85a87e70 100644 --- a/packages/distributed/src/locks/typings.ts +++ b/packages/distributed/src/locks/typings.ts @@ -7,12 +7,12 @@ export type Transaction = { * Prevents race conditions by only running one task at a time. * Tasks are simply called when its there turn to run. * - * Does not involve to mannualy check if lock is free. + * Does not involve to manually check if lock is free. */ export type TransactionLocker = { /** - * Waits for a lock to be free, aquires it and runs function - * @param t The async function to run inside the aquire and release lock statement + * Waits for a lock to be free, acquires it and runs function + * @param t The async function to run inside the acquire and release lock statement * @returns A promise that resolves of rejects once the task is done or throws */ runInLock(t: Transaction): Promise diff --git a/packages/distributed/src/queues/base-queue.ts b/packages/distributed/src/queues/base-queue.ts index c1a9f03a..e0231c68 100644 --- a/packages/distributed/src/queues/base-queue.ts +++ b/packages/distributed/src/queues/base-queue.ts @@ -76,7 +76,7 @@ export abstract class BaseTaskQueue implements ITask return this._schedulingTimmer.run() } catch (thrown) { const err = thrown instanceof Error ? thrown : new Error(`${thrown}`) - this._logger.attachError(err).error('An error occured when running scheduler interrupt.') + this._logger.attachError(err).error('An error occurred when running scheduler interrupt.') } } @@ -92,12 +92,12 @@ export abstract class BaseTaskQueue implements ITask return } - const pendings = await repo.query({ status: 'pending' }) - if (pendings.length <= 0) { + const pending = await repo.query({ status: 'pending' }) + if (pending.length <= 0) { return } - const task = pendings[0] + const task = pending[0] task.status = 'running' task.cluster = this._clusterId await repo.set(task) diff --git a/packages/distributed/src/queues/interrupt.ts b/packages/distributed/src/queues/interrupt.ts index f9a8b488..27543466 100644 --- a/packages/distributed/src/queues/interrupt.ts +++ b/packages/distributed/src/queues/interrupt.ts @@ -26,10 +26,10 @@ export type InterruptTimer = { * * Basically the opposite of a throttle. * Ensures a function is executed at least every x ms. - * Running the function mannualy only resets the timmer. + * Running the function manually only resets the timmer. * * @param f Function to run - * @param ms Max allowed time beetween function invocation + * @param ms Max allowed time between function invocation * @returns a timer object that can be ran or stopped */ export const createTimer = (f: Func>, ms: number): InterruptTimer => { diff --git a/packages/distributed/src/queues/pg-distributed-queue.ts b/packages/distributed/src/queues/pg-distributed-queue.ts index 19233454..3548f1c3 100644 --- a/packages/distributed/src/queues/pg-distributed-queue.ts +++ b/packages/distributed/src/queues/pg-distributed-queue.ts @@ -105,7 +105,7 @@ export class PGDistributedTaskQueue private _handleCancelTaskEvent = async (taskId: TId, clusterId: string) => { if (clusterId !== this._clusterId) { - return // message was not adressed to this instance + return // message was not addressed to this instance } try { @@ -117,7 +117,7 @@ export class PGDistributedTaskQueue } } - // for if an completly busy instance receives a queue task http call + // for if a completely busy instance receives a queue task http call protected runSchedulerInterrupt() { return this._obs.emit('run_scheduler_interrupt', undefined) } diff --git a/packages/lang-client/src/client.ts b/packages/lang-client/src/client.ts index ca03ff7a..d286ebcd 100644 --- a/packages/lang-client/src/client.ts +++ b/packages/lang-client/src/client.ts @@ -10,7 +10,7 @@ import { LanguagesResponseBody, DownloadLangResponseBody, ErrorResponse, - SuccessReponse, + SuccessResponse, TokenizeRequestBody, VectorizeRequestBody } from './typings' @@ -33,67 +33,67 @@ export class LangClient implements IClient { } public async getInfo(): Promise { - const ressource = 'info' - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const resource = 'info' + const call: HTTPCall<'GET'> = { verb: 'GET', resource } const res = await this._get(call) return validateResponse(call, res) } public async tokenize(utterances: string[], lang: string): Promise { - const ressource = `tokenize/${lang}` + const resource = `tokenize/${lang}` const body: TokenizeRequestBody = { utterances } - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, body) return validateResponse(call, res) } public async vectorize(tokens: string[], lang: string): Promise { - const ressource = `vectorize/${lang}` + const resource = `vectorize/${lang}` const body: VectorizeRequestBody = { tokens } - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, body) return validateResponse(call, res) } public async getLanguages(): Promise { - const ressource = 'languages' - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const resource = 'languages' + const call: HTTPCall<'GET'> = { verb: 'GET', resource } const res = await this._get(call) return validateResponse(call, res) } public async startDownload(lang: string): Promise { - const ressource = `languages/${lang}` - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = `languages/${lang}` + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call) return validateResponse(call, res) } - public async deleteLang(lang: string): Promise { - const ressource = `languages/${lang}/delete` - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + public async deleteLang(lang: string): Promise { + const resource = `languages/${lang}/delete` + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call) - return validateResponse(call, res) + return validateResponse(call, res) } - public async loadLang(lang: string): Promise { - const ressource = `languages/${lang}/load` - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + public async loadLang(lang: string): Promise { + const resource = `languages/${lang}/load` + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call) - return validateResponse(call, res) + return validateResponse(call, res) } - public async cancelDownload(downloadId: string): Promise { - const ressource = `languages/cancel/${downloadId}` - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + public async cancelDownload(downloadId: string): Promise { + const resource = `languages/cancel/${downloadId}` + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call) - return validateResponse(call, res) + return validateResponse(call, res) } private _post = async (call: HTTPCall<'POST'>, body?: any): Promise> => { try { - const { ressource } = call - const res = await this._axios.post(ressource, body) + const { resource } = call + const res = await this._axios.post(resource, body) return res } catch (err) { // axios validate status does not prevent all exceptions @@ -103,8 +103,8 @@ export class LangClient implements IClient { private _get = async (call: HTTPCall<'GET'>): Promise> => { try { - const { ressource } = call - const res = await this._axios.get(ressource) + const { resource } = call + const res = await this._axios.get(resource) return res } catch (err) { // axios validate status does not prevent all exceptions diff --git a/packages/lang-client/src/typings.d.ts b/packages/lang-client/src/typings.d.ts index 9c8c1c3b..41580251 100644 --- a/packages/lang-client/src/typings.d.ts +++ b/packages/lang-client/src/typings.d.ts @@ -8,7 +8,7 @@ import { AxiosRequestConfig, AxiosInstance } from 'axios' export type LanguageInfo = { version: string ready: boolean - dimentions: number + dimensions: number domain: string readOnly: boolean } @@ -81,15 +81,15 @@ export type ErrorResponse = { error: LangError } -export type SuccessReponse = { +export type SuccessResponse = { success: true } -export type InfoResponseBody = {} & SuccessReponse & LanguageInfo -export type TokenizeResponseBody = {} & SuccessReponse & TokenizeResult -export type VectorizeResponseBody = {} & SuccessReponse & VectorizeResult -export type LanguagesResponseBody = {} & SuccessReponse & LanguageState -export type DownloadLangResponseBody = {} & SuccessReponse & DownloadStartResult +export type InfoResponseBody = {} & SuccessResponse & LanguageInfo +export type TokenizeResponseBody = {} & SuccessResponse & TokenizeResult +export type VectorizeResponseBody = {} & SuccessResponse & VectorizeResult +export type LanguagesResponseBody = {} & SuccessResponse & LanguageState +export type DownloadLangResponseBody = {} & SuccessResponse & DownloadStartResult export type TokenizeRequestBody = { utterances: string[] @@ -118,7 +118,7 @@ export class Client { public vectorize(tokens: string[], language: string): Promise public getLanguages(): Promise public startDownload(lang: string): Promise - public deleteLang(lang: string): Promise - public loadLang(lang: string): Promise - public cancelDownload(downloadId: string): Promise + public deleteLang(lang: string): Promise + public loadLang(lang: string): Promise + public cancelDownload(downloadId: string): Promise } diff --git a/packages/lang-client/src/validation.test.ts b/packages/lang-client/src/validation.test.ts index c8f616f3..322cf38d 100644 --- a/packages/lang-client/src/validation.test.ts +++ b/packages/lang-client/src/validation.test.ts @@ -1,5 +1,5 @@ import { AxiosResponse } from 'axios' -import { SuccessReponse, ErrorResponse, LangError } from './typings' +import { SuccessResponse, ErrorResponse, LangError } from './typings' import { HTTPCall, validateResponse } from './validation' const augmentWithExtraKey = (res: Object) => { @@ -15,7 +15,7 @@ const augmentWithExtraKey = (res: Object) => { } const error: LangError = { code: 500, type: 'internal', message: 'An error' } -const call: HTTPCall<'GET'> = { verb: 'GET', ressource: 'info' } +const call: HTTPCall<'GET'> = { verb: 'GET', resource: 'info' } const axiosRes = (data: any): AxiosResponse => { const x: Partial> = { data, status: 200 } @@ -28,15 +28,15 @@ test('validating with absent success key should fail', async () => { expect(() => validateResponse(call, axiosRes({ someKey: 'some text' }))).toThrow() }) -test('validating a successfull response should pass', async () => { +test('validating a successful response should pass', async () => { // arrange - const res: SuccessReponse = { success: true } + const res: SuccessResponse = { success: true } // act && assert expect(() => validateResponse(call, axiosRes(res))).not.toThrow() }) -test('validating an unsuccessfull response with unempty error should pass', async () => { +test('validating an unsuccessful response with unempty error should pass', async () => { // arrange const res: ErrorResponse = { success: false, error } @@ -44,7 +44,7 @@ test('validating an unsuccessfull response with unempty error should pass', asyn expect(() => validateResponse(call, axiosRes(res))).not.toThrow() }) -test('validating an unsuccessfull response with empty error message should pass', async () => { +test('validating an unsuccessful response with empty error message should pass', async () => { const error: LangError = { message: '', code: 500, type: 'internal' } // arrange @@ -54,7 +54,7 @@ test('validating an unsuccessfull response with empty error message should pass' expect(() => validateResponse(call, axiosRes(res))).not.toThrow() }) -test('validating an unsuccessfull response with empty error should fail', async () => { +test('validating an unsuccessful response with empty error should fail', async () => { // arrange const res: ErrorResponse = { success: false, error: {} as LangError } @@ -62,7 +62,7 @@ test('validating an unsuccessfull response with empty error should fail', async expect(() => validateResponse(call, axiosRes(res))).toThrow() }) -test('validating an unsuccessfull response with undefined error should fail', async () => { +test('validating an unsuccessful response with undefined error should fail', async () => { // arrange const res: Partial = { success: false } @@ -70,9 +70,9 @@ test('validating an unsuccessfull response with undefined error should fail', as expect(() => validateResponse(call, axiosRes(res))).toThrow() }) -test('validating a successfull response with unknown keys should pass', async () => { +test('validating a successful response with unknown keys should pass', async () => { // arrange - const res = { success: true } + const res = { success: true } // act && assert const responses = augmentWithExtraKey(res) @@ -81,7 +81,7 @@ test('validating a successfull response with unknown keys should pass', async () }) }) -test('validating an unsuccessfull response with unknown keys should pass', async () => { +test('validating an unsuccessful response with unknown keys should pass', async () => { // arrange const res = { success: false, error } diff --git a/packages/lang-client/src/validation.ts b/packages/lang-client/src/validation.ts index f409017a..206934a1 100644 --- a/packages/lang-client/src/validation.ts +++ b/packages/lang-client/src/validation.ts @@ -1,7 +1,7 @@ import { AxiosResponse } from 'axios' import Joi from 'joi' import _ from 'lodash' -import { SuccessReponse, ErrorResponse } from './typings' +import { SuccessResponse, ErrorResponse } from './typings' const ERROR_RESPONSE_SCHEMA = Joi.object().keys({ message: Joi.string().required().allow(''), @@ -13,19 +13,19 @@ const ERROR_RESPONSE_SCHEMA = Joi.object().keys({ export type HTTPVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' export type HTTPCall = { verb: V - ressource: string + resource: string } export class ClientResponseError extends Error { constructor(call: HTTPCall, status: number, message: string) { - const { verb, ressource } = call - const ressourcePath = `lang-server/${ressource}` - const prefix = status >= 300 ? `${verb} ${ressourcePath} -> ${status}` : `${verb} ${ressourcePath}` + const { verb, resource } = call + const resourcePath = `lang-server/${resource}` + const prefix = status >= 300 ? `${verb} ${resourcePath} -> ${status}` : `${verb} ${resourcePath}` super(`(${prefix}) ${message}`) } } -export const validateResponse = ( +export const validateResponse = ( call: HTTPCall, res: AxiosResponse ): S | ErrorResponse => { @@ -54,7 +54,7 @@ export const validateResponse = ( throw new ClientResponseError( call, status, - 'Received unsuccessfull HTTP response with no error. Expected response.error to be an object.' + 'Received unsuccessful HTTP response with no error. Expected response.error to be an object.' ) } Joi.assert(error, ERROR_RESPONSE_SCHEMA) diff --git a/packages/lang-server/readme.md b/packages/lang-server/readme.md index ce6ff1b9..ab3f782d 100644 --- a/packages/lang-server/readme.md +++ b/packages/lang-server/readme.md @@ -6,4 +6,4 @@ It is a web server responsible for hosting domain agnostic NLP models. These inc ## Licensing -This software is protected by the same license as the [main Botpress repository](https://github.com/botpress/botpress). You can find the license file [here](https://github.com/botpress/botpress/blob/master/LICENSE). +This software is protected by the same [license](https://github.com/botpress/botpress/blob/master/LICENSE) as the [main Botpress repository](https://github.com/botpress/botpress). diff --git a/packages/lang-server/src/api/index.ts b/packages/lang-server/src/api/index.ts index 19d88515..4602e28b 100644 --- a/packages/lang-server/src/api/index.ts +++ b/packages/lang-server/src/api/index.ts @@ -4,7 +4,7 @@ import { VectorizeResponseBody, LanguagesResponseBody, DownloadLangResponseBody, - SuccessReponse + SuccessResponse } from '@botpress/lang-client' import { prometheus } from '@botpress/telemetry' import { Logger } from '@bpinternal/log4bot' @@ -23,7 +23,7 @@ import ms from 'ms' import { LangApplication } from '../application' import { monitoringMiddleware, startMonitoring } from './monitoring' -import { authMiddleware } from './mw-authentification' +import { authMiddleware } from './mw-authentication' import { handleUnexpectedError } from './mw-handle-error' import { serviceLoadingMiddleware } from './mw-service-loading' import { validateTokenizeRequestBody, validateVectorizeRequestBody } from './validation/body' @@ -48,7 +48,7 @@ const createExpressApp = async (options: APIOptions, baseLogger: Logger): Promis const app = express() const requestLogger = baseLogger.sub('api').sub('request') - // This must be first, otherwise the /info endpoint can't be called when token is used + // This must be first; otherwise, the /info endpoint can't be called when token is used app.use(cors()) if (options.prometheusEnabled) { @@ -185,7 +185,7 @@ export default async function (options: APIOptions, baseLogger: Logger, applicat try { const { lang } = req.params application.deleteLang(lang) - const response: SuccessReponse = { success: true } + const response: SuccessResponse = { success: true } return res.json(response) } catch (err) { return next(err) @@ -196,7 +196,7 @@ export default async function (options: APIOptions, baseLogger: Logger, applicat try { const { lang } = req.params await application.loadLang(lang) - const response: SuccessReponse = { success: true } + const response: SuccessResponse = { success: true } return res.json(response) } catch (err) { return next(err) @@ -207,7 +207,7 @@ export default async function (options: APIOptions, baseLogger: Logger, applicat try { const { id } = req.params application.cancelDownloadLang(id) - const response: SuccessReponse = { success: true } + const response: SuccessResponse = { success: true } return res.json(response) } catch (err) { return next(err) diff --git a/packages/lang-server/src/api/mw-authentification.ts b/packages/lang-server/src/api/mw-authentication.ts similarity index 100% rename from packages/lang-server/src/api/mw-authentification.ts rename to packages/lang-server/src/api/mw-authentication.ts diff --git a/packages/lang-server/src/application/download-manager.ts b/packages/lang-server/src/application/download-manager.ts index 708f278b..4ab5a2d9 100644 --- a/packages/lang-server/src/application/download-manager.ts +++ b/packages/lang-server/src/application/download-manager.ts @@ -163,7 +163,7 @@ export default class DownloadManager { public async download(lang: string): Promise { if (!this.downloadableLanguages.find((l) => lang === l.code)) { - throw new Error(`Could not find model of dimention "${this.dim}" in domain "${this.domain}" for lang "${lang}"`) + throw new Error(`Could not find model of dimension "${this.dim}" in domain "${this.domain}" for lang "${lang}"`) } const embedding = this._getEmbeddingModel(lang) diff --git a/packages/lang-server/src/application/index.ts b/packages/lang-server/src/application/index.ts index eefd05d8..24ee1340 100644 --- a/packages/lang-server/src/application/index.ts +++ b/packages/lang-server/src/application/index.ts @@ -33,7 +33,7 @@ export class LangApplication { return { version: this.options.version, ready: this.languageService.isReady, - dimentions: this.languageService.dim, + dimensions: this.languageService.dim, domain: this.languageService.domain, readOnly: !this._isAdminToken(authHeader) } diff --git a/packages/lang-server/src/application/model-download.ts b/packages/lang-server/src/application/model-download.ts index 50b52a9d..ad5bacc6 100644 --- a/packages/lang-server/src/application/model-download.ts +++ b/packages/lang-server/src/application/model-download.ts @@ -32,7 +32,7 @@ export default class ModelDownload { private currentModel = 0 - constructor(private models: DownloadableModel[], public readonly destDir: string, private _dowloadLogger: Logger) { + constructor(private models: DownloadableModel[], public readonly destDir: string, private _downloadLogger: Logger) { this.lang = models[0].language } @@ -71,7 +71,7 @@ export default class ModelDownload { private async _downloadNext() { const modelToDownload = this.models[this.currentModel] as DownloadableModel - this._dowloadLogger.debug(`Started to download ${modelToDownload.language} ${modelToDownload.type} model`) + this._downloadLogger.debug(`Started to download ${modelToDownload.language} ${modelToDownload.type} model`) const { data, headers } = await axios.get(modelToDownload.remoteUrl, { responseType: 'stream', @@ -86,7 +86,7 @@ export default class ModelDownload { stream.pipe(fse.createWriteStream(tmpPath)) stream.on('error', (err) => { - this._dowloadLogger.error('model download failed', { lang: modelToDownload.language, error: err.message }) + this._downloadLogger.error('model download failed', { lang: modelToDownload.language, error: err.message }) this.status = 'errored' this.message = 'Error: ' + err.message }) @@ -140,21 +140,21 @@ export default class ModelDownload { fse.unlinkSync(tmpPath) } - this._dowloadLogger.debug('deleting model %o', { path: tmpPath, type: model.type, lang: model.language }) + this._downloadLogger.debug('deleting model %o', { path: tmpPath, type: model.type, lang: model.language }) } private async _makeModelAvailable(model: DownloadableModel) { const filePath = this.getFilePath(model) as string const tmpPath = `${filePath}.tmp` if (fse.existsSync(filePath)) { - this._dowloadLogger.debug('removing existing model at %s', filePath) + this._downloadLogger.debug('removing existing model at %s', filePath) fse.unlinkSync(filePath) } try { await Bluebird.fromCallback((cb) => fse.rename(tmpPath, filePath, cb)) } catch (err) { - this._dowloadLogger.debug('could not rename downloaded file %s', filePath) + this._downloadLogger.debug('could not rename downloaded file %s', filePath) await Bluebird.fromCallback((cb) => fse.move(tmpPath, filePath, cb)) } } diff --git a/packages/nlu-bench/src/index.ts b/packages/nlu-bench/src/index.ts index c3a63b72..a4b2f33a 100644 --- a/packages/nlu-bench/src/index.ts +++ b/packages/nlu-bench/src/index.ts @@ -128,7 +128,7 @@ yargs main(argv) .then(() => {}) .catch((err) => { - console.error(chalk.red('The following error occured:\n'), err) + console.error(chalk.red('The following error occurred:\n'), err) process.exit(1) }) } diff --git a/packages/nlu-bench/src/tests/bpds-slots.ts b/packages/nlu-bench/src/tests/bpds-slots.ts index 0159b61c..13f0862f 100644 --- a/packages/nlu-bench/src/tests/bpds-slots.ts +++ b/packages/nlu-bench/src/tests/bpds-slots.ts @@ -23,11 +23,11 @@ const problemMaker = (_bitfan: typeof bitfan) => async (topic: string): Promise< } export default function (_bitfan: typeof bitfan, args: Args) { - const avgStrictSlotAccuray = _bitfan.metrics.averageScore(_bitfan.criterias.slotsAre) - const avgLooseSlotAccuray = _bitfan.metrics.averageScore(_bitfan.criterias.slotIncludes) - const avgSlotCountAccuray = _bitfan.metrics.averageScore(_bitfan.criterias.slotCountIs) + const avgStrictSlotAccuracy = _bitfan.metrics.averageScore(_bitfan.criterias.slotsAre) + const avgLooseSlotAccuracy = _bitfan.metrics.averageScore(_bitfan.criterias.slotIncludes) + const avgSlotCountAccuracy = _bitfan.metrics.averageScore(_bitfan.criterias.slotCountIs) - const metrics = [avgStrictSlotAccuray, avgLooseSlotAccuray, avgSlotCountAccuray] + const metrics = [avgStrictSlotAccuracy, avgLooseSlotAccuracy, avgSlotCountAccuracy] return { name: 'bpds-slots', @@ -69,9 +69,9 @@ export default function (_bitfan: typeof bitfan, args: Args) { evaluatePerformance: (currentPerformance, previousPerformance) => { const toleranceByMetric = { - [avgStrictSlotAccuray.name]: 0.02, - [avgLooseSlotAccuray.name]: 0.02, - [avgSlotCountAccuray.name]: 0.02 + [avgStrictSlotAccuracy.name]: 0.02, + [avgLooseSlotAccuracy.name]: 0.02, + [avgSlotCountAccuracy.name]: 0.02 } return _bitfan.comparePerformances(currentPerformance, previousPerformance, { toleranceByMetric }) } diff --git a/packages/nlu-bin/readme.md b/packages/nlu-bin/readme.md index 12735bf0..a45b643d 100644 --- a/packages/nlu-bin/readme.md +++ b/packages/nlu-bin/readme.md @@ -15,11 +15,11 @@ your/nlu/exe │ └── --version # display nlu-server version └── lang ├── start (default) # launch the lang server - ├── download # download languange models + ├── download # download language models ├── init # create empty configuration file for lang-server └── --version # display lang-server version ``` ## Licensing -This software is protected by the same license as the [main Botpress repository](https://github.com/botpress/botpress). You can find the license file [here](https://github.com/botpress/botpress/blob/master/LICENSE). +This software is protected by the same [license](https://github.com/botpress/botpress/blob/master/LICENSE) as the [main Botpress repository](https://github.com/botpress/botpress). diff --git a/packages/nlu-bin/src/index.ts b/packages/nlu-bin/src/index.ts index e9186a8a..8c3044aa 100644 --- a/packages/nlu-bin/src/index.ts +++ b/packages/nlu-bin/src/index.ts @@ -44,7 +44,7 @@ void yargs argv = { ...parseEnv(nluServerParameters), ...argv } void runNLUServer(argv).catch((err) => { - nluLogger.sub('Exit').attachError(err).critical('NLU Server exits after an error occured.') + nluLogger.sub('Exit').attachError(err).critical('NLU Server exits after an error occurred.') process.exit(1) }) } @@ -60,7 +60,7 @@ void yargs }, force: { alias: 'f', - description: 'Weither or not to override current file.', + description: 'Whether or not to override current file.', type: 'boolean' } }, @@ -117,7 +117,7 @@ void yargs argv = { ...parseEnv(langServerParameters), ...argv } void runLanguageServer(argv).catch((err) => { - langLogger.sub('Exit').attachError(err).critical('Language Server exits after an error occured.') + langLogger.sub('Exit').attachError(err).critical('Language Server exits after an error occurred.') process.exit(1) }) } @@ -133,7 +133,7 @@ void yargs }, force: { alias: 'f', - description: 'Weither or not to override current file.', + description: 'Whether or not to override current file.', type: 'boolean' } }, @@ -158,7 +158,7 @@ void yargs .command('download', 'Download a language model for lang and dim', langDownloadParameters, (argv) => { argv = { ...parseEnv(langDownloadParameters), ...argv } void downloadLang(argv).catch((err) => { - langLogger.sub('Exit').attachError(err).critical('Language Server exits after an error occured.') + langLogger.sub('Exit').attachError(err).critical('Language Server exits after an error occurred.') process.exit(1) }) }) diff --git a/packages/nlu-bin/src/parameters/lang-server.ts b/packages/nlu-bin/src/parameters/lang-server.ts index b3c85791..db87b73e 100644 --- a/packages/nlu-bin/src/parameters/lang-server.ts +++ b/packages/nlu-bin/src/parameters/lang-server.ts @@ -63,7 +63,7 @@ export const parameters = asYargs({ choices: logLevelChoices }, logFormat: { - description: 'Weither to log using JSON or good old fashion formatted text with colors.', + description: 'Whether to log using JSON or good old fashion formatted text with colors.', choices: logFormatChoices }, debugFilter: { diff --git a/packages/nlu-bin/src/parameters/nlu-server.ts b/packages/nlu-bin/src/parameters/nlu-server.ts index 1102537b..cae44fbf 100644 --- a/packages/nlu-bin/src/parameters/nlu-server.ts +++ b/packages/nlu-bin/src/parameters/nlu-server.ts @@ -47,7 +47,7 @@ export const parameters = asYargs({ type: 'boolean' }, prometheusEnabled: { - description: 'When enabled, a prometheus endpoint will be avaiable at /metrics', + description: 'When enabled, a prometheus endpoint will be available at /metrics', type: 'boolean' }, apmEnabled: { @@ -88,7 +88,7 @@ export const parameters = asYargs({ choices: logLevelChoices }, logFormat: { - description: 'Weither to log using JSON or good old fashion formatted text with colors.', + description: 'Whether to log using JSON or good old fashion formatted text with colors.', choices: logFormatChoices }, debugFilter: { @@ -108,7 +108,7 @@ export const parameters = asYargs({ type: 'string' }, modelTransferEnabled: { - description: 'Weither or not to allow model weights download / upload', + description: 'Whether or not to allow model weights download / upload', type: 'boolean' } }) diff --git a/packages/nlu-client/readme.md b/packages/nlu-client/readme.md index dfbf6276..7f1e828c 100644 --- a/packages/nlu-client/readme.md +++ b/packages/nlu-client/readme.md @@ -77,7 +77,7 @@ void main() ### model weights upload and download -The `/modelweights` ressource has a slightly different behavior than the rest of the API. It communicates with binary buffers instead of JSON. +The `/modelweights` resource has a slightly different behavior than the rest of the API. It communicates with binary buffers instead of JSON. ```ts import { Client } from '@botpress/nlu-client' diff --git a/packages/nlu-client/src/error.ts b/packages/nlu-client/src/error.ts index 40b5fe91..31a84a5c 100644 --- a/packages/nlu-client/src/error.ts +++ b/packages/nlu-client/src/error.ts @@ -2,9 +2,9 @@ import { HTTPCall, HTTPVerb } from './http-call' export class ClientResponseError extends Error { constructor(call: HTTPCall, status: number, message: string) { - const { verb, ressource } = call - const ressourcePath = `/${ressource}` - const prefix = `${verb} ${ressourcePath} -> ${status}` + const { verb, resource } = call + const resourcePath = `/${resource}` + const prefix = `${verb} ${resourcePath} -> ${status}` super(`(${prefix}) ${message}`) } } diff --git a/packages/nlu-client/src/http-call.ts b/packages/nlu-client/src/http-call.ts index 445e1705..33b18ea9 100644 --- a/packages/nlu-client/src/http-call.ts +++ b/packages/nlu-client/src/http-call.ts @@ -1,5 +1,5 @@ export type HTTPVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' export type HTTPCall = { verb: V - ressource: string + resource: string } diff --git a/packages/nlu-client/src/model-client.ts b/packages/nlu-client/src/model-client.ts index 8769a5ce..0937e97a 100644 --- a/packages/nlu-client/src/model-client.ts +++ b/packages/nlu-client/src/model-client.ts @@ -7,7 +7,7 @@ import { ClientResponseError } from './error' import { HTTPCall } from './http-call' type GET_WEIGHTS_STATUS = 'OK' | 'WEIGHTS_TRANSFER_DISABLED' | 'MODEL_NOT_FOUND' -type POST_WEIGHTS_STATUS = 'OK' | 'WEIGHTS_TRANSFER_DISABLED' | 'INVALID_MODEL_FORMAT' | 'UNSUPORTED_MODEL_SPEC' +type POST_WEIGHTS_STATUS = 'OK' | 'WEIGHTS_TRANSFER_DISABLED' | 'INVALID_MODEL_FORMAT' | 'UNSUPPORTED_MODEL_SPEC' const get_status_meanings: Record = { OK: 200, @@ -19,7 +19,7 @@ const post_status_meanings: Record = { OK: 200, INVALID_MODEL_FORMAT: 400, WEIGHTS_TRANSFER_DISABLED: 403, - UNSUPORTED_MODEL_SPEC: 455 // custom unassigned status code + UNSUPPORTED_MODEL_SPEC: 455 // custom unassigned status code } type GetWeightRes = S extends 'OK' @@ -47,20 +47,20 @@ export class ModelTransferClient { } public async upload(appId: string, weights: Buffer): Promise { - const ressource = 'modelweights' + const resource = 'modelweights' const reqHeaders = { ...appIdHeader(appId), 'content-type': 'application/octet-stream', 'content-length': weights.length } - const { status } = await this.axios.post(ressource, weights, { + const { status } = await this.axios.post(resource, weights, { headers: reqHeaders, maxContentLength: Infinity, maxBodyLength: Infinity }) - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const call: HTTPCall<'POST'> = { verb: 'POST', resource } if (status >= 500) { throw new ClientResponseError(call, status, 'Internal Server Error') @@ -89,13 +89,13 @@ export class ModelTransferClient { modelId: string, opts: { responseType: 'stream' | 'arraybuffer' } ): Promise> { - const ressource = `modelweights/${modelId}` + const resource = `modelweights/${modelId}` const { responseType } = opts const reqHeaders = appIdHeader(appId) - const { data, status } = await this.axios.get(ressource, { headers: reqHeaders, responseType }) + const { data, status } = await this.axios.get(resource, { headers: reqHeaders, responseType }) - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const call: HTTPCall<'GET'> = { verb: 'GET', resource } if (status >= 500) { throw new ClientResponseError(call, status, 'Internal Server Error') } diff --git a/packages/nlu-client/src/nlu-client.ts b/packages/nlu-client/src/nlu-client.ts index 49d52ed8..21c5237f 100644 --- a/packages/nlu-client/src/nlu-client.ts +++ b/packages/nlu-client/src/nlu-client.ts @@ -10,7 +10,7 @@ import { TrainRequestBody, InfoResponseBody, TrainProgressResponseBody, - SuccessReponse, + SuccessResponse, DetectLangRequestBody, DetectLangResponseBody, ListModelsResponseBody, @@ -41,16 +41,16 @@ export class NLUClient { } public async getInfo(): Promise { - const ressource = 'info' - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const resource = 'info' + const call: HTTPCall<'GET'> = { verb: 'GET', resource } const res = await this._get(call) return validateResponse(call, res) } public async startTraining(appId: string, body: TrainRequestBody): Promise { const headers = appIdHeader(appId) - const ressource = 'train' - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = 'train' + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, body, { headers }) return validateResponse(call, res) } @@ -60,16 +60,16 @@ export class NLUClient { */ public async startLinting(appId: string, body: LintRequestBody): Promise { const headers = appIdHeader(appId) - const ressource = 'lint' - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = 'lint' + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, body, { headers }) return validateResponse(call, res) } public async listTrainings(appId: string, lang?: string): Promise { const headers = appIdHeader(appId) - const ressource = 'train' - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const resource = 'train' + const call: HTTPCall<'GET'> = { verb: 'GET', resource } const params = lang && { lang } const res = await this._get(call, { headers, params }) return validateResponse(call, res) @@ -77,8 +77,8 @@ export class NLUClient { public async getTrainingStatus(appId: string, modelId: string): Promise { const headers = appIdHeader(appId) - const ressource = `train/${modelId}` - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const resource = `train/${modelId}` + const call: HTTPCall<'GET'> = { verb: 'GET', resource } const res = await this._get(call, { headers }) return validateResponse(call, res) } @@ -92,18 +92,18 @@ export class NLUClient { speed: IssueComputationSpeed ): Promise { const headers = appIdHeader(appId) - const ressource = `lint/${modelId}/${speed}` - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const resource = `lint/${modelId}/${speed}` + const call: HTTPCall<'GET'> = { verb: 'GET', resource } const res = await this._get(call, { headers }) return validateResponse(call, res) } - public async cancelTraining(appId: string, modelId: string): Promise { + public async cancelTraining(appId: string, modelId: string): Promise { const headers = appIdHeader(appId) - const ressource = `train/${modelId}/cancel` - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = `train/${modelId}/cancel` + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, {}, { headers }) - return validateResponse(call, res) + return validateResponse(call, res) } /** @@ -113,26 +113,26 @@ export class NLUClient { appId: string, modelId: string, speed: IssueComputationSpeed - ): Promise { + ): Promise { const headers = appIdHeader(appId) - const ressource = `lint/${modelId}/${speed}/cancel` - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = `lint/${modelId}/${speed}/cancel` + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, {}, { headers }) - return validateResponse(call, res) + return validateResponse(call, res) } public async listModels(appId: string): Promise { const headers = appIdHeader(appId) - const ressource = 'models' - const call: HTTPCall<'GET'> = { verb: 'GET', ressource } + const resource = 'models' + const call: HTTPCall<'GET'> = { verb: 'GET', resource } const res = await this._get(call, { headers }) return validateResponse(call, res) } public async pruneModels(appId: string): Promise { const headers = appIdHeader(appId) - const ressource = 'models/prune' - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = 'models/prune' + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, {}, { headers }) return validateResponse(call, res) } @@ -142,8 +142,8 @@ export class NLUClient { body: DetectLangRequestBody ): Promise { const headers = appIdHeader(appId) - const ressource = 'detect-lang' - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = 'detect-lang' + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, body, { headers }) return validateResponse(call, res) } @@ -154,8 +154,8 @@ export class NLUClient { body: PredictRequestBody ): Promise { const headers = appIdHeader(appId) - const ressource = `predict/${modelId}` - const call: HTTPCall<'POST'> = { verb: 'POST', ressource } + const resource = `predict/${modelId}` + const call: HTTPCall<'POST'> = { verb: 'POST', resource } const res = await this._post(call, body, { headers }) return validateResponse(call, res) } @@ -166,8 +166,8 @@ export class NLUClient { config?: AxiosRequestConfig ): Promise> => { try { - const { ressource } = call - const res = await this._axios.post(ressource, body, config) + const { resource } = call + const res = await this._axios.post(resource, body, config) return res } catch (err) { // axios validate status does not prevent all exceptions @@ -177,8 +177,8 @@ export class NLUClient { private _get = async (call: HTTPCall<'GET'>, config?: AxiosRequestConfig): Promise> => { try { - const { ressource } = call - const res = await this._axios.get(ressource, config) + const { resource } = call + const res = await this._axios.get(resource, config) return res } catch (err) { // axios validate status does not prevent all exceptions diff --git a/packages/nlu-client/src/typings/http.ts b/packages/nlu-client/src/typings/http.ts index 97f47ec5..ef0713ab 100644 --- a/packages/nlu-client/src/typings/http.ts +++ b/packages/nlu-client/src/typings/http.ts @@ -56,46 +56,46 @@ export type ErrorResponse = { error: NLUError } -export type SuccessReponse = { +export type SuccessResponse = { success: true } export type InfoResponseBody = { info: ServerInfo -} & SuccessReponse +} & SuccessResponse export type TrainResponseBody = { modelId: string -} & SuccessReponse +} & SuccessResponse export type LintResponseBody = { modelId: string -} & SuccessReponse +} & SuccessResponse export type TrainProgressResponseBody = { session: TrainingState -} & SuccessReponse +} & SuccessResponse export type LintProgressResponseBody = { session: LintingState -} & SuccessReponse +} & SuccessResponse export type ListTrainingsResponseBody = { trainings: Training[] -} & SuccessReponse +} & SuccessResponse export type ListModelsResponseBody = { models: string[] -} & SuccessReponse +} & SuccessResponse export type PruneModelsResponseBody = { models: string[] -} & SuccessReponse +} & SuccessResponse export type PredictResponseBody = { predictions: PredictOutput[] -} & SuccessReponse +} & SuccessResponse export type DetectLangResponseBody = { detectedLanguages: string[] -} & SuccessReponse +} & SuccessResponse diff --git a/packages/nlu-client/src/typings/linting.ts b/packages/nlu-client/src/typings/linting.ts index 365b8b98..17f5f402 100644 --- a/packages/nlu-client/src/typings/linting.ts +++ b/packages/nlu-client/src/typings/linting.ts @@ -12,7 +12,7 @@ export type IssueCode = | 'E_002' // duplicated utterances (in one or more intents) | 'E_003' // the whole utterance is tagged as a slot | 'W_000' // intents are overlapping - | 'I_000' // utterance contains dupplicated or untrimed spaces + | 'I_000' // utterance contains duplicated or untrimmed spaces export type Raw = { raw: T } export type Clean = { clean: T } @@ -106,12 +106,12 @@ export type LintingState = { export type IssueComputationSpeed = 'fastest' | 'fast' | 'slow' | 'slowest' -export type IssueSeverity = C extends `C_${infer CodeSufix}` +export type IssueSeverity = C extends `C_${infer CodeSuffix}` ? 'critical' - : C extends `E_${infer CodeSufix}` + : C extends `E_${infer CodeSuffix}` ? 'error' - : C extends `W_${infer CodeSufix}` + : C extends `W_${infer CodeSuffix}` ? 'warning' - : C extends `I_${infer CodeSufix}` + : C extends `I_${infer CodeSuffix}` ? 'info' : never diff --git a/packages/nlu-client/src/typings/training.ts b/packages/nlu-client/src/typings/training.ts index a7b711b2..9880e96b 100644 --- a/packages/nlu-client/src/typings/training.ts +++ b/packages/nlu-client/src/typings/training.ts @@ -43,7 +43,7 @@ export type EntityDefinition = ListEntityDefinition | PatternEntityDefinition * training-pending : when a training was launched, but the training process is not started yet * training: when a chatbot is currently training * canceled: when a training was canceled - * errored: when an unhandled error occured during training + * errored: when an unhandled error occurred during training */ export type TrainingStatus = 'done' | 'training-pending' | 'training' | 'canceled' | 'errored' diff --git a/packages/nlu-client/src/validation.test.ts b/packages/nlu-client/src/validation.test.ts index b6f0f65d..f830c228 100644 --- a/packages/nlu-client/src/validation.test.ts +++ b/packages/nlu-client/src/validation.test.ts @@ -1,6 +1,6 @@ import { AxiosResponse } from 'axios' import { HTTPCall } from './http-call' -import { SuccessReponse, ErrorResponse, NLUError } from './typings/http' +import { SuccessResponse, ErrorResponse, NLUError } from './typings/http' import { validateResponse } from './validation' const augmentWithExtraKey = (res: Object) => { @@ -16,7 +16,7 @@ const augmentWithExtraKey = (res: Object) => { } const error: NLUError = { code: 500, type: 'internal', message: 'An error' } -const call: HTTPCall<'GET'> = { verb: 'GET', ressource: '' } +const call: HTTPCall<'GET'> = { verb: 'GET', resource: '' } const axiosRes = (data: any): AxiosResponse => { const x: Partial> = { data, status: 200 } @@ -29,15 +29,15 @@ test('validating with absent success key should fail', async () => { expect(() => validateResponse(call, axiosRes({ someKey: 'some text' }))).toThrow() }) -test('validating a successfull response should pass', async () => { +test('validating a successful response should pass', async () => { // arrange - const res: SuccessReponse = { success: true } + const res: SuccessResponse = { success: true } // act && assert expect(() => validateResponse(call, axiosRes(res))).not.toThrow() }) -test('validating an unsuccessfull response with unempty error should pass', async () => { +test('validating an unsuccessful response with unempty error should pass', async () => { // arrange const res: ErrorResponse = { success: false, error } @@ -45,7 +45,7 @@ test('validating an unsuccessfull response with unempty error should pass', asyn expect(() => validateResponse(call, axiosRes(res))).not.toThrow() }) -test('validating an unsuccessfull response with empty error message should pass', async () => { +test('validating an unsuccessful response with empty error message should pass', async () => { const error: NLUError = { message: '', code: 500, type: 'internal' } // arrange @@ -55,7 +55,7 @@ test('validating an unsuccessfull response with empty error message should pass' expect(() => validateResponse(call, axiosRes(res))).not.toThrow() }) -test('validating an unsuccessfull response with empty error should fail', async () => { +test('validating an unsuccessful response with empty error should fail', async () => { // arrange const res: ErrorResponse = { success: false, error: {} as NLUError } @@ -63,7 +63,7 @@ test('validating an unsuccessfull response with empty error should fail', async expect(() => validateResponse(call, axiosRes(res))).toThrow() }) -test('validating an unsuccessfull response with undefined error should fail', async () => { +test('validating an unsuccessful response with undefined error should fail', async () => { // arrange const res: Partial = { success: false } @@ -71,9 +71,9 @@ test('validating an unsuccessfull response with undefined error should fail', as expect(() => validateResponse(call, axiosRes(res))).toThrow() }) -test('validating a successfull response with unknown keys should pass', async () => { +test('validating a successful response with unknown keys should pass', async () => { // arrange - const res = { success: true } + const res = { success: true } // act && assert const responses = augmentWithExtraKey(res) @@ -82,7 +82,7 @@ test('validating a successfull response with unknown keys should pass', async () }) }) -test('validating an unsuccessfull response with unknown keys should pass', async () => { +test('validating an unsuccessful response with unknown keys should pass', async () => { // arrange const res = { success: false, error } diff --git a/packages/nlu-client/src/validation.ts b/packages/nlu-client/src/validation.ts index 5470c2a5..bab891e5 100644 --- a/packages/nlu-client/src/validation.ts +++ b/packages/nlu-client/src/validation.ts @@ -3,7 +3,7 @@ import Joi from 'joi' import _ from 'lodash' import { ClientResponseError } from './error' import { HTTPCall, HTTPVerb } from './http-call' -import { SuccessReponse, ErrorResponse } from './typings/http' +import { SuccessResponse, ErrorResponse } from './typings/http' const ERROR_RESPONSE_SCHEMA = Joi.object().keys({ message: Joi.string().required().allow(''), @@ -13,7 +13,7 @@ const ERROR_RESPONSE_SCHEMA = Joi.object().keys({ }) /** Manual validation for clean error messages */ -export const validateResponse = ( +export const validateResponse = ( call: HTTPCall, res: AxiosResponse ): S | ErrorResponse => { @@ -42,7 +42,7 @@ export const validateResponse = ( throw new ClientResponseError( call, status, - 'Received unsuccessfull HTTP response with no error. Expected response.error to be an object.' + 'Received unsuccessful HTTP response with no error. Expected response.error to be an object.' ) } diff --git a/packages/nlu-e2e/src/assertions.ts b/packages/nlu-e2e/src/assertions.ts index 92415a89..efd6df23 100644 --- a/packages/nlu-e2e/src/assertions.ts +++ b/packages/nlu-e2e/src/assertions.ts @@ -16,7 +16,7 @@ import fs from 'fs' import _ from 'lodash' import ms from 'ms' import semver from 'semver' -import { PrecondtionFailed, UnsuccessfullAPICall, UnsuccessfullModelTransfer } from './errors' +import { PrecondtionFailed, UnsuccessfulAPICall, UnsuccessfulModelTransfer } from './errors' import { AssertionArgs } from './typings' import { pollLintingUntil, pollTrainingUntil } from './utils' @@ -26,7 +26,7 @@ export const assertServerIsReachable = async (args: AssertionArgs, requiredLangu const infoRes = await client.getInfo() if (!infoRes.success) { - throw new UnsuccessfullAPICall(infoRes.error, 'Make sure the NLU Server is reachable.') + throw new UnsuccessfulAPICall(infoRes.error, 'Make sure the NLU Server is reachable.') } const { info } = infoRes @@ -43,7 +43,7 @@ export const assertModelTransferIsEnabled = async (args: AssertionArgs) => { const infoRes = await client.getInfo() if (!infoRes.success) { - throw new UnsuccessfullAPICall(infoRes.error, 'Make sure the NLU Server is reachable.') + throw new UnsuccessfulAPICall(infoRes.error, 'Make sure the NLU Server is reachable.') } const { info } = infoRes @@ -58,7 +58,7 @@ export const assertModelsInclude = async (args: AssertionArgs, expectedModels: s const modelRes = await client.listModels(appId) if (!modelRes.success) { - throw new UnsuccessfullAPICall(modelRes.error) + throw new UnsuccessfulAPICall(modelRes.error) } const { models } = modelRes @@ -71,7 +71,7 @@ export const assertModelsAreEmpty = async (args: AssertionArgs) => { const modelRes = await client.listModels(appId) if (!modelRes.success) { - throw new UnsuccessfullAPICall(modelRes.error) + throw new UnsuccessfulAPICall(modelRes.error) } const { models } = modelRes @@ -91,7 +91,7 @@ export const assertTrainingStarts = async (args: AssertionArgs, trainSet: TrainI const contexts = _getContexts(trainSet) const trainRes = await client.startTraining(appId, { ...trainSet, contexts }) if (!trainRes.success) { - throw new UnsuccessfullAPICall(trainRes.error) + throw new UnsuccessfulAPICall(trainRes.error) } const { modelId } = trainRes @@ -122,7 +122,7 @@ export const assertLintingStarts = async ( const contexts = _getContexts(trainSet) const trainRes = await client.startLinting(appId, { ...trainSet, contexts, speed }) if (!trainRes.success) { - throw new UnsuccessfullAPICall(trainRes.error) + throw new UnsuccessfulAPICall(trainRes.error) } const { modelId } = trainRes @@ -155,7 +155,7 @@ export const assertTrainingFails = async ( const contexts = _getContexts(trainSet) const trainRes = await client.startTraining(appId, { ...trainSet, contexts }) if (!trainRes.success) { - throw new UnsuccessfullAPICall(trainRes.error) + throw new UnsuccessfulAPICall(trainRes.error) } const { modelId } = trainRes @@ -215,7 +215,7 @@ export const assertTrainingCancels = async (args: AssertionArgs, modelId: string const cancelRes = await client.cancelTraining(appId, modelId) if (!cancelRes.success) { - throw new UnsuccessfullAPICall(cancelRes.error) + throw new UnsuccessfulAPICall(cancelRes.error) } const ts = await pollTrainingUntil({ @@ -298,7 +298,7 @@ export const assertTrainingsAre = async (args: AssertionArgs, expectedTrainings: const lsTrainingRes = await client.listTrainings(appId) if (!lsTrainingRes.success) { - throw new UnsuccessfullAPICall(lsTrainingRes.error) + throw new UnsuccessfulAPICall(lsTrainingRes.error) } const { trainings } = lsTrainingRes const trainStatuses = trainings.map((ts) => ts.status) @@ -328,7 +328,7 @@ export const assertLanguageDetectionWorks = async (args: AssertionArgs, utteranc const detectLangRes = await client.detectLanguage(appId, { utterances: [utterance], models: [] }) if (!detectLangRes.success) { - throw new UnsuccessfullAPICall(detectLangRes.error) + throw new UnsuccessfulAPICall(detectLangRes.error) } const { detectedLanguages } = detectLangRes chai.expect(detectedLanguages).to.have.length(1) @@ -346,7 +346,7 @@ export const assertIntentPredictionWorks = async ( const predictRes = await client.predict(appId, modelId, { utterances: [utterance] }) if (!predictRes.success) { - throw new UnsuccessfullAPICall(predictRes.error) + throw new UnsuccessfulAPICall(predictRes.error) } const { predictions } = predictRes chai.expect(predictions).to.have.length(1) @@ -364,12 +364,12 @@ export const assertModelsPrune = async (args: AssertionArgs) => { const pruneRes = await client.pruneModels(appId) if (!pruneRes.success) { - throw new UnsuccessfullAPICall(pruneRes.error) + throw new UnsuccessfulAPICall(pruneRes.error) } const modelRes = await client.listModels(appId) if (!modelRes.success) { - throw new UnsuccessfullAPICall(modelRes.error) + throw new UnsuccessfulAPICall(modelRes.error) } const { models } = modelRes @@ -395,7 +395,7 @@ export const assertModelWeightsDownload = async (args: AssertionArgs, modelId: s const downloadRes = await client.modelWeights.download(appId, modelId, { responseType: 'stream' }) if (downloadRes.status !== 'OK') { - throw new UnsuccessfullModelTransfer(downloadRes.status, 'GET') + throw new UnsuccessfulModelTransfer(downloadRes.status, 'GET') } await new Promise((resolve, reject) => { @@ -432,6 +432,6 @@ export const assertModelWeightsUpload = async (args: AssertionArgs, fileLocation const uploadRes = await client.modelWeights.upload(appId, modelWeights) if (uploadRes.status !== 'OK') { - throw new UnsuccessfullModelTransfer(uploadRes.status, 'GET') + throw new UnsuccessfulModelTransfer(uploadRes.status, 'GET') } } diff --git a/packages/nlu-e2e/src/errors.ts b/packages/nlu-e2e/src/errors.ts index a1e316c9..992ba4cc 100644 --- a/packages/nlu-e2e/src/errors.ts +++ b/packages/nlu-e2e/src/errors.ts @@ -1,13 +1,13 @@ import { http } from '@botpress/nlu-client' -export class UnsuccessfullAPICall extends Error { +export class UnsuccessfulAPICall extends Error { constructor(nluError: http.NLUError, hint?: string) { const { message } = nluError - super(`An error occured when querying the NLU Server: "${message}". \n${hint}`) + super(`An error occurred when querying the NLU Server: "${message}". \n${hint}`) } } -export class UnsuccessfullModelTransfer extends Error { +export class UnsuccessfulModelTransfer extends Error { constructor(status: string, verb: 'GET' | 'POST') { const action = verb === 'GET' ? 'downloading' : 'uploading' super(`${action} model weights returned with status: "${status}".`) diff --git a/packages/nlu-e2e/src/index.ts b/packages/nlu-e2e/src/index.ts index 60c09ac8..a56a167c 100644 --- a/packages/nlu-e2e/src/index.ts +++ b/packages/nlu-e2e/src/index.ts @@ -17,7 +17,7 @@ yargs pattern: { type: 'string', alias: 'p', - optionnal: true + optional: true } }, (argv) => { diff --git a/packages/nlu-e2e/src/tests/linting.ts b/packages/nlu-e2e/src/tests/linting.ts index 2ead78d3..5295a4a8 100644 --- a/packages/nlu-e2e/src/tests/linting.ts +++ b/packages/nlu-e2e/src/tests/linting.ts @@ -41,7 +41,7 @@ export const lintingTest: Test = { chai.expect(c000_issues[0]).to.have.property('code', 'C_000') const c_001_dataset = _.cloneDeep(grocery_dataset) - getIntent(c_001_dataset, 'fruit-is-moldy').slots.push({ name: 'some-slot', entities: ['non-existent-entity'] }) + getIntent(c_001_dataset, 'fruit-is-moldy').slots.push({ name: 'some-slot', entities: ['nonexistent-entity'] }) const c001_modelId = await assertLintingStarts(lintingArgs, speed, c_001_dataset) const c001_dataset_issues = await assertLintingFinishes(lintingArgs, speed, c001_modelId) const c001_issues = c001_dataset_issues.filter(issueGuard('C_001')) diff --git a/packages/nlu-e2e/src/tests/modelweights-transfer.ts b/packages/nlu-e2e/src/tests/modelweights-transfer.ts index 5ec933b6..ffd1928c 100644 --- a/packages/nlu-e2e/src/tests/modelweights-transfer.ts +++ b/packages/nlu-e2e/src/tests/modelweights-transfer.ts @@ -50,7 +50,7 @@ export const modelWeightsTransferTest: Test = { const fileLocation = path.join(cachePath, `${modelId}.model`) await assertModelWeightsDownload(modelWeightsTransferArgs, modelId, fileLocation) - // prune model remotly and ensure prediction does not work + // prune model remotely and ensure prediction does not work await assertModelsPrune(modelWeightsTransferArgs) await assertPredictionFails(modelWeightsTransferArgs, modelId, grocery_test_sample.utterance, 'model_not_found') @@ -71,7 +71,7 @@ export const modelWeightsTransferTest: Test = { await fs.promises.writeFile(corruptedFileLocation, corruptedWeights) await assertModelWeightsUploadFails(modelWeightsTransferArgs, corruptedFileLocation, 'INVALID_MODEL_FORMAT') - // ensure uploading a older version buffer fails + // ensure uploading an older version buffer fails const specHash = modelId.split('.')[1] const dummySpecHash = 'ffffff9999999999' const deprecatedWeights = bufferReplace( @@ -81,7 +81,7 @@ export const modelWeightsTransferTest: Test = { ) const deprecatedFileLocation = path.join(cachePath, `${modelId}.deprecated.model`) await fs.promises.writeFile(deprecatedFileLocation, deprecatedWeights) - await assertModelWeightsUploadFails(modelWeightsTransferArgs, deprecatedFileLocation, 'UNSUPORTED_MODEL_SPEC') + await assertModelWeightsUploadFails(modelWeightsTransferArgs, deprecatedFileLocation, 'UNSUPPORTED_MODEL_SPEC') // cleanup await assertModelsPrune(modelWeightsTransferArgs) diff --git a/packages/nlu-e2e/src/tests/training.ts b/packages/nlu-e2e/src/tests/training.ts index 6ab24605..3142b907 100644 --- a/packages/nlu-e2e/src/tests/training.ts +++ b/packages/nlu-e2e/src/tests/training.ts @@ -14,7 +14,7 @@ export const trainingErrorsTest: Test = { const trainingArgs = { ...args, logger: trainingLogger } const invalidDataset = _.cloneDeep(grocery_dataset) - invalidDataset.intents[0].slots.push({ name: 'some-slot', entities: ['non-existent-entity'] }) + invalidDataset.intents[0].slots.push({ name: 'some-slot', entities: ['nonexistent-entity'] }) await assertQueueTrainingFails(trainingArgs, invalidDataset, 'dataset_format') await assertQueueTrainingFails(trainingArgs, { ...grocery_dataset, language: 'ab' }, 'dataset_format') await assertModelsPrune(args) diff --git a/packages/nlu-e2e/src/utils.ts b/packages/nlu-e2e/src/utils.ts index 4c4bfe4d..11ab165c 100644 --- a/packages/nlu-e2e/src/utils.ts +++ b/packages/nlu-e2e/src/utils.ts @@ -5,7 +5,7 @@ import crypto from 'crypto' import fs from 'fs' import path from 'path' import { getAppDataPath } from './app-data' -import { UnsuccessfullAPICall } from './errors' +import { UnsuccessfulAPICall } from './errors' export type TrainLintPredicate = (state: T) => boolean export type PollingArgs = { @@ -36,7 +36,7 @@ export const pollTrainingUntil = async (args: PollingArgs): Promi const trainStatusRes = await nluClient.getTrainingStatus(appId, modelId) if (!trainStatusRes.success) { clearInterval(int) - reject(new UnsuccessfullAPICall(trainStatusRes.error)) + reject(new UnsuccessfulAPICall(trainStatusRes.error)) return } @@ -71,7 +71,7 @@ export const pollLintingUntil = async ( const lintStatusRes = await nluClient.getLintingStatus(appId, modelId, speed) if (!lintStatusRes.success) { clearInterval(int) - reject(new UnsuccessfullAPICall(lintStatusRes.error)) + reject(new UnsuccessfulAPICall(lintStatusRes.error)) return } diff --git a/packages/nlu-engine/readme.md b/packages/nlu-engine/readme.md index db50aca0..6012368b 100644 --- a/packages/nlu-engine/readme.md +++ b/packages/nlu-engine/readme.md @@ -4,7 +4,7 @@ Contains all Botpress NLU Pipeline and tools packaged under very few classes and functions. -The `makeEngine()` function returns an instance of class `Engine` which is reponsible for: +The `makeEngine()` function returns an instance of class `Engine` which is responsible for: - training of a model - prediction using a model @@ -12,7 +12,7 @@ The `makeEngine()` function returns an instance of class `Engine` which is repon - spawning and handling training threads - keeping loaded models in an in-memory cache - handling file-system caches at provided path -- comunicating via HTTP with language server and duckling server +- communicating via HTTP with language server and duckling server It is not responsible for: diff --git a/packages/nlu-engine/src/engine/entities/custom-extractor/index.ts b/packages/nlu-engine/src/engine/entities/custom-extractor/index.ts index 2a924e82..ebfff3f4 100644 --- a/packages/nlu-engine/src/engine/entities/custom-extractor/index.ts +++ b/packages/nlu-engine/src/engine/entities/custom-extractor/index.ts @@ -70,7 +70,7 @@ export class CustomEntityExtractor { } private _extractMultipleListEntities(utterance: Utterance, list_entities: WarmedListEntityModel[]) { - // no need to "keep-value" of entities as this function's purpose is precisly to extract entities before tagging them in the utterance. + // no need to "keep-value" of entities as this function's purpose is precisely to extract entities before tagging them in the utterance. const cacheKey = utterance.toString({ lowerCase: true }) const { withCacheHit, withCacheMiss } = this._splitModelsByCacheHitOrMiss(list_entities, cacheKey) diff --git a/packages/nlu-engine/src/engine/entities/custom-extractor/thread-entry-point.ts b/packages/nlu-engine/src/engine/entities/custom-extractor/thread-entry-point.ts index 54c03393..715bf1c1 100644 --- a/packages/nlu-engine/src/engine/entities/custom-extractor/thread-entry-point.ts +++ b/packages/nlu-engine/src/engine/entities/custom-extractor/thread-entry-point.ts @@ -24,7 +24,7 @@ const main = async () => { await threadEntryPoint.initialize() } catch (thrown) { const err = thrown instanceof Error ? thrown : new Error(`${thrown}`) - threadEntryPoint.logger.error('An unhandled error occured in the thread', err) + threadEntryPoint.logger.error('An unhandled error occurred in the thread', err) process.exit(1) } } diff --git a/packages/nlu-engine/src/engine/entities/entity-cache.test.ts b/packages/nlu-engine/src/engine/entities/entity-cache.test.ts index e0a6d9ab..7366dcc6 100644 --- a/packages/nlu-engine/src/engine/entities/entity-cache.test.ts +++ b/packages/nlu-engine/src/engine/entities/entity-cache.test.ts @@ -6,12 +6,12 @@ import { SystemEntityCacheManager } from './entity-cache' describe('System Entity Cache', () => { let testCache: SystemEntityCacheManager const testCachePath = path.join(' ', 'cache', 'testCache.json') - let inputExemples: string[] + let inputExamples: string[] beforeEach(async () => { testCache = new SystemEntityCacheManager(testCachePath, false) - inputExemples = [ + inputExamples = [ 'Hello my name is pedro', - 'I know this sentences are not the same than the entity bellow', + 'I know this sentences are not the same than the entity below', "But... we don't care, it's just a test okay ?!" ] const inputResults: EntityExtractionResult[][] = [ @@ -75,7 +75,7 @@ describe('System Entity Cache', () => { ] ] - await testCache.cacheBatchResults(inputExemples, inputResults) + await testCache.cacheBatchResults(inputExamples, inputResults) }) afterAll(() => { @@ -84,7 +84,7 @@ describe('System Entity Cache', () => { test('Return good split', async () => { const [testCached, testToFetch] = testCache.splitCacheHitFromCacheMiss( - ['Hey ! Do you love me ?', 'Yes for sure I love you !', ...inputExemples], + ['Hey ! Do you love me ?', 'Yes for sure I love you !', ...inputExamples], true ) @@ -94,7 +94,7 @@ describe('System Entity Cache', () => { test('Return good split without using cache', async () => { const [testCached, testToFetch] = testCache.splitCacheHitFromCacheMiss( - ['Hey ! Do you love me ?', 'Yes for sure I love you !', ...inputExemples], + ['Hey ! Do you love me ?', 'Yes for sure I love you !', ...inputExamples], false ) @@ -105,7 +105,7 @@ describe('System Entity Cache', () => { test('Reset the cache', async () => { testCache.reset() - const [testCached, testToFetch] = testCache.splitCacheHitFromCacheMiss(inputExemples, true) + const [testCached, testToFetch] = testCache.splitCacheHitFromCacheMiss(inputExamples, true) expect(testCached.length).toEqual(0) expect(testToFetch.length).toEqual(3) @@ -114,7 +114,7 @@ describe('System Entity Cache', () => { test('Cache is restored', async () => { await testCache.restoreCache() - const [testCached, testToFetch] = testCache.splitCacheHitFromCacheMiss(inputExemples, true) + const [testCached, testToFetch] = testCache.splitCacheHitFromCacheMiss(inputExamples, true) expect(testCached.length).toEqual(3) expect(testToFetch.length).toEqual(0) diff --git a/packages/nlu-engine/src/engine/entities/list-extractor.test.ts b/packages/nlu-engine/src/engine/entities/list-extractor.test.ts index daadfcaf..3b78ca65 100644 --- a/packages/nlu-engine/src/engine/entities/list-extractor.test.ts +++ b/packages/nlu-engine/src/engine/entities/list-extractor.test.ts @@ -97,7 +97,7 @@ describe('list entity extractor', () => { ) }) - describe('same occurence in multiple entities extracts multiple entities', () => { + describe('same occurrence in multiple entities extracts multiple entities', () => { // arrange const test_entities: ListEntityModel[] = [ ...list_entities, diff --git a/packages/nlu-engine/src/engine/entities/microsoft-extractor/enums.ts b/packages/nlu-engine/src/engine/entities/microsoft-extractor/enums.ts index 890b6a65..ea6c72ae 100644 --- a/packages/nlu-engine/src/engine/entities/microsoft-extractor/enums.ts +++ b/packages/nlu-engine/src/engine/entities/microsoft-extractor/enums.ts @@ -41,7 +41,7 @@ export const GlobalRecognizers = [ Recognizers.recognizeGUID ] -export const LanguageDependantRecognizers = [ +export const LanguageDependentRecognizers = [ Recognizers.recognizeOrdinal, Recognizers.recognizeNumber, Recognizers.recognizePercentage, diff --git a/packages/nlu-engine/src/engine/entities/microsoft-extractor/index.ts b/packages/nlu-engine/src/engine/entities/microsoft-extractor/index.ts index d108fe37..8ea6302f 100644 --- a/packages/nlu-engine/src/engine/entities/microsoft-extractor/index.ts +++ b/packages/nlu-engine/src/engine/entities/microsoft-extractor/index.ts @@ -5,7 +5,7 @@ import { EntityExtractionResult, SystemEntityExtractor, KeyedItem } from '../../ import { SystemEntityCacheManager } from '../entity-cache' import { GlobalRecognizers, - LanguageDependantRecognizers, + LanguageDependentRecognizers, DucklingUnitMapping, DucklingDateMappings, DucklingTypeMappings, @@ -48,7 +48,7 @@ export class MicrosoftEntityExtractor implements SystemEntityExtractor { ? { lang: 'en', recognizers: [...GlobalRecognizers] } : { lang, - recognizers: [...LanguageDependantRecognizers, ...GlobalRecognizers] + recognizers: [...LanguageDependentRecognizers, ...GlobalRecognizers] } const [cached, toFetch] = this._cache.splitCacheHitFromCacheMiss(inputs, !!useCache) @@ -75,19 +75,19 @@ export class MicrosoftEntityExtractor implements SystemEntityExtractor { if (entity.typeName.includes('datetimeV2')) { const resolution = entity.resolution as MicrosoftValues - const metadatas = resolution.values[0] as MicrosoftTimeValues + const timeValues = resolution.values[0] as MicrosoftTimeValues - unit = metadatas.type + unit = timeValues.type entity.typeName = DucklingDateMappings[entity.typeName] switch (entity.typeName) { case 'duration': // TODO Deal with intervals ! Also need to be fixed in duckling. - value = metadatas.start || metadatas.end! + value = timeValues.start || timeValues.end! break case 'time': - value = metadatas.value! + value = timeValues.value! break default: diff --git a/packages/nlu-engine/src/engine/index.ts b/packages/nlu-engine/src/engine/index.ts index 1500783f..e1a24cf9 100644 --- a/packages/nlu-engine/src/engine/index.ts +++ b/packages/nlu-engine/src/engine/index.ts @@ -24,7 +24,7 @@ import { import { deserializeKmeans } from './clustering' import { initializeTools } from './initialize-tools' import { getCtxFeatures } from './intents/context-featurizer' -import { OOSIntentClassifier } from './intents/oos-intent-classfier' +import { OOSIntentClassifier } from './intents/oos-intent-classifier' import { SvmIntentClassifier } from './intents/svm-intent-classifier' import { LintingProcessPool } from './linting-process-pool' import { allIssues } from './linting/definitions' @@ -151,7 +151,7 @@ export default class Engine implements IEngine { .keyBy((e) => e.name) .mapValues((e) => e.synonyms) .value(), - cache: [] // TODO: bring back list entitiy caching + cache: [] // TODO: bring back list entity caching } ) diff --git a/packages/nlu-engine/src/engine/intents/entities-featurizer.test.ts b/packages/nlu-engine/src/engine/intents/entities-featurizer.test.ts index 85d1d1f4..fc53a610 100644 --- a/packages/nlu-engine/src/engine/intents/entities-featurizer.test.ts +++ b/packages/nlu-engine/src/engine/intents/entities-featurizer.test.ts @@ -26,7 +26,7 @@ function buildEntity(type: string, extractor: ExtractorType = 'list'): Entity { } describe('Entities featurizer', () => { - test('All entities should be represented in features even the ones with no occurences', () => { + test('All entities should be represented in features even the ones with no occurrences', () => { // Arrange const definitions = ['Tata', 'Toto', 'Tutu', 'Titi'] diff --git a/packages/nlu-engine/src/engine/intents/entities-featurizer.ts b/packages/nlu-engine/src/engine/intents/entities-featurizer.ts index 8dcfeec6..0d417d82 100644 --- a/packages/nlu-engine/src/engine/intents/entities-featurizer.ts +++ b/packages/nlu-engine/src/engine/intents/entities-featurizer.ts @@ -6,13 +6,13 @@ export function getEntitiesEncoding(utt: Utterance, customEntities: string[]): n const zeros = Array(customEntities.length).fill(0) let entityMap: _.Dictionary = _.zipObject(customEntities, zeros) - const entitiesOccurence = _(utt.entities) + const entitiesOccurrence = _(utt.entities) .filter((e) => e.metadata.extractor !== 'system') .map((e) => e.type) .countBy() .value() - entityMap = { ...entityMap, ...entitiesOccurence } + entityMap = { ...entityMap, ...entitiesOccurrence } return _.chain(entityMap) .toPairs() diff --git a/packages/nlu-engine/src/engine/intents/exact-intent-classifier.test.ts b/packages/nlu-engine/src/engine/intents/exact-intent-classifier.test.ts index a5ff9149..cb197dc1 100644 --- a/packages/nlu-engine/src/engine/intents/exact-intent-classifier.test.ts +++ b/packages/nlu-engine/src/engine/intents/exact-intent-classifier.test.ts @@ -5,7 +5,7 @@ import { makeTestUtterance } from '../test-utils/fake-utterance' import { Intent } from '../typings' import Utterance from '../utterance/utterance' -import { ExactIntenClassifier } from './exact-intent-classifier' +import { ExactIntentClassifier } from './exact-intent-classifier' const u1 = 'Hi my name is Alex W and I try to make NLU for a living' const u2 = "Hi I'm Justine and I'm a smart bot with very scoped skills" @@ -36,7 +36,7 @@ const isOneHot = (x: number[]) => { describe('Exact match intent classifier', () => { test('when no match clf returns all confidence 0 and oos 1', async () => { - let exactMatchIntentClf = new ExactIntenClassifier() + let exactMatchIntentClf = new ExactIntentClassifier() const model = await exactMatchIntentClf.train( { intents, @@ -47,7 +47,7 @@ describe('Exact match intent classifier', () => { }, dummyProgress ) - exactMatchIntentClf = new ExactIntenClassifier() + exactMatchIntentClf = new ExactIntentClassifier() await exactMatchIntentClf.load(model) const preds = await exactMatchIntentClf.predict(makeTestUtterance('Some random string')) @@ -57,7 +57,7 @@ describe('Exact match intent classifier', () => { }) test('when match clf returns one hot vector', async () => { - let exactMatchIntentClf = new ExactIntenClassifier() + let exactMatchIntentClf = new ExactIntentClassifier() const model = await exactMatchIntentClf.train( { intents, @@ -68,7 +68,7 @@ describe('Exact match intent classifier', () => { }, dummyProgress ) - exactMatchIntentClf = new ExactIntenClassifier() + exactMatchIntentClf = new ExactIntentClassifier() await exactMatchIntentClf.load(model) const pairs: [string, Intent][] = [ @@ -86,9 +86,9 @@ describe('Exact match intent classifier', () => { } }) - // This test is dependant of utterance.toString() implementation. Ideally we would mock the utterance class. + // This test is dependent of utterance.toString() implementation. Ideally we would mock the utterance class. test('clf matches even when casing or special characters', async () => { - let exactMatchIntentClf = new ExactIntenClassifier() + let exactMatchIntentClf = new ExactIntentClassifier() const model = await exactMatchIntentClf.train( { intents, @@ -99,10 +99,10 @@ describe('Exact match intent classifier', () => { }, dummyProgress ) - exactMatchIntentClf = new ExactIntenClassifier() + exactMatchIntentClf = new ExactIntentClassifier() await exactMatchIntentClf.load(model) - const u1_hat = 'hi mY nAMe is Alex W and I try to maKe nLu for a living' // case insensitive + const u1_hat = 'hi mY nAMe is Alex W and I try to maKe nLu for a living' // case-insensitive const u2_hat = 'Hi I_m Justine and I_m a smart bot with very scoped skills' // ignore special characters const u3_hat = 'Medication makes me high ¿÷≥≤µ˜∫√≈æ' // ignore special characters diff --git a/packages/nlu-engine/src/engine/intents/exact-intent-classifier.ts b/packages/nlu-engine/src/engine/intents/exact-intent-classifier.ts index 64060079..9278daeb 100644 --- a/packages/nlu-engine/src/engine/intents/exact-intent-classifier.ts +++ b/packages/nlu-engine/src/engine/intents/exact-intent-classifier.ts @@ -30,14 +30,14 @@ const EXACT_MATCH_STR_OPTIONS: UtteranceToStringOptions = { strategy: 'replace-entity-name' } -export class ExactIntenClassifier implements NoneableIntentClassifier { +export class ExactIntentClassifier implements NoneableIntentClassifier { private static _displayName = 'Exact Intent Classifier' private static _name = 'exact-matcher' private predictors: Predictors | undefined public get name() { - return ExactIntenClassifier._name + return ExactIntentClassifier._name } public static get modelType() { @@ -90,13 +90,13 @@ export class ExactIntenClassifier implements NoneableIntentClassifier { if (!this.predictors) { - throw new Error(`${ExactIntenClassifier._displayName} must load model before calling predict.`) + throw new Error(`${ExactIntentClassifier._displayName} must load model before calling predict.`) } const { exact_match_index, intents: intentNames } = this.predictors diff --git a/packages/nlu-engine/src/engine/intents/oos-intent-classifier.test.ts b/packages/nlu-engine/src/engine/intents/oos-intent-classifier.test.ts index f9052d2c..ba469e35 100644 --- a/packages/nlu-engine/src/engine/intents/oos-intent-classifier.test.ts +++ b/packages/nlu-engine/src/engine/intents/oos-intent-classifier.test.ts @@ -6,7 +6,7 @@ import { makeTestUtterance } from '../test-utils/fake-utterance' import { Intent } from '../typings' import Utterance from '../utterance/utterance' -import { OOSIntentClassifier } from './oos-intent-classfier' +import { OOSIntentClassifier } from './oos-intent-classifier' const languageDimension = 10 const languages = ['en'] diff --git a/packages/nlu-engine/src/engine/intents/oos-intent-classfier.ts b/packages/nlu-engine/src/engine/intents/oos-intent-classifier.ts similarity index 91% rename from packages/nlu-engine/src/engine/intents/oos-intent-classfier.ts rename to packages/nlu-engine/src/engine/intents/oos-intent-classifier.ts index d3a907a7..2fdad310 100644 --- a/packages/nlu-engine/src/engine/intents/oos-intent-classfier.ts +++ b/packages/nlu-engine/src/engine/intents/oos-intent-classifier.ts @@ -11,7 +11,7 @@ import { SPACE } from '../tools/token-utils' import { Intent, Tools } from '../typings' import Utterance, { buildUtteranceBatch } from '../utterance/utterance' -import { ExactIntenClassifier } from './exact-intent-classifier' +import { ExactIntentClassifier } from './exact-intent-classifier' import { NoneableIntentClassifier, NoneableIntentPredictions, NoneableIntentTrainInput } from './intent-classifier' import { getIntentFeatures } from './intent-featurizer' import { featurizeInScopeUtterances, featurizeOOSUtterances, getUtteranceFeatures } from './out-of-scope-featurizer' @@ -25,21 +25,21 @@ type Model = { trainingVocab: string[] baseIntentClfModel: ModelOf oosSvmModel: ModelOf | undefined - exactMatchModel: ModelOf + exactMatchModel: ModelOf } const PTBOOSIntentModel = new ptb.PTBMessage('OOSIntentModel', { trainingVocab: { type: 'string', id: 1, rule: 'repeated' }, baseIntentClfModel: { type: SvmIntentClassifier.modelType, id: 2, rule: 'required' }, oosSvmModel: { type: MLToolkit.SVM.Classifier.modelType, id: 3, rule: 'optional' }, - exactMatchModel: { type: ExactIntenClassifier.modelType, id: 4, rule: 'required' } + exactMatchModel: { type: ExactIntentClassifier.modelType, id: 4, rule: 'required' } }) type Predictors = { baseIntentClf: SvmIntentClassifier oosSvm: MLToolkit.SVM.Classifier | undefined trainingVocab: string[] - exactIntenClassifier: ExactIntenClassifier + exactIntentClassifier: ExactIntentClassifier } const MIN_NB_UTTERANCES = 3 @@ -50,9 +50,9 @@ const NONE_UTTERANCES_BOUNDS = { } /** - * @description Intent classfier composed of 3 smaller components: + * @description Intent classifier composed of 3 smaller components: * 1 - an SVM intent classifier - * 2 - an SVM to predict weither the sample is in scope or oos + * 2 - an SVM to predict whether the sample is in scope or oos * 3 - an exact-matcher to override the prediction made by the SVM when there's an exact match * * @returns A confidence level for all possible labels including none @@ -85,25 +85,25 @@ export class OOSIntentClassifier implements NoneableIntentClassifier { - const combinedProgres = (ooScopeProgress + inScopeProgress) / 2 - progress(combinedProgres) + const reportCombinedProgress = () => { + const combinedProgress = (ooScopeProgress + inScopeProgress) / 2 + progress(combinedProgress) } const [ooScopeModel, inScopeModel] = await Promise.all([ this._trainOOScopeSvm(trainInput, noneIntent, (p: number) => { ooScopeProgress = p - reportCombinedProgres() + reportCombinedProgress() }), this._trainInScopeSvm(trainInput, noneIntent, (p: number) => { inScopeProgress = p - reportCombinedProgres() + reportCombinedProgress() }) ]) - const exactIntenClassifier = new ExactIntenClassifier() + const exactIntentClassifier = new ExactIntentClassifier() const dummyProgress = () => {} - const exactMatchModel = await exactIntenClassifier.train(trainInput, dummyProgress) + const exactMatchModel = await exactIntentClassifier.train(trainInput, dummyProgress) return { oosSvmModel: ooScopeModel, @@ -284,8 +284,8 @@ export class OOSIntentClassifier implements NoneableIntentClassifier { // arrange @@ -25,7 +25,7 @@ test('remove none intent', () => { expect(withoutNone.intents.some((i) => i.name === 'none')).toBe(false) }) -test('ajdust to 100', () => { +test('adjust to 100', () => { // arrange const nlu: NoneableIntentPredictions = { oos: 0.99, diff --git a/packages/nlu-engine/src/engine/language/language-identifier.ts b/packages/nlu-engine/src/engine/language/language-identifier.ts index 32817592..c9a71024 100644 --- a/packages/nlu-engine/src/engine/language/language-identifier.ts +++ b/packages/nlu-engine/src/engine/language/language-identifier.ts @@ -48,7 +48,7 @@ export default (langIdentifier: FastTextLanguageId) => async ( let scoreDetectedLang = bestMlLangMatch?.value ?? 0 // because with single-worded sentences, confidence is always very low - // we assume that a input of 20 chars is more than a single word + // we assume that an input of 20 chars is more than a single word const threshold = sentence.length > 20 ? 0.5 : 0.3 // if ML-based language identifier didn't find a match diff --git a/packages/nlu-engine/src/engine/language/language-provider.ts b/packages/nlu-engine/src/engine/language/language-provider.ts index d8aa4f8d..b5d4f352 100644 --- a/packages/nlu-engine/src/engine/language/language-provider.ts +++ b/packages/nlu-engine/src/engine/language/language-provider.ts @@ -73,7 +73,7 @@ export class LanguageProvider { installedLanguages = installed.map((x) => x.code) langServerInfo = { version: info.version, - dim: info.dimentions, + dim: info.dimensions, domain: info.domain } }, DISCOVERY_RETRY_POLICY) diff --git a/packages/nlu-engine/src/engine/language/legacy-lang-client.ts b/packages/nlu-engine/src/engine/language/legacy-lang-client.ts index 36c3b75d..f37832bd 100644 --- a/packages/nlu-engine/src/engine/language/legacy-lang-client.ts +++ b/packages/nlu-engine/src/engine/language/legacy-lang-client.ts @@ -6,7 +6,7 @@ import { LangServerError } from '../errors' type HTTPVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' type HTTPCall = { verb: V - ressource: string + resource: string } // TODO: fully remove this ASAP @@ -29,25 +29,25 @@ export class LegacyLanguageClient { } public async getInfo(): Promise { - const call: HTTPCall<'GET'> = { ressource: 'info', verb: 'GET' } + const call: HTTPCall<'GET'> = { resource: 'info', verb: 'GET' } const { data } = await this._get(call) return data } public async getLanguages(): Promise { - const call: HTTPCall<'GET'> = { ressource: 'languages', verb: 'GET' } + const call: HTTPCall<'GET'> = { resource: 'languages', verb: 'GET' } const { data } = await this._get(call) return data } public async vectorize(tokens: string[], lang: string): Promise { - const call: HTTPCall<'POST'> = { ressource: 'vectorize', verb: 'POST' } + const call: HTTPCall<'POST'> = { resource: 'vectorize', verb: 'POST' } const { data } = await this._post(call, { tokens, lang }) return data } public async tokenize(utterances: string[], lang: string): Promise { - const call: HTTPCall<'POST'> = { ressource: 'tokenize', verb: 'POST' } + const call: HTTPCall<'POST'> = { resource: 'tokenize', verb: 'POST' } const { data } = await this._post(call, { utterances, lang }) return data } @@ -58,8 +58,8 @@ export class LegacyLanguageClient { config?: AxiosRequestConfig ): Promise> => { try { - const { ressource } = call - const res = await this._client.post(ressource, body, config) + const { resource } = call + const res = await this._client.post(resource, body, config) return res } catch (err) { // axios validate status does not prevent all exceptions @@ -69,8 +69,8 @@ export class LegacyLanguageClient { private _get = async (call: HTTPCall<'GET'>, config?: AxiosRequestConfig): Promise> => { try { - const { ressource } = call - const res = await this._client.get(ressource, config) + const { resource } = call + const res = await this._client.get(resource, config) return res } catch (err) { // axios validate status does not prevent all exceptions @@ -85,9 +85,9 @@ export class LegacyLanguageClient { } const { message: originalMsg, stack } = err - const { verb, ressource } = call - const ressourcePath = `lang-server/${ressource}` - const prefix = `${verb} ${ressourcePath}` + const { verb, resource } = call + const resourcePath = `lang-server/${resource}` + const prefix = `${verb} ${resourcePath}` const message = `(${prefix}) ${originalMsg}` return new LangServerError({ message, stack, code: -1, type: 'internal' }) diff --git a/packages/nlu-engine/src/engine/linting-process-pool/index.ts b/packages/nlu-engine/src/engine/linting-process-pool/index.ts index 3e8b8bc1..13cac718 100644 --- a/packages/nlu-engine/src/engine/linting-process-pool/index.ts +++ b/packages/nlu-engine/src/engine/linting-process-pool/index.ts @@ -4,10 +4,10 @@ import { LanguageConfig, LintingProgressCb, Logger } from '../../typings' import { LintingAlreadyStartedError, LintingCanceledError, LintingExitedUnexpectedlyError } from '../errors' import { ErrorHandler } from '../training-process-pool/error-handler' import { ENTRY_POINT } from './process-entry-point' -import { LintingInput, LintingOuput, LintingProgress } from './typings' +import { LintingInput, LintingOutput, LintingProgress } from './typings' export class LintingProcessPool { - private _processPool: ProcessPool + private _processPool: ProcessPool constructor(private _logger: Logger, config: LanguageConfig) { const env = { @@ -15,7 +15,7 @@ export class LintingProcessPool { NLU_CONFIG: JSON.stringify(config) } - this._processPool = makeProcessPool(this._logger, { + this._processPool = makeProcessPool(this._logger, { maxWorkers: Number.POSITIVE_INFINITY, entryPoint: ENTRY_POINT, env, @@ -27,7 +27,7 @@ export class LintingProcessPool { return this._processPool.cancel(lintId) } - public async startLinting(input: LintingInput, progress: LintingProgressCb): Promise { + public async startLinting(input: LintingInput, progress: LintingProgressCb): Promise { try { const output = await this._processPool.run( input.lintId, diff --git a/packages/nlu-engine/src/engine/linting-process-pool/process-entry-point.ts b/packages/nlu-engine/src/engine/linting-process-pool/process-entry-point.ts index 7361183c..56ccc325 100644 --- a/packages/nlu-engine/src/engine/linting-process-pool/process-entry-point.ts +++ b/packages/nlu-engine/src/engine/linting-process-pool/process-entry-point.ts @@ -3,11 +3,11 @@ import { DatasetIssue, IssueCode } from '../../linting' import { initializeTools } from '../initialize-tools' import { lintingPipeline } from '../linting/linting-pipeline' import { ErrorHandler } from '../training-process-pool/error-handler' -import { LintingInput, LintingOuput, LintingProgress } from './typings' +import { LintingInput, LintingOutput, LintingProgress } from './typings' export const ENTRY_POINT = __filename -const processEntryPoint = makeProcessEntryPoint({ +const processEntryPoint = makeProcessEntryPoint({ errorHandler: new ErrorHandler() }) @@ -19,7 +19,7 @@ const main = async () => { try { const tools = await initializeTools(config, processEntryPoint.logger) - processEntryPoint.listenForTask(async (taskDef: TaskDefinition) => { + processEntryPoint.listenForTask(async (taskDef: TaskDefinition) => { const { input, progress } = taskDef tools.seededLodashProvider.setSeed(input.trainSet.seed) @@ -50,7 +50,7 @@ const main = async () => { await processEntryPoint.initialize() } catch (thrown) { const err = thrown instanceof Error ? thrown : new Error(`${thrown}`) - processEntryPoint.logger.error('An unhandled error occured in the process', err) + processEntryPoint.logger.error('An unhandled error occurred in the process', err) process.exit(1) } } diff --git a/packages/nlu-engine/src/engine/linting-process-pool/typings.ts b/packages/nlu-engine/src/engine/linting-process-pool/typings.ts index b5294e1c..e06d04ef 100644 --- a/packages/nlu-engine/src/engine/linting-process-pool/typings.ts +++ b/packages/nlu-engine/src/engine/linting-process-pool/typings.ts @@ -7,6 +7,6 @@ export type LintingInput = { minSpeed: IssueComputationSpeed } -export type LintingOuput = { issues: DatasetIssue[] } +export type LintingOutput = { issues: DatasetIssue[] } export type LintingProgress = { total: number; current: number; issues: DatasetIssue[] } diff --git a/packages/nlu-engine/src/engine/linting/e_000.ts b/packages/nlu-engine/src/engine/linting/e_000.ts index 9c52d80a..49981e24 100644 --- a/packages/nlu-engine/src/engine/linting/e_000.ts +++ b/packages/nlu-engine/src/engine/linting/e_000.ts @@ -61,9 +61,9 @@ const unitToIssue = ({ intent, utterance, utteranceIdx, slot, slotDef }: Verific source: slot.source }) -const splitEntities = (entitieDefs: EntityDefinition[]) => { - const listEntities = entitieDefs.filter(isListEntity) - const patternEntities = entitieDefs.filter(isPatternEntity) +const splitEntities = (entityDefs: EntityDefinition[]) => { + const listEntities = entityDefs.filter(isListEntity) + const patternEntities = entityDefs.filter(isPatternEntity) return { listEntities, patternEntities @@ -184,11 +184,11 @@ const flattenDataset = async ( intent.slots.map((s) => ({ intent: intent.name, slotDef: s, ...x })) ) - const flatSlotOccurences = _.flatMap(flatSlotDefinitions, ({ utterance, ...x }) => + const flatSlotOccurrences = _.flatMap(flatSlotDefinitions, ({ utterance, ...x }) => utterance.slots.map((s) => ({ slot: s, utterance, ...x })) ) - return flatSlotOccurences.filter((x) => x.slot.name === x.slotDef.name) + return flatSlotOccurrences.filter((x) => x.slot.name === x.slotDef.name) } const matchesCustom = (customEntityExtractor: CustomEntityExtractor) => (unit: VerificationUnit) => { @@ -233,7 +233,7 @@ export const E_000_Linter: IssueLinter = { ) const extractedSystemEntities = await systemEntityExtractor.extractMultiple( - withSystemEntities.map((u) => u.utterance.toString()), // use whole utterance here as duckling might be influenced by token postion in utterances and is fast anyway + withSystemEntities.map((u) => u.utterance.toString()), // use whole utterance here as duckling might be influenced by token position in utterances and is fast anyway ts.language, () => {}, true diff --git a/packages/nlu-engine/src/engine/linting/i_000.test.ts b/packages/nlu-engine/src/engine/linting/i_000.test.ts index f58f2801..262fe200 100644 --- a/packages/nlu-engine/src/engine/linting/i_000.test.ts +++ b/packages/nlu-engine/src/engine/linting/i_000.test.ts @@ -49,7 +49,7 @@ const trainSet: TrainInput = { const fakeTools = makeFakeTools(300, ['en']) -test('linter for I_000 flags all reduntant spaces', async () => { +test('linter for I_000 flags all redundant spaces', async () => { const lintResults = await I_000_Linter.lint(trainSet, fakeTools) for (let i = 0; i < samples.length; i++) { diff --git a/packages/nlu-engine/src/engine/linting/i_000.ts b/packages/nlu-engine/src/engine/linting/i_000.ts index d8a1e5b7..c119577f 100644 --- a/packages/nlu-engine/src/engine/linting/i_000.ts +++ b/packages/nlu-engine/src/engine/linting/i_000.ts @@ -19,7 +19,7 @@ type VerificationUnit = { export const I_000: IssueDefinition = { code, severity: 'info', - name: 'dupplicated_or_untrimed_spaces' + name: 'duplicated_or_untrimmed_spaces' } const flattenDataset = (ts: TrainInput): VerificationUnit[] => { @@ -76,9 +76,9 @@ const checkUtterance = (unit: VerificationUnit): DatasetIssue[] => ) } - let dupplicatedSpacesMatch = CONSECUTIVE_SPACES.exec(unit.utterance) - while (dupplicatedSpacesMatch) { - const span = getSpan(dupplicatedSpacesMatch) + let duplicatedSpacesMatch = CONSECUTIVE_SPACES.exec(unit.utterance) + while (duplicatedSpacesMatch) { + const span = getSpan(duplicatedSpacesMatch) if (span.start !== 0 && span.end !== unit.utterance.length) { issues.push( @@ -90,7 +90,7 @@ const checkUtterance = (unit: VerificationUnit): DatasetIssue[] => ) } - dupplicatedSpacesMatch = CONSECUTIVE_SPACES.exec(unit.utterance) + duplicatedSpacesMatch = CONSECUTIVE_SPACES.exec(unit.utterance) } return issues diff --git a/packages/nlu-engine/src/engine/model-serializer.ts b/packages/nlu-engine/src/engine/model-serializer.ts index d7a6309e..a0a39ef1 100644 --- a/packages/nlu-engine/src/engine/model-serializer.ts +++ b/packages/nlu-engine/src/engine/model-serializer.ts @@ -2,7 +2,7 @@ import * as ptb from '@bpinternal/ptb-schema' import _ from 'lodash' import { ModelOf } from 'src/component' import { Model, SlotDefinition } from '../typings' -import { OOSIntentClassifier } from './intents/oos-intent-classfier' +import { OOSIntentClassifier } from './intents/oos-intent-classifier' import { SvmIntentClassifier } from './intents/svm-intent-classifier' import { SlotTagger } from './slots/slot-tagger' import { ListEntityModel, Intent, PatternEntity, SerializedKmeansResult, TFIDF } from './typings' diff --git a/packages/nlu-engine/src/engine/predict-pipeline.ts b/packages/nlu-engine/src/engine/predict-pipeline.ts index a4773575..4e126932 100644 --- a/packages/nlu-engine/src/engine/predict-pipeline.ts +++ b/packages/nlu-engine/src/engine/predict-pipeline.ts @@ -11,7 +11,7 @@ import * as MLToolkit from '../ml/toolkit' import { CustomEntityExtractor } from './entities/custom-extractor' import { IntentPrediction, IntentPredictions, NoneableIntentPredictions } from './intents/intent-classifier' -import { OOSIntentClassifier } from './intents/oos-intent-classfier' +import { OOSIntentClassifier } from './intents/oos-intent-classifier' import { SvmIntentClassifier } from './intents/svm-intent-classifier' import { spellCheck as spellCheckUtterance } from './language/spell-check' import { SlotTagger } from './slots/slot-tagger' @@ -252,8 +252,8 @@ function MapStepToOutput(step: SpellStep): PredictOutput { export const Predict = async (input: PredictInput, tools: Tools, predictors: Predictors): Promise => { const { step } = await preprocessInput(input, tools, predictors) const initialStep = await makePredictionUtterance(step, predictors, tools) - const entitesStep = await extractEntities(initialStep, predictors, tools) - const ctxStep = await predictContext(entitesStep, predictors) + const entitiesStep = await extractEntities(initialStep, predictors, tools) + const ctxStep = await predictContext(entitiesStep, predictors) const intentStep = await predictIntent(ctxStep, predictors) const slotStep = await extractSlots(intentStep, predictors) const spellStep = spellCheck(slotStep, predictors) diff --git a/packages/nlu-engine/src/engine/slots/slot-tagger.test.ts b/packages/nlu-engine/src/engine/slots/slot-tagger.test.ts index b445b4d9..c375dbfc 100644 --- a/packages/nlu-engine/src/engine/slots/slot-tagger.test.ts +++ b/packages/nlu-engine/src/engine/slots/slot-tagger.test.ts @@ -156,7 +156,7 @@ describe('Slot tagger component lifecycle', () => { utterances: [dudeWheresMyCar], slot_definitions: [] }, - list_entites: [] + list_entities: [] }, dummyProgress ) diff --git a/packages/nlu-engine/src/engine/slots/slot-tagger.ts b/packages/nlu-engine/src/engine/slots/slot-tagger.ts index d935ed66..3a8c8ad5 100644 --- a/packages/nlu-engine/src/engine/slots/slot-tagger.ts +++ b/packages/nlu-engine/src/engine/slots/slot-tagger.ts @@ -51,7 +51,7 @@ type Model = { type TrainInput = { intent: Intent - list_entites: ListEntityModel[] + list_entities: ListEntityModel[] } type Predictors = { @@ -135,8 +135,8 @@ export class SlotTagger trainSet: TrainInput, progress: (p: number) => void ): Promise> { - const { intent, list_entites } = trainSet - const intentFeatures = getEntitiesAndVocabOfIntent(intent, list_entites) + const { intent, list_entities } = trainSet + const intentFeatures = getEntitiesAndVocabOfIntent(intent, list_entities) const { slot_definitions } = intent if (slot_definitions.length <= 0) { diff --git a/packages/nlu-engine/src/engine/tools/math.ts b/packages/nlu-engine/src/engine/tools/math.ts index 28cdb4ca..5ae2c3c8 100644 --- a/packages/nlu-engine/src/engine/tools/math.ts +++ b/packages/nlu-engine/src/engine/tools/math.ts @@ -17,8 +17,8 @@ export function euclideanDistanceSquared(a: number[], b: number[]): number { } /** - * Vectorial distance between two N-dimentional points - * a[] and b[] must be of same dimention + * Vectorial distance between two N-dimensional points + * a[] and b[] must be of same dimension */ export function euclideanDistance(a: number[], b: number[]): number { return Math.sqrt(euclideanDistanceSquared(a, b)) @@ -75,7 +75,7 @@ export function zeroes(len: number): number[] { } /** - * @param quantile number of discret categories ex: 4 == quartile + * @param quantile number of discrete categories ex: 4 == quartile * @param target value to classify * @param upperBound maximum value the target can take * @param lowerBound minimum value the target can take diff --git a/packages/nlu-engine/src/engine/tools/strings.test.ts b/packages/nlu-engine/src/engine/tools/strings.test.ts index 039d6e80..9b7d3a3b 100644 --- a/packages/nlu-engine/src/engine/tools/strings.test.ts +++ b/packages/nlu-engine/src/engine/tools/strings.test.ts @@ -54,7 +54,7 @@ describe('String utils', () => { expect(stringUtils.levenshtein('tetsong', 'testing')).toEqual(3) // 1 x letterSwap (1 sup + 1 add) + 1 x substitution }) - test('darmeau levenshtein', () => { + test('damerau levenshtein', () => { expect(stringUtils.damerauLevenshtein('testing', 'tesing')).toEqual(1) // 1 x suppresion expect(stringUtils.damerauLevenshtein('testting', 'testing')).toEqual(1) // 1 x addition expect(stringUtils.damerauLevenshtein('tasting', 'testing')).toEqual(1) // 1 x substitution diff --git a/packages/nlu-engine/src/engine/tools/strings.ts b/packages/nlu-engine/src/engine/tools/strings.ts index 8d785f85..7da56cef 100644 --- a/packages/nlu-engine/src/engine/tools/strings.ts +++ b/packages/nlu-engine/src/engine/tools/strings.ts @@ -18,7 +18,7 @@ export function ngram(value: string, n: number): string[] { export function vocabNGram(tokens: string[]): string[] { const plainTokens = tokens .map((x) => x.replace('\u2581', '')) // We want to discover real language-specific chars - .filter((x) => x.length > 1) // We want to exclude tokens that represent ponctuation etc (tokenizers will often split them alone) + .filter((x) => x.length > 1) // We want to exclude tokens that represent punctuation etc (tokenizers will often split them alone) // We build a gramset, which is essentially a list of all the unique bigrams and trigrams // We'll create entirely new words from those grams @@ -230,8 +230,8 @@ export function damerauLevenshtein(a: string, b: string) { /** * @returns number of alpha characters in a string */ -export const countAlpha = (cantidate: string): number => - (cantidate.toLowerCase().replace(/\s/g, '').match(/[a-z]/g) || []).length +export const countAlpha = (candidate: string): number => + (candidate.toLowerCase().replace(/\s/g, '').match(/[a-z]/g) || []).length /** * @returns number of digits characters in a string diff --git a/packages/nlu-engine/src/engine/tools/vocab-tokenizer.test.ts b/packages/nlu-engine/src/engine/tools/vocab-tokenizer.test.ts index 021b6474..2efe4589 100644 --- a/packages/nlu-engine/src/engine/tools/vocab-tokenizer.test.ts +++ b/packages/nlu-engine/src/engine/tools/vocab-tokenizer.test.ts @@ -1,7 +1,7 @@ import getVocabTokenizer from './vocab-tokenizer' test('vocab tokenizer should split', () => { - // arange + // arrange const vocab = ['shes', 'a', 'witch', 'burn', 'her'] const sentencepieceToken = 'shesa' const vocabTokenizer = getVocabTokenizer(vocab) @@ -16,7 +16,7 @@ test('vocab tokenizer should split', () => { }) test('vocab tokenizer should split with the correct token', () => { - // arange + // arrange const vocab = ['she', 'shes', 'is', 's', 'a', 'sa', 'witch', 'burn', 'her'] const sentencepieceToken = 'shesa' const vocabTokenizer = getVocabTokenizer(vocab) @@ -31,7 +31,7 @@ test('vocab tokenizer should split with the correct token', () => { }) test('vocab tokenizer should not try more than combinations of length 2', () => { - // arange + // arrange const vocab = ['she', 'shes', 'is', 's', 'a', 'sa', 'witch', 'burn', 'her'] const sentencepieceToken = 'shesawitch' const vocabTokenizer = getVocabTokenizer(vocab) @@ -45,7 +45,7 @@ test('vocab tokenizer should not try more than combinations of length 2', () => }) test('vocab tokenizer should not split', () => { - // arange + // arrange const vocab = ['she', 'shes', 'is', 's', 'a', 'witch', 'burn', 'her'] const sentencepieceToken = 'arthur' const vocabTokenizer = getVocabTokenizer(vocab) @@ -59,7 +59,7 @@ test('vocab tokenizer should not split', () => { }) test('vocab tokenizer should never return empty string', () => { - // arange + // arrange const sentencepieceToken = 'covid' const vocabTokenizer = getVocabTokenizer(['covid', '$']) diff --git a/packages/nlu-engine/src/engine/tools/vocab.ts b/packages/nlu-engine/src/engine/tools/vocab.ts index 7926fcab..1fa7dc1b 100644 --- a/packages/nlu-engine/src/engine/tools/vocab.ts +++ b/packages/nlu-engine/src/engine/tools/vocab.ts @@ -22,7 +22,7 @@ export function getClosestSpellingToken(token: string, vocab: string[]): string let closestTok = '' let dist = Number.POSITIVE_INFINITY for (const candidateTok of vocab) { - // Leveinshtein is for typo detection + // Levenshtein is for typo detection const lev = damerauLevenshtein(token, candidateTok) const maxLevOps = getMaxLevOps(token, candidateTok) if (lev <= maxLevOps && lev < dist) { diff --git a/packages/nlu-engine/src/engine/training-pipeline.ts b/packages/nlu-engine/src/engine/training-pipeline.ts index 0ae1880e..e52f77c8 100644 --- a/packages/nlu-engine/src/engine/training-pipeline.ts +++ b/packages/nlu-engine/src/engine/training-pipeline.ts @@ -13,7 +13,7 @@ import { MultiThreadCustomEntityExtractor } from './entities/custom-extractor/mu import { warmEntityCache } from './entities/entity-cache' import { makeListEntityModel } from './entities/list-entity-model' import { getCtxFeatures } from './intents/context-featurizer' -import { OOSIntentClassifier } from './intents/oos-intent-classfier' +import { OOSIntentClassifier } from './intents/oos-intent-classifier' import { SvmIntentClassifier } from './intents/svm-intent-classifier' import { SlotTagger } from './slots/slot-tagger' @@ -53,7 +53,7 @@ type PreprocessTrainStep = Override< > type TfIdfTrainStep = PreprocessTrainStep & { tfIdf: TFIDF } type ClusterTrainStep = TfIdfTrainStep & { kmeans?: MLToolkit.KMeans.KmeansResult } -type SerialTrainOuput = ClusterTrainStep +type SerialTrainOutput = ClusterTrainStep export type TrainOutput = { list_entities: ColdListEntityModel[] @@ -156,7 +156,11 @@ async function clusterTokens(input: TfIdfTrainStep, tools: Tools): Promise { +async function extractEntities( + input: ClusterTrainStep, + tools: Tools, + progress: progressCB +): Promise { const utterances: Utterance[] = _.chain(input.intents).flatMap('utterances').value() tools.logger?.debug('Extracting system entities') @@ -221,7 +225,7 @@ async function extractEntities(input: ClusterTrainStep, tools: Tools, progress: * ############################ */ async function trainContextClassifier( - input: SerialTrainOuput, + input: SerialTrainOutput, tools: Tools, progress: progressCB ): Promise> { @@ -262,7 +266,7 @@ async function trainContextClassifier( } async function trainIntentClassifiers( - input: SerialTrainOuput, + input: SerialTrainOutput, tools: Tools, progress: progressCB ): Promise<_.Dictionary>> { @@ -313,7 +317,7 @@ async function trainIntentClassifiers( } async function trainSlotTaggers( - input: SerialTrainOuput, + input: SerialTrainOutput, tools: Tools, progress: progressCB ): Promise<_.Dictionary>> { @@ -329,7 +333,7 @@ async function trainSlotTaggers( const model = await slotTagger.train( { intent, - list_entites: input.list_entities + list_entities: input.list_entities }, (p) => { const completion = (i + p) / input.intents.length diff --git a/packages/nlu-engine/src/engine/training-process-pool/index.ts b/packages/nlu-engine/src/engine/training-process-pool/index.ts index 87f653aa..63b9f2ac 100644 --- a/packages/nlu-engine/src/engine/training-process-pool/index.ts +++ b/packages/nlu-engine/src/engine/training-process-pool/index.ts @@ -30,8 +30,8 @@ export class TrainingProcessPool { public async startTraining(input: TrainInput, progress: (x: number) => void): Promise { try { - const ouput = await this._processPool.run(input.trainId, input, progress) - return ouput + const output = await this._processPool.run(input.trainId, input, progress) + return output } catch (thrown) { const err = thrown instanceof Error ? thrown : new Error(`${thrown}`) if (err instanceof errors.TaskCanceledError) { diff --git a/packages/nlu-engine/src/engine/training-process-pool/process-entry-point.ts b/packages/nlu-engine/src/engine/training-process-pool/process-entry-point.ts index 7c062d18..89a43e53 100644 --- a/packages/nlu-engine/src/engine/training-process-pool/process-entry-point.ts +++ b/packages/nlu-engine/src/engine/training-process-pool/process-entry-point.ts @@ -32,7 +32,7 @@ const main = async () => { await processEntryPoint.initialize() } catch (thrown) { const err = thrown instanceof Error ? thrown : new Error(`${thrown}`) - processEntryPoint.logger.error('An unhandled error occured in the process', err) + processEntryPoint.logger.error('An unhandled error occurred in the process', err) process.exit(1) } } diff --git a/packages/nlu-engine/src/engine/utterance/utterance.test.ts b/packages/nlu-engine/src/engine/utterance/utterance.test.ts index 7e8ef6be..18b075de 100644 --- a/packages/nlu-engine/src/engine/utterance/utterance.test.ts +++ b/packages/nlu-engine/src/engine/utterance/utterance.test.ts @@ -369,7 +369,7 @@ describe('UtteranceClass', () => { }) }) - test('sentence embeddeing', () => { + test('sentence embedding', () => { const fakePOS = testTokens.map((_) => 'ADJ') as POSClass[] const u = new Utterance(testTokens, vecs, fakePOS, 'en') u.setGlobalTfidf(globalTFIDF) diff --git a/packages/nlu-engine/src/linting.d.ts b/packages/nlu-engine/src/linting.d.ts index 365b8b98..17f5f402 100644 --- a/packages/nlu-engine/src/linting.d.ts +++ b/packages/nlu-engine/src/linting.d.ts @@ -12,7 +12,7 @@ export type IssueCode = | 'E_002' // duplicated utterances (in one or more intents) | 'E_003' // the whole utterance is tagged as a slot | 'W_000' // intents are overlapping - | 'I_000' // utterance contains dupplicated or untrimed spaces + | 'I_000' // utterance contains duplicated or untrimmed spaces export type Raw = { raw: T } export type Clean = { clean: T } @@ -106,12 +106,12 @@ export type LintingState = { export type IssueComputationSpeed = 'fastest' | 'fast' | 'slow' | 'slowest' -export type IssueSeverity = C extends `C_${infer CodeSufix}` +export type IssueSeverity = C extends `C_${infer CodeSuffix}` ? 'critical' - : C extends `E_${infer CodeSufix}` + : C extends `E_${infer CodeSuffix}` ? 'error' - : C extends `W_${infer CodeSufix}` + : C extends `W_${infer CodeSuffix}` ? 'warning' - : C extends `I_${infer CodeSufix}` + : C extends `I_${infer CodeSuffix}` ? 'info' : never diff --git a/packages/nlu-engine/src/ml/ml-thread-pool/thread-entry-point.ts b/packages/nlu-engine/src/ml/ml-thread-pool/thread-entry-point.ts index 6aa86d5b..f44b638e 100644 --- a/packages/nlu-engine/src/ml/ml-thread-pool/thread-entry-point.ts +++ b/packages/nlu-engine/src/ml/ml-thread-pool/thread-entry-point.ts @@ -27,7 +27,7 @@ const main = async () => { await threadEntryPoint.initialize() } catch (thrown) { const err = thrown instanceof Error ? thrown : new Error(`${thrown}`) - threadEntryPoint.logger.error('An unhandled error occured in the thread', err) + threadEntryPoint.logger.error('An unhandled error occurred in the thread', err) process.exit(1) } } diff --git a/packages/nlu-engine/src/ml/svm/base.ts b/packages/nlu-engine/src/ml/svm/base.ts index 105301fe..b8c191bc 100644 --- a/packages/nlu-engine/src/ml/svm/base.ts +++ b/packages/nlu-engine/src/ml/svm/base.ts @@ -155,9 +155,9 @@ export class SVMClassifier private async _predictProb(preds: Predictors, coordinates: number[]): Promise { const results = await preds.clf.predictProbabilities(coordinates) - const idexes = _.range(results.length) + const indexes = _.range(results.length) const reducedResults = _.reduce( - idexes, + indexes, (acc: Dic, curr: number) => { const label = this.getLabelByIdx(preds, curr).replace(/__k__\d+$/, '') acc[label] = (acc[label] || 0) + results[curr] @@ -174,7 +174,7 @@ export class SVMClassifier } private async _predictOne(preds: Predictors, coordinates: number[]): Promise { - // might simply use oneclass instead + // might simply use one class instead const results = await preds.clf.predict(coordinates) return [ { diff --git a/packages/nlu-engine/src/ml/svm/libsvm/index.ts b/packages/nlu-engine/src/ml/svm/libsvm/index.ts index 36c5e61f..70db2548 100644 --- a/packages/nlu-engine/src/ml/svm/libsvm/index.ts +++ b/packages/nlu-engine/src/ml/svm/libsvm/index.ts @@ -62,7 +62,7 @@ export class SVM { progressCb: (progress: number) => void ): Promise => { const dims = numeric.dim(dataset) - assert(dims[0] > 0 && dims[1] === 2 && dims[2] > 0, 'dataset must be an list of [X,y] tuples') + assert(dims[0] > 0 && dims[1] === 2 && dims[2] > 0, 'dataset must be a list of [X,y] tuples') let mu: number[] | undefined let sigma: number[] | undefined diff --git a/packages/nlu-engine/src/ml/svm/libsvm/kfold/krange.test.ts b/packages/nlu-engine/src/ml/svm/libsvm/kfold/krange.test.ts index 5f51b4b9..0ea6ea25 100644 --- a/packages/nlu-engine/src/ml/svm/libsvm/kfold/krange.test.ts +++ b/packages/nlu-engine/src/ml/svm/libsvm/kfold/krange.test.ts @@ -27,25 +27,25 @@ const tests: Test[] = [ ] const baseKFolder = new BaseKFold() -const startifiedKFolder = new StratifiedKFold() +const stratifiedKFolder = new StratifiedKFold() describe('safe k ranges', () => { test('test 0', () => { const { ds, base, stratified } = tests.find((t) => t.idx === 0)! expect(baseKFolder.krange(ds)).toEqualDomain(base) - expect(startifiedKFolder.krange(ds)).toEqualDomain(stratified) + expect(stratifiedKFolder.krange(ds)).toEqualDomain(stratified) }) test('test 1', () => { const { ds, base, stratified } = tests.find((t) => t.idx === 1)! expect(baseKFolder.krange(ds)).toEqualDomain(base) - expect(startifiedKFolder.krange(ds)).toEqualDomain(stratified) + expect(stratifiedKFolder.krange(ds)).toEqualDomain(stratified) }) test('test 2', () => { const { ds, base, stratified } = tests.find((t) => t.idx === 2)! expect(baseKFolder.krange(ds)).toEqualDomain(base) - expect(startifiedKFolder.krange(ds)).toEqualDomain(stratified) + expect(stratifiedKFolder.krange(ds)).toEqualDomain(stratified) }) test('test 3', () => { @@ -53,7 +53,7 @@ describe('safe k ranges', () => { const baseSafeDomain = baseKFolder.krange(ds) expect(baseSafeDomain).toEqualDomain(base) - expect(startifiedKFolder.krange(ds)).toEqualDomain(stratified) + expect(stratifiedKFolder.krange(ds)).toEqualDomain(stratified) expect([1, 5]).toContain(baseSafeDomain.getClosest(2)) expect(baseSafeDomain.difference(new Domain(5)).getClosest(2)).toEqual(1) @@ -67,7 +67,7 @@ describe('safe k ranges', () => { const baseSafeRange = baseKFolder.krange(ds) expect(baseSafeRange).toEqualDomain(base) - expect(startifiedKFolder.krange(ds)).toEqualDomain(stratified) + expect(stratifiedKFolder.krange(ds)).toEqualDomain(stratified) expect([1, 3]).toContain(baseSafeRange.getClosest(2)) expect(baseSafeRange.difference(new Domain(3)).getClosest(2)).toEqual(1) @@ -79,6 +79,6 @@ describe('safe k ranges', () => { test('test 5', () => { const { ds, base, stratified } = tests.find((t) => t.idx === 5)! expect(baseKFolder.krange(ds)).toEqualDomain(base) - expect(startifiedKFolder.krange(ds)).toEqualDomain(stratified) + expect(stratifiedKFolder.krange(ds)).toEqualDomain(stratified) }) }) diff --git a/packages/nlu-engine/src/ml/svm/libsvm/kfold/readme.md b/packages/nlu-engine/src/ml/svm/libsvm/kfold/readme.md index bd8a8e74..a489b1c5 100644 --- a/packages/nlu-engine/src/ml/svm/libsvm/kfold/readme.md +++ b/packages/nlu-engine/src/ml/svm/libsvm/kfold/readme.md @@ -52,7 +52,7 @@ In other words, the min value assignable to k that ensures no error occurs is: mink = ⌈n(n - nmrc - 1)⌉ -Unfortunatly, when n~mrc === 1, there is might possibly be no value of k (outside of k === 1) that folds the dataset without creating a invalid fold: a fold containing all non-dominant samples. +Unfortunately, when n~mrc === 1, there is might possibly be no value of k (outside of k === 1) that folds the dataset without creating an invalid fold: a fold containing all non-dominant samples. ## Stratified KFold @@ -70,7 +70,7 @@ The following table shows safe values of k for different dataset and kfold algor | 4 | [x, x, x, +, o] | [1, 5] | [1 ... 5] | | 5 | [x, x, x, x, +, +, o, o] | [1, 3 ... 8] | [1 ... 8] | -Example 5 is counter intuitive. Even if nlrc is 1, the ammount of non-dominant samples n~mrc is 2. \ +Example 5 is counter-intuitive. Even if nlrc is 1, the amount of non-dominant samples n~mrc is 2. \ It is not problematic to have a fold with only one class. What is problematic is to have k - 1 folds with only one class. Therefore, the following split is perfectly acceptable: | k1 | k2 | k3 | k4 | diff --git a/packages/nlu-engine/src/ml/svm/libsvm/normalize.ts b/packages/nlu-engine/src/ml/svm/libsvm/normalize.ts index de4cca63..54d9d9f4 100644 --- a/packages/nlu-engine/src/ml/svm/libsvm/normalize.ts +++ b/packages/nlu-engine/src/ml/svm/libsvm/normalize.ts @@ -5,7 +5,7 @@ import numeric from 'numeric' import { Data } from './typings' export function normalizeDataset(dataset: Data[], p_mu?: number[], p_sigma?: number[]) { - assert(dataset instanceof Array, 'dataset must be an list of [X,y] tuples') + assert(dataset instanceof Array, 'dataset must be a list of [X,y] tuples') assert(dataset.length > 0, 'dataset cannot be empty') const X = dataset.map((s) => s[0]) diff --git a/packages/nlu-engine/src/ml/svm/libsvm/reduce-dataset.ts b/packages/nlu-engine/src/ml/svm/libsvm/reduce-dataset.ts index ecca0e01..95ec1f66 100644 --- a/packages/nlu-engine/src/ml/svm/libsvm/reduce-dataset.ts +++ b/packages/nlu-engine/src/ml/svm/libsvm/reduce-dataset.ts @@ -8,7 +8,7 @@ export default function (dataset: Data[], retainedVariance: number) { retainedVariance = retainedVariance || 0.99 const dims = numeric.dim(dataset) - assert(dims[0] > 0 && dims[1] === 2 && dims[2] > 0, 'dataset must be an list of [X,y] tuples') + assert(dims[0] > 0 && dims[1] === 2 && dims[2] > 0, 'dataset must be a list of [X,y] tuples') const inputs = dataset.map(function (ex) { return ex[0] }) diff --git a/packages/nlu-engine/src/typings.d.ts b/packages/nlu-engine/src/typings.d.ts index c9fcedab..a1859c79 100644 --- a/packages/nlu-engine/src/typings.d.ts +++ b/packages/nlu-engine/src/typings.d.ts @@ -107,7 +107,7 @@ export type ModelIdService = { areSame: (id1: ModelId, id2: ModelId) => boolean isId: (m: string) => boolean makeId: (factors: ModelIdArgs) => ModelId - briefId: (factors: Partial) => Partial // makes incomplete Id from incomplete information + briefId: (factors: Partial) => Partial // makes incomplete ID from incomplete information halfmd5: (str: string) => string } @@ -187,7 +187,7 @@ export type EntityDefinition = ListEntityDefinition | PatternEntityDefinition * training-pending : when a training was launched, but the training process is not started yet * training: when a chatbot is currently training * canceled: when a training was canceled - * errored: when an unhandled error occured during training + * errored: when an unhandled error occurred during training */ export type TrainingStatus = 'done' | 'training-pending' | 'training' | 'canceled' | 'errored' diff --git a/packages/nlu-engine/src/utils/watch-dog.ts b/packages/nlu-engine/src/utils/watch-dog.ts index a2c74499..11e5f16a 100644 --- a/packages/nlu-engine/src/utils/watch-dog.ts +++ b/packages/nlu-engine/src/utils/watch-dog.ts @@ -42,10 +42,10 @@ export type WatchDog = { * * Basically the opposite of a throttle. * Ensures a function is executed at least every x ms. - * Running the function mannualy only resets the timmer. + * Running the function manually only resets the timmer. * * @param f Function to run - * @param ms Max allowed time beetween function invocation + * @param ms Max allowed time between function invocation * @returns a watchdog object that can be ran or stopped */ export const watchDog = (f: Func, ms: number): WatchDog => { diff --git a/packages/nlu-server/readme.md b/packages/nlu-server/readme.md index ca370b1c..2e0d259c 100644 --- a/packages/nlu-server/readme.md +++ b/packages/nlu-server/readme.md @@ -8,7 +8,7 @@ This package contains the Botpress Standalone NLU server. Available Routes /** - * Gets the current version of the NLU engine being used. Usefull to test if your installation is working. + * Gets the current version of the NLU engine being used. Useful to test if your installation is working. * @returns info: version, health and supported languages. */ GET http://HOST:PORT/v1/info @@ -20,8 +20,8 @@ This package contains the Botpress Standalone NLU server. * @body_parameter intents Intents definitions. * @body_parameter contexts All available contexts. * @body_parameter entities Entities definitions. - * @body_parameter seed Number to seed random number generators used during training (beta feature). ** Optionnal ** - * @returns modelId A model id for futur API calls + * @body_parameter seed Number to seed random number generators used during training (beta feature). ** Optional ** + * @returns modelId A model id for future API calls */ POST http://HOST:PORT/v1/train @@ -34,7 +34,7 @@ This package contains the Botpress Standalone NLU server. GET http://HOST:PORT/v1/train/:modelId /** - * List all models for a given app Id and secret. + * List all models for a given app ID and secret. * @header x-app-id Application ID to make sure there's no collision between models of different applications. * @path_parameter modelId The model id for which you seek the training progress. * @returns models Array of strings model ids available for prediction. @@ -61,7 +61,7 @@ This package contains the Botpress Standalone NLU server. * @header x-app-id Application ID to make sure there's no collision between models of different applications. * @path_parameter modelId The model id you want to use for prediction. * @body_parameter utterances Array of text for which you want a prediction. - * @returns predictions Array of predictions; Each prediction is a data structure reprensenting the understanding of the text. + * @returns predictions Array of predictions; Each prediction is a data structure representing the understanding of the text. */ POST http://HOST:PORT/v1/predict/:modelId @@ -70,7 +70,7 @@ This package contains the Botpress Standalone NLU server. * @header x-app-id Application ID to make sure there's no collision between models of different applications. * @path_parameter modelId The model id you want to use for prediction. * @body_parameter utterances Array of text for which you want a prediction. - * @body_parameter models Array of strings model ids you want to use to detect language. ** Optionnal ** + * @body_parameter models Array of strings model ids you want to use to detect language. ** Optional ** * @returns detectedLanguages Array of string language codes. */ POST http://HOST:PORT/v1/detect-lang @@ -100,4 +100,4 @@ The NLU Server's only purpose is to do NLU. ## Licensing -This software is protected by the same license as the [main Botpress repository](https://github.com/botpress/botpress). You can find the license file [here](https://github.com/botpress/botpress/blob/master/LICENSE). +This software is protected by the same [license](https://github.com/botpress/botpress/blob/master/LICENSE) as the [main Botpress repository](https://github.com/botpress/botpress). diff --git a/packages/nlu-server/src/api/index.ts b/packages/nlu-server/src/api/index.ts index 7b330d9e..cb5f0c2d 100644 --- a/packages/nlu-server/src/api/index.ts +++ b/packages/nlu-server/src/api/index.ts @@ -92,7 +92,7 @@ export const createAPI = async ( await usageClient.sendUsage('nlu', type, [value]) } catch (thrown) { const err = thrown instanceof Error ? thrown : new Error(`${thrown}`) - usageLogger.attachError(err).error(`an error occured when sending "${type}" usage.`) + usageLogger.attachError(err).error(`an error occurred when sending "${type}" usage.`) } }) } diff --git a/packages/nlu-server/src/api/routers/root.ts b/packages/nlu-server/src/api/routers/root.ts index e647e97b..93905292 100644 --- a/packages/nlu-server/src/api/routers/root.ts +++ b/packages/nlu-server/src/api/routers/root.ts @@ -211,7 +211,7 @@ export const createRootRouter = (options: NLUServerOptions, app: Application, ba await app.cancelTraining(appId, modelId) - const resp: http.SuccessReponse = { success: true } + const resp: http.SuccessResponse = { success: true } res.send(resp) return next() } catch (thrown) { @@ -335,7 +335,7 @@ export const createRootRouter = (options: NLUServerOptions, app: Application, ba await app.cancelLinting(appId, modelId, speed) - const resp: http.SuccessReponse = { success: true } + const resp: http.SuccessResponse = { success: true } res.send(resp) return next() } catch (thrown) { diff --git a/packages/nlu-server/src/api/validation/schemas.ts b/packages/nlu-server/src/api/validation/schemas.ts index e336befa..1aaea9e7 100644 --- a/packages/nlu-server/src/api/validation/schemas.ts +++ b/packages/nlu-server/src/api/validation/schemas.ts @@ -1,6 +1,6 @@ import Joi from 'joi' -const ListEntityOccurenceSchema = Joi.object({ +const ListEntityOccurrenceSchema = Joi.object({ name: Joi.string().required(), // ex: 'Paris', 'Montreal', 'Québec' synonyms: Joi.array() // ex: 'La Ville des lumières', 'City of Paris' .items(Joi.string()) @@ -10,7 +10,7 @@ const ListEntityOccurenceSchema = Joi.object({ const ListEntitySchema = Joi.object().keys({ name: Joi.string().required(), // ex: 'cities' - values: Joi.array().items(ListEntityOccurenceSchema).required().min(1), + values: Joi.array().items(ListEntityOccurrenceSchema).required().min(1), fuzzy: Joi.number().default(0.9) }) diff --git a/packages/nlu-server/src/application/errors.ts b/packages/nlu-server/src/application/errors.ts index 747cbc33..a4de85b6 100644 --- a/packages/nlu-server/src/application/errors.ts +++ b/packages/nlu-server/src/application/errors.ts @@ -58,14 +58,14 @@ export class LintingAlreadyStartedError extends ResponseError { export class LangServerCommError extends ResponseError { constructor(err: Error) { const { message } = err - super(`An error occured during communication with language server: ${message}`, 500) + super(`An error occurred during communication with language server: ${message}`, 500) } } export class DucklingCommError extends ResponseError { constructor(err: Error) { const { message } = err - super(`An error occured during communication with Duckling server: ${message}`, 500) + super(`An error occurred during communication with Duckling server: ${message}`, 500) } } diff --git a/packages/nlu-server/src/application/linting-queue/index.ts b/packages/nlu-server/src/application/linting-queue/index.ts index a94d4180..177a4f10 100644 --- a/packages/nlu-server/src/application/linting-queue/index.ts +++ b/packages/nlu-server/src/application/linting-queue/index.ts @@ -83,9 +83,9 @@ export class PgLintingQueue extends LintingQueue { baseLogger: Logger, opt: LintQueueOptions = {} ) { - const lintingLoger = baseLogger.sub(LINTING_PREFIX) + const lintingLogger = baseLogger.sub(LINTING_PREFIX) const lintTaskRepo = new LintTaskRepo(lintingRepo) - const lintHandler = new LintHandler(engine, lintingLoger) + const lintHandler = new LintHandler(engine, lintingLogger) const options = opt.maxLinting ? { ...TASK_OPTIONS, @@ -93,8 +93,8 @@ export class PgLintingQueue extends LintingQueue { } : TASK_OPTIONS - const taskQueue = new q.PGDistributedTaskQueue(pgURL, lintTaskRepo, lintHandler, lintingLoger, idToString, options) - super(taskQueue, lintingLoger) + const taskQueue = new q.PGDistributedTaskQueue(pgURL, lintTaskRepo, lintHandler, lintingLogger, idToString, options) + super(taskQueue, lintingLogger) } } diff --git a/packages/nlu-server/src/application/serialize-model.ts b/packages/nlu-server/src/application/serialize-model.ts index 1cdbe9bd..bd79eee0 100644 --- a/packages/nlu-server/src/application/serialize-model.ts +++ b/packages/nlu-server/src/application/serialize-model.ts @@ -16,7 +16,7 @@ const PTBModel = new ptb.PTBMessage('Model', { data: { type: 'bytes', id: 4, rule: 'required' } }) -/** usefull to retreive only model id from binary */ +/** useful to retrieve only model id from binary */ const PTBPartialModel = new ptb.PTBMessage('Model', { id: { type: PTBModelId, id: 1, rule: 'required' } }) diff --git a/packages/nlu-server/src/application/training-queue/train-handler.ts b/packages/nlu-server/src/application/training-queue/train-handler.ts index edaaa0dd..8022ca39 100644 --- a/packages/nlu-server/src/application/training-queue/train-handler.ts +++ b/packages/nlu-server/src/application/training-queue/train-handler.ts @@ -55,12 +55,12 @@ export class TrainHandler implements TrainTaskRunner { let type: TrainingErrorType = 'internal' if (err instanceof NLUEngine.errors.LangServerError) { type = 'lang-server' - this.logger.attachError(err).error(`[${trainKey}] Error occured with Language Server.`) + this.logger.attachError(err).error(`[${trainKey}] Error occurred with Language Server.`) } if (err instanceof NLUEngine.errors.DucklingServerError) { type = 'duckling-server' - this.logger.attachError(err).error(`[${trainKey}] Error occured with Duckling Server.`) + this.logger.attachError(err).error(`[${trainKey}] Error occurred with Duckling Server.`) } task.data = { trainingTime: this._getTrainingTime(startTime) } @@ -68,7 +68,7 @@ export class TrainHandler implements TrainTaskRunner { task.error = { message, stack, type } if (type === 'internal') { - this.logger.attachError(err as Error).error(`[${trainKey}] Error occured during training.`) + this.logger.attachError(err as Error).error(`[${trainKey}] Error occurred during training.`) } return { ...task, status: 'errored' } diff --git a/packages/nlu-server/src/bootstrap/documentation.ts b/packages/nlu-server/src/bootstrap/documentation.ts index 23b8dc66..e5e1c639 100644 --- a/packages/nlu-server/src/bootstrap/documentation.ts +++ b/packages/nlu-server/src/bootstrap/documentation.ts @@ -15,7 +15,7 @@ export const displayDocumentation = (logger: Logger, options: NLUServerOptions) {bold {underline Important Routes}} {green /** - * Gets the current version of the NLU engine being used. Usefull to test if your installation is working. + * Gets the current version of the NLU engine being used. Useful to test if your installation is working. * @returns {bold info}: version and supported languages. */} {bold GET ${baseUrl}/info} @@ -27,8 +27,8 @@ export const displayDocumentation = (logger: Logger, options: NLUServerOptions) * @body_parameter {bold intents} Intents definitions. * @body_parameter {bold contexts} All available contexts. * @body_parameter {bold entities} Entities definitions. - * @body_parameter {bold seed} Number to seed random number generators used during training (beta feature). {yellow ** Optionnal **} - * @returns {bold modelId} A model id for futur API calls + * @body_parameter {bold seed} Number to seed random number generators used during training (beta feature). {yellow ** Optional **} + * @returns {bold modelId} A model id for future API calls */} {bold POST ${baseUrl}/train} @@ -52,7 +52,7 @@ export const displayDocumentation = (logger: Logger, options: NLUServerOptions) * @header {bold x-app-id} Application ID to make sure there's no collision between models of different applications. * @path_parameter {bold modelId} The model id you want to use for prediction. * @body_parameter {bold utterances} Array of text for which you want a prediction. - * @returns {bold predictions} Array of predictions; Each prediction is a data structure reprensenting the understanding of the text. + * @returns {bold predictions} Array of predictions; Each prediction is a data structure representing the understanding of the text. */} {bold POST ${baseUrl}/predict/:modelId} diff --git a/packages/nlu-server/src/infrastructure/linting-repo/db-linting-repo.ts b/packages/nlu-server/src/infrastructure/linting-repo/db-linting-repo.ts index 3e07d837..1f198737 100644 --- a/packages/nlu-server/src/infrastructure/linting-repo/db-linting-repo.ts +++ b/packages/nlu-server/src/infrastructure/linting-repo/db-linting-repo.ts @@ -184,8 +184,8 @@ export class DatabaseLintingRepo implements LintingRepository { return Bluebird.map(rows, this._fromLintingRow.bind(this)) } - public async queryOlderThan(query: Partial, treshold: Date): Promise { - const iso = treshold.toISOString() + public async queryOlderThan(query: Partial, threshold: Date): Promise { + const iso = threshold.toISOString() const { status, currentCount, totalCount } = query const rowFilters: Partial = _.pickBy({ status, currentCount, totalCount }, (x) => x !== undefined) const rows: LintingRow[] = await this._lintings.where(rowFilters).where('updatedOn', '<=', iso).select('*') diff --git a/packages/nlu-server/src/infrastructure/linting-repo/typings.ts b/packages/nlu-server/src/infrastructure/linting-repo/typings.ts index 2289a9c5..e6786849 100644 --- a/packages/nlu-server/src/infrastructure/linting-repo/typings.ts +++ b/packages/nlu-server/src/infrastructure/linting-repo/typings.ts @@ -8,7 +8,7 @@ export type LintingRepository = { set(linting: Linting): Promise has(id: LintingId): Promise query(query: Partial): Promise - queryOlderThan(query: Partial, treshold: Date): Promise + queryOlderThan(query: Partial, threshold: Date): Promise } export type LintingId = { diff --git a/packages/nlu-server/src/infrastructure/training-repo/db-training-repo.ts b/packages/nlu-server/src/infrastructure/training-repo/db-training-repo.ts index b3a228cf..f00acaf2 100644 --- a/packages/nlu-server/src/infrastructure/training-repo/db-training-repo.ts +++ b/packages/nlu-server/src/infrastructure/training-repo/db-training-repo.ts @@ -201,7 +201,7 @@ export class DbTrainingRepository implements TrainingRepository { this._listeners.forEach((listener) => { // The await keyword isn't used to prevent a listener from blocking the training repo listener(training).catch((e) => - this._logger.attachError(e).error('an error occured in the training repository listener') + this._logger.attachError(e).error('an error occurred in the training repository listener') ) }) } diff --git a/packages/nlu-server/src/infrastructure/training-repo/in-memory-training-repo.ts b/packages/nlu-server/src/infrastructure/training-repo/in-memory-training-repo.ts index 65e62a12..1437e85e 100644 --- a/packages/nlu-server/src/infrastructure/training-repo/in-memory-training-repo.ts +++ b/packages/nlu-server/src/infrastructure/training-repo/in-memory-training-repo.ts @@ -122,7 +122,7 @@ export class InMemoryTrainingRepo implements TrainingRepository { this._listeners.forEach((listener) => { // The await keyword isn't used to prevent a listener from blocking the training repo listener(training).catch((e) => - this._logger.attachError(e).error('an error occured in the training repository listener') + this._logger.attachError(e).error('an error occurred in the training repository listener') ) }) } diff --git a/packages/node-crfsuite/crfsuite/ChangeLog b/packages/node-crfsuite/crfsuite/ChangeLog index 752330a2..83fb6cb4 100644 --- a/packages/node-crfsuite/crfsuite/ChangeLog +++ b/packages/node-crfsuite/crfsuite/ChangeLog @@ -28,7 +28,7 @@ 2010-07-16 Naoaki Okazaki * CRFsuite 0.11 - - Renamed crf.h into crfsuite.h to avoid possible conflects in include directories + - Renamed crf.h into crfsuite.h to avoid possible conflicts in include directories - Install crfsuite.h to the include directory (suggested by Ingo Glöckner) diff --git a/packages/node-crfsuite/crfsuite/INSTALL b/packages/node-crfsuite/crfsuite/INSTALL index ac00c6b3..c288dd65 100644 --- a/packages/node-crfsuite/crfsuite/INSTALL +++ b/packages/node-crfsuite/crfsuite/INSTALL @@ -191,7 +191,7 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: +overridden in the site shell script). Here is another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash diff --git a/packages/node-crfsuite/crfsuite/include/crfsuite.h b/packages/node-crfsuite/crfsuite/include/crfsuite.h index a5a4fc51..bcc134ae 100644 --- a/packages/node-crfsuite/crfsuite/include/crfsuite.h +++ b/packages/node-crfsuite/crfsuite/include/crfsuite.h @@ -49,7 +49,7 @@ typedef __int32 int32_t; * \addtogroup crfsuite_api CRFSuite C API * @{ * - * The CRFSuite C API provides a low-level library for manupulating + * The CRFSuite C API provides a low-level library for manipulating * CRFSuite in C language. */ @@ -269,7 +269,7 @@ typedef struct { /** * Type of callback function for logging. * @param user Pointer to the user-defined data. - * @param format Format string (compatible with prinf()). + * @param format Format string (compatible with printf()). * @param args Optional arguments for the format string. * @return int \c 0 to continue; non-zero to cancel the training. */ @@ -364,7 +364,7 @@ struct tag_crfsuite_trainer { /** * Data structure that contains a flag. - * The contained flag tells weither or not to cancel the training. + * The contained flag tells whether or not to cancel the training. */ canceller_t * canceller; @@ -408,10 +408,10 @@ struct tag_crfsuite_trainer { /** * Start a training process. * @param trainer The pointer to this trainer instance. - * @param data The poiinter to the data set. + * @param data The pointer to the data set. * @param filename The filename to which the trainer stores the model. * If an empty string is specified, this function - * does not sture the model to a file. + * does not store the model to a file. * @param holdout The holdout group. * @return int The status code. */ @@ -1032,14 +1032,14 @@ void crfsuite_evaluation_finish(crfsuite_evaluation_t* eval); void crfsuite_evaluation_clear(crfsuite_evaluation_t* eval); /** - * Accmulate the correctness of the predicted label sequence. + * Accumulate the correctness of the predicted label sequence. * @param eval The pointer to crfsuite_evaluation_t. * @param reference The reference label sequence. * @param prediction The predicted label sequence. * @param T The length of the label sequence. * @return int \c 0 if succeeded, \c 1 otherwise. */ -int crfsuite_evaluation_accmulate(crfsuite_evaluation_t* eval, const int* reference, const int* prediction, int T); +int crfsuite_evaluation_accumulate(crfsuite_evaluation_t* eval, const int* reference, const int* prediction, int T); /** * Finalize the evaluation result. diff --git a/packages/node-crfsuite/crfsuite/lib/cqdb/include/cqdb.h b/packages/node-crfsuite/crfsuite/lib/cqdb/include/cqdb.h index be9e5649..57d5e651 100644 --- a/packages/node-crfsuite/crfsuite/lib/cqdb/include/cqdb.h +++ b/packages/node-crfsuite/crfsuite/lib/cqdb/include/cqdb.h @@ -88,7 +88,7 @@ enum { * specified. * * It is recommended to keep the maximum number of identifiers as smallest as - * possible because reverse lookup is maintained by a array with the size of + * possible because reverse lookup is maintained by an array with the size of * sizeof(int) * (maximum number of identifiers + 1). For example, putting a * set of integer identifers (0, 1, 1000) creates a reverse lookup array with * 1001 elements only to waste the disk space for 998 (= 1001-3) elements in @@ -158,7 +158,7 @@ int cqdb_writer_close(cqdb_writer_t* dbw); * application to load a database image to a memory block, e.g., to read * the whole image from a file, to use the Memory Mapped File (mmap) API, * etc. - * Secondaly, one can design the file format freely only if the memory + * Secondly, one can design the file format freely only if the memory * block for a database is extracted from the file. * * The most fundamental operation on the CQDB reader API is forward lookup @@ -369,7 +369,7 @@ int main(int argc, char *argv[]) @subsection sample_reader A reader sample -This sample code issues string queries "00000000", ..., "01000000" to retrive +This sample code issues string queries "00000000", ..., "01000000" to retrieve integer identifiers (forward lookups) and integer queries 0, ..., 1000000 to retrieve the strings "00000000", ..., "01000000". @@ -458,7 +458,7 @@ int main(int argc, char *argv[]) @section performance Performance -An experiment for performance comparision with +An experiment for performance comparison with Berkeley DB (BDB) 4.5.20 and Quick Database Manager (QDBM) 1.8.75 was conducted. diff --git a/packages/node-crfsuite/crfsuite/lib/cqdb/src/cqdb.c b/packages/node-crfsuite/crfsuite/lib/cqdb/src/cqdb.c index 9500e93f..b02c747a 100644 --- a/packages/node-crfsuite/crfsuite/lib/cqdb/src/cqdb.c +++ b/packages/node-crfsuite/crfsuite/lib/cqdb/src/cqdb.c @@ -366,7 +366,7 @@ int cqdb_writer_close(cqdb_writer_t* dbw) to the offset succeeding the last key/data pair. */ for (i = 0;i < NUM_TABLES;++i) { - /* Offset to the hash table (or zero for non-existent tables). */ + /* Offset to the hash table (or zero for nonexistent tables). */ write_uint32(dbw, dbw->ht[i].num ? dbw->cur : 0); /* Bucket size is double to the number of elements. */ write_uint32(dbw, dbw->ht[i].num * 2); diff --git a/packages/node-crfsuite/crfsuite/lib/cqdb/src/lookup3.c b/packages/node-crfsuite/crfsuite/lib/cqdb/src/lookup3.c index d5c732b2..af37b8d7 100644 --- a/packages/node-crfsuite/crfsuite/lib/cqdb/src/lookup3.c +++ b/packages/node-crfsuite/crfsuite/lib/cqdb/src/lookup3.c @@ -27,10 +27,10 @@ then use c as the hash value. If you have a variable length array of a character string), use hashlittle(). If you have several byte arrays, or a mix of things, see the comments above hashlittle(). -Why is this so big? I read 12 bytes at a time into 3 4-byte integers, +Why is this so big? I read 12 bytes at a time into three 4-byte integers, then mix those integers. This is fast (you can do a lot more thorough -mixing with 12*3 instructions on 3 integers than you can with 3 instructions -on 1 byte), but shoehorning those bytes into integers efficiently is messy. +mixing with 12*3 instructions on three integers than you can with three instructions +on one byte), but shoehorning those bytes into integers efficiently is messy. ------------------------------------------------------------------------------- */ //#define SELF_TEST 1 @@ -69,7 +69,7 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy. /* ------------------------------------------------------------------------------- -mix -- mix 3 32-bit values reversibly. +mix -- mix three 32-bit values reversibly. This is reversible, so any information in (a,b,c) before mix() is still in (a,b,c) after mix(). @@ -282,7 +282,7 @@ acceptable. Do NOT use for cryptographic purposes. uint32_t hashlittle( const void *key, size_t length, uint32_t initval) { uint32_t a,b,c; /* internal state */ - union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ + union { const void *ptr; size_t i; } u; /* needed for Mac PowerBook G4 */ /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; @@ -450,7 +450,7 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval) /* - * hashlittle2: return 2 32-bit hash values + * hashlittle2: return two 32-bit hash values * * This is identical to hashlittle(), except it returns two 32-bit hash * values instead of just one. This is good enough for hash table @@ -466,7 +466,7 @@ void hashlittle2( uint32_t *pb) /* IN: secondary initval, OUT: secondary hash */ { uint32_t a,b,c; /* internal state */ - union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ + union { const void *ptr; size_t i; } u; /* needed for Mac PowerBook G4 */ /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)length) + *pc; @@ -805,7 +805,7 @@ void driver2() { for (j=0; j<8; ++j) /*------------------------ for each input bit, */ { - for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */ + for (m=1; m<8; ++m) /*------------ for several possible initvals, */ { for (l=0; lcontents[i].aid; crf1dm_get_attrref(model, a, &attr); - /* A scale usually represents the atrribute frequency in the item. */ + /* A scale usually represents the attribute frequency in the item. */ value = item->contents[i].value; /* Loop over the state features associated with the attribute. */ diff --git a/packages/node-crfsuite/crfsuite/lib/crf/src/crfsuite.c b/packages/node-crfsuite/crfsuite/lib/crf/src/crfsuite.c index 3a3c1429..2a9c23ac 100644 --- a/packages/node-crfsuite/crfsuite/lib/crf/src/crfsuite.c +++ b/packages/node-crfsuite/crfsuite/lib/crf/src/crfsuite.c @@ -363,7 +363,7 @@ void crfsuite_evaluation_finish(crfsuite_evaluation_t* eval) memset(eval, 0, sizeof(*eval)); } -int crfsuite_evaluation_accmulate(crfsuite_evaluation_t* eval, const int* reference, const int* prediction, int T) +int crfsuite_evaluation_accumulate(crfsuite_evaluation_t* eval, const int* reference, const int* prediction, int T) { int t, nc = 0; @@ -433,7 +433,7 @@ void crfsuite_evaluation_finalize(crfsuite_evaluation_t* eval) } } - /* Copute the macro precision, recall, and f1-measure values. */ + /* Compute the macro precision, recall, and f1-measure values. */ eval->macro_precision /= eval->num_labels; eval->macro_recall /= eval->num_labels; eval->macro_fmeasure /= eval->num_labels; diff --git a/packages/node-crfsuite/crfsuite/lib/crf/src/holdout.c b/packages/node-crfsuite/crfsuite/lib/crf/src/holdout.c index 6415f6a5..84030e2a 100644 --- a/packages/node-crfsuite/crfsuite/lib/crf/src/holdout.c +++ b/packages/node-crfsuite/crfsuite/lib/crf/src/holdout.c @@ -71,7 +71,7 @@ void holdout_evaluation( gm->set_instance(gm, inst); gm->viterbi(gm, viterbi, &score); - crfsuite_evaluation_accmulate(&eval, inst->labels, viterbi, inst->num_items); + crfsuite_evaluation_accumulate(&eval, inst->labels, viterbi, inst->num_items); } /* Report the performance. */ diff --git a/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.c b/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.c index dd6ec58f..2e07b3c9 100644 --- a/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.c +++ b/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.c @@ -34,7 +34,7 @@ *--------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------- - * DEVELOPEMENT NOTES + * DEVELOPMENT NOTES * * Links * Each node has two links, link[0] is the left child, and link[1] is the @@ -170,7 +170,7 @@ struct rumavl_stack { /***************************************************************************** * - * FORWARD DECLERATIONS + * FORWARD DECLARATIONS * ****************************************************************************/ @@ -202,7 +202,7 @@ static int insert_cb (RUMAVL *t, RUMAVL_NODE *n, void *r1, const void *r2, ****************************************************************************/ /*---------------------------------------------------------------------------- - * rumavl_new - allocates a new RUMAVL object, and initialises it. This is the + * rumavl_new - allocates a new RUMAVL object, and initializes it. This is the * only time the user gets to set the record length and record comparison * function, to avoid data loss. *--------------------------------------------------------------------------*/ @@ -315,9 +315,9 @@ int rumavl_set (RUMAVL *tree, const void *record) } /* Since the tree is not empty, we must descend towards the nodes ideal - * possition, and we may even find an existing node with the same record. + * position, and we may even find an existing node with the same record. * We keep a list parents for the eventual node position, because these - * parents may become inbalanced by a new insertion. */ + * parents may become imbalanced by a new insertion. */ stack = NULL; node = &tree->root; @@ -511,7 +511,7 @@ int rumavl_delete (RUMAVL *tree, const void *record) /* find heaviest subtree */ if ((*node)->balance > 0){ - outdir = +1; /* outter direction */ + outdir = +1; /* outer direction */ dir = -1; /* inner direction */ outln = 1; /* outer link number */ ln = 0; /* inner link number */ @@ -523,7 +523,7 @@ int rumavl_delete (RUMAVL *tree, const void *record) } /* Add node to be deleted to the list of nodes to be rebalanced. - * Rememer that the replacement node will actually be acted apon, + * Remember that the replacement node will actually be acted upon, * and that the replacement node should feel the effect of its own * move */ if (stack_push(tree, &stack, node, outdir) != 0) @@ -870,7 +870,7 @@ static void stack_destroy(RUMAVL *tree, RUMAVL_STACK *stack) /*---------------------------------------------------------------------------- * stack_update - goes up stack readjusting balance as needed. This function - * serves as a testiment to the philosophy of commenting while you code, 'cos + * serves as a testament to the philosophy of commenting while you code, 'cos * hell if I can remember how I got to this. I think is has something to do * with the varying effects on tree height, depending on exactly which sub * tree, or sub-sub tree was modified. TODO study and comment @@ -957,7 +957,7 @@ static int rec_cmp (RUMAVL *tree, const void *reca, const void *recb) /*---------------------------------------------------------------------------- * Balance - rotate or double rotate as needed. Sometimes simply rotating a - * tree is inefficient, as it leaves the tree as inbalanced as it was before + * tree is inefficient, as it leaves the tree as imbalanced as it was before * the rotate. To rectify this, we first rotate the heavier child so that the * heavier grandchild is on the outside, then rotate as per normal. * diff --git a/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.h b/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.h index ff24e634..64e99f63 100644 --- a/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.h +++ b/packages/node-crfsuite/crfsuite/lib/crf/src/rumavl.h @@ -58,7 +58,7 @@ typedef struct rumavl_node RUMAVL_NODE; /*---------------------------------------------------------------------------- - * FUNDEMENTAL FUNCTIONS + * FUNDAMENTAL FUNCTIONS *--------------------------------------------------------------------------*/ /* Create a new RumAVL tree */ diff --git a/packages/node-crfsuite/crfsuite/lib/crf/src/train_arow.c b/packages/node-crfsuite/crfsuite/lib/crf/src/train_arow.c index 4588b163..af14ec74 100644 --- a/packages/node-crfsuite/crfsuite/lib/crf/src/train_arow.c +++ b/packages/node-crfsuite/crfsuite/lib/crf/src/train_arow.c @@ -271,7 +271,7 @@ int crfsuite_train_arow( goto error_exit; } - /* Initialize the covariance vector (diagnal matrix). */ + /* Initialize the covariance vector (diagonal matrix). */ vecset(cov, opt.variance, K); /* Show the parameters. */ diff --git a/packages/node-crfsuite/crfsuite/lib/crf/src/train_passive_aggressive.c b/packages/node-crfsuite/crfsuite/lib/crf/src/train_passive_aggressive.c index c67ece49..73165d10 100644 --- a/packages/node-crfsuite/crfsuite/lib/crf/src/train_passive_aggressive.c +++ b/packages/node-crfsuite/crfsuite/lib/crf/src/train_passive_aggressive.c @@ -367,7 +367,7 @@ int crfsuite_train_passive_aggressive( delta_finalize(&dc); /* - Compute tau (dpending on PA, PA-I, and PA-II). + Compute tau (depending on PA, PA-I, and PA-II). */ norm2 = delta_norm2(&dc); tau = tau_function(cost, norm2, opt.c); diff --git a/packages/node-crfsuite/crfsuite/win32/liblbfgs/lbfgs.h b/packages/node-crfsuite/crfsuite/win32/liblbfgs/lbfgs.h index f343732f..1ff7d4a6 100644 --- a/packages/node-crfsuite/crfsuite/win32/liblbfgs/lbfgs.h +++ b/packages/node-crfsuite/crfsuite/win32/liblbfgs/lbfgs.h @@ -152,7 +152,7 @@ enum { enum { /** The default algorithm (MoreThuente method). */ LBFGS_LINESEARCH_DEFAULT = 0, - /** MoreThuente method proposd by More and Thuente. */ + /** MoreThuente method proposed by More and Thuente. */ LBFGS_LINESEARCH_MORETHUENTE = 0, /** * Backtracking method with the Armijo condition. @@ -164,7 +164,7 @@ enum { * a is the step length. */ LBFGS_LINESEARCH_BACKTRACKING_ARMIJO = 1, - /** The backtracking method with the defualt (regular Wolfe) condition. */ + /** The backtracking method with the default (regular Wolfe) condition. */ LBFGS_LINESEARCH_BACKTRACKING = 2, /** * Backtracking method with regular Wolfe condition. @@ -241,7 +241,7 @@ typedef struct { * The maximum number of iterations. * The lbfgs() function terminates an optimization process with * ::LBFGSERR_MAXIMUMITERATION status code when the iteration count - * exceedes this parameter. Setting this parameter to zero continues an + * exceeds this parameter. Setting this parameter to zero continues an * optimization process until a convergence or error. The default value * is \c 0. */ @@ -303,7 +303,7 @@ typedef struct { * evaluations are inexpensive with respect to the cost of the * iteration (which is sometimes the case when solving very large * problems) it may be advantageous to set this parameter to a small - * value. A typical small value is \c 0.1. This parameter shuold be + * value. A typical small value is \c 0.1. This parameter should be * greater than the \ref ftol parameter (\c 1e-4) and smaller than * \c 1.0. */ @@ -319,12 +319,12 @@ typedef struct { lbfgsfloatval_t xtol; /** - * Coeefficient for the L1 norm of variables. + * Coefficient for the L1 norm of variables. * This parameter should be set to zero for standard minimization * problems. Setting this parameter to a positive value activates * Orthant-Wise Limited-memory Quasi-Newton (OWL-QN) method, which * minimizes the objective function F(x) combined with the L1 norm |x| - * of the variables, {F(x) + C |x|}. This parameter is the coeefficient + * of the variables, {F(x) + C |x|}. This parameter is the coefficient * for the |x|, i.e., C. As the L1 norm |x| is not differentiable at * zero, the library modifies function and gradient evaluations from * a client program suitably; a client program thus have only to return @@ -498,7 +498,7 @@ void lbfgs_parameter_init(lbfgs_parameter_t *param); * Allocate an array for variables. * * This function allocates an array of variables for the convenience of - * ::lbfgs function; the function has a requreiemt for a variable array + * ::lbfgs function; the function has a requirement for a variable array * when libLBFGS is built with SSE/SSE2 optimization routines. A user does * not have to use this function for libLBFGS built without SSE/SSE2 * optimization. @@ -533,7 +533,7 @@ Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) method written by Jorge Nocedal. The original FORTRAN source code is available at: http://www.ece.northwestern.edu/~nocedal/lbfgs.html -The L-BFGS method solves the unconstrainted minimization problem, +The L-BFGS method solves the unconstrained minimization problem,
     minimize F(x), x = (x1, x2, ..., xN),
@@ -670,7 +670,7 @@ libLBFGS is distributed under the term of the
     - Configure script for POSIX environments.
     - SSE/SSE2 optimizations with GCC.
     - New functions ::lbfgs_malloc and ::lbfgs_free to use SSE/SSE2 routines
-      transparently. It is uncessary to use these functions for libLBFGS built
+      transparently. It is unnecessary to use these functions for libLBFGS built
       without SSE/SSE2 routines; you can still use any memory allocators if
       SSE/SSE2 routines are disabled in libLBFGS.
 - Version 1.3 (2007-12-16):
@@ -732,7 +732,7 @@ Special thanks go to:
     - Kevin S. Van Horn, Nic Schraudolph, and Tamas Nepusz for bug fixes
 
 Finally I would like to thank the original author, Jorge Nocedal, who has been
-distributing the effieicnt and explanatory implementation in an open source
+distributing the efficient and explanatory implementation in an open source
 licence.
 
 @section reference Reference
diff --git a/packages/node-crfsuite/crfsuite/win32/stdint.h b/packages/node-crfsuite/crfsuite/win32/stdint.h
index 7fafda1c..5fadcd91 100644
--- a/packages/node-crfsuite/crfsuite/win32/stdint.h
+++ b/packages/node-crfsuite/crfsuite/win32/stdint.h
@@ -74,7 +74,7 @@
  *       include stdint.h.  The hope is that one or the other can be
  *       used with no real difference.
  *
- *    5) In the current verison, if your platform can't represent
+ *    5) In the current version, if your platform can't represent
  *       int32_t, int16_t and int8_t, it just dumps out with a compiler
  *       error.
  *
@@ -522,7 +522,7 @@
 
 /*
  *  Because this file currently only supports platforms which have
- *  precise powers of 2 as bit sizes for the default integers, the
+ *  precise powers of two as bit sizes for the default integers, the
  *  least definitions are all trivial.  Its possible that a future
  *  version of this file could have different definitions.
  */
diff --git a/packages/node-crfsuite/liblbfgs/doc/doxyfile b/packages/node-crfsuite/liblbfgs/doc/doxyfile
index 6e2c91d0..98ea7cd2 100644
--- a/packages/node-crfsuite/liblbfgs/doc/doxyfile
+++ b/packages/node-crfsuite/liblbfgs/doc/doxyfile
@@ -536,7 +536,7 @@ WARN_IF_UNDOCUMENTED   = YES
 
 WARN_IF_DOC_ERROR      = YES
 
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for
 # functions that are documented, but have no documentation for their parameters
 # or return value. If set to NO (the default) doxygen will only warn about
 # wrong or incomplete parameter documentation, but not about the absence of
diff --git a/packages/node-crfsuite/liblbfgs/include/lbfgs.h b/packages/node-crfsuite/liblbfgs/include/lbfgs.h
index c54d1c87..ff884aee 100644
--- a/packages/node-crfsuite/liblbfgs/include/lbfgs.h
+++ b/packages/node-crfsuite/liblbfgs/include/lbfgs.h
@@ -324,7 +324,7 @@ typedef struct {
      *  problems. Setting this parameter to a positive value activates
      *  Orthant-Wise Limited-memory Quasi-Newton (OWL-QN) method, which
      *  minimizes the objective function F(x) combined with the L1 norm |x|
-     *  of the variables, {F(x) + C |x|}. This parameter is the coeefficient
+     *  of the variables, {F(x) + C |x|}. This parameter is the coefficient
      *  for the |x|, i.e., C. As the L1 norm |x| is not differentiable at
      *  zero, the library modifies function and gradient evaluations from
      *  a client program suitably; a client program thus have only to return
@@ -498,7 +498,7 @@ void lbfgs_parameter_init(lbfgs_parameter_t *param);
  * Allocate an array for variables.
  *
  *  This function allocates an array of variables for the convenience of
- *  ::lbfgs function; the function has a requreiemt for a variable array
+ *  ::lbfgs function; the function has a requirement for a variable array
  *  when libLBFGS is built with SSE/SSE2 optimization routines. A user does
  *  not have to use this function for libLBFGS built without SSE/SSE2
  *  optimization.
diff --git a/packages/node-crfsuite/src/initialize.ts b/packages/node-crfsuite/src/initialize.ts
index cd54d4a8..02a4cab1 100644
--- a/packages/node-crfsuite/src/initialize.ts
+++ b/packages/node-crfsuite/src/initialize.ts
@@ -120,9 +120,9 @@ const parseDirName = (dirName: string): ExtensionDir | undefined => {
   }
 }
 
-const acquireLock = (ressource: string): Promise => {
+const acquireLock = (resource: string): Promise => {
   return new Promise((resolve) => {
-    lock(ressource, (releaser) => {
+    lock(resource, (releaser) => {
       resolve({ release: releaser() })
     })
   })
@@ -182,14 +182,14 @@ const initialize = async (): Promise => {
         debuglog('success')
         return binding
       } catch (err) {
-        debuglog('error occured: ', err)
+        debuglog('error occurred: ', err)
       }
     }
 
     throw new Error(`Linux distribution ${rawDistribution} is not supported by ${packageName}.`)
   }
 
-  throw new Error(`The plateform ${distro.os} is not supported by ${packageName}.`)
+  throw new Error(`The platform ${distro.os} is not supported by ${packageName}.`)
 }
 
 let binding: any | undefined
diff --git a/packages/node-fasttext/README.md b/packages/node-fasttext/README.md
index 195fa638..6c49d31b 100644
--- a/packages/node-fasttext/README.md
+++ b/packages/node-fasttext/README.md
@@ -31,7 +31,7 @@ classifier.predict('Why not put knives in the dishwasher?', 5).then((res) => {
 })
 ```
 
-The model haved trained before with the followings params:
+The model was trained before with the followings params:
 
 ```js
 const path = require('path')
diff --git a/packages/node-fasttext/cppsrc/node-argument.cc b/packages/node-fasttext/cppsrc/node-argument.cc
index 53014ba7..2ede5937 100644
--- a/packages/node-fasttext/cppsrc/node-argument.cc
+++ b/packages/node-fasttext/cppsrc/node-argument.cc
@@ -1,5 +1,5 @@
 /**
- * Convert node object arugment to standar argv C or C++ argument
+ * Convert node object argument to standard argv C or C++ argument
  *
  * Author: Yusuf Syaifudin
  * Date: December 6, 2016 10:57 AM
@@ -30,7 +30,7 @@ bool NodeArgument::isOnlyDouble(const char *str)
 }
 
 /**
-   * Concenate string
+   * Concatenate string
    */
 char *NodeArgument::concat(const char *s1, const char *s2)
 {
diff --git a/packages/node-fasttext/cppsrc/node-argument.h b/packages/node-fasttext/cppsrc/node-argument.h
index 3da6d324..f8bcab72 100644
--- a/packages/node-fasttext/cppsrc/node-argument.h
+++ b/packages/node-fasttext/cppsrc/node-argument.h
@@ -1,5 +1,5 @@
 /**
- * This is header file to convert node object arugment to standar argv C or C++ argument
+ * This is header file to convert node object argument to standard argv C or C++ argument
  *
  * Author: Yusuf Syaifudin
  * Date: December 6, 2016 10:57 AM
diff --git a/packages/node-fasttext/fastText/README.md b/packages/node-fasttext/fastText/README.md
index 10c30230..511b8642 100644
--- a/packages/node-fasttext/fastText/README.md
+++ b/packages/node-fasttext/fastText/README.md
@@ -266,7 +266,7 @@ The following arguments for training are optional:
 
 The following arguments for quantization are optional:
   -cutoff             number of words and ngrams to retain [0]
-  -retrain            finetune embeddings if a cutoff is applied [0]
+  -retrain            fine-tune embeddings if a cutoff is applied [0]
   -qnorm              quantizing the norm separately [0]
   -qout               quantizing the classifier [0]
   -dsub               size of each sub-vector [2]
diff --git a/packages/node-fasttext/fastText/src/args.cc b/packages/node-fasttext/fastText/src/args.cc
index 7ac8c2f8..363c2148 100644
--- a/packages/node-fasttext/fastText/src/args.cc
+++ b/packages/node-fasttext/fastText/src/args.cc
@@ -252,9 +252,9 @@ void Args::printBasicHelp() {
 
 void Args::printDictionaryHelp() {
   std::cerr << "\nThe following arguments for the dictionary are optional:\n"
-            << "  -minCount           minimal number of word occurences ["
+            << "  -minCount           minimal number of word occurrences ["
             << minCount << "]\n"
-            << "  -minCountLabel      minimal number of label occurences ["
+            << "  -minCountLabel      minimal number of label occurrences ["
             << minCountLabel << "]\n"
             << "  -wordNgrams         max length of word ngram [" << wordNgrams
             << "]\n"
@@ -312,7 +312,7 @@ void Args::printQuantizationHelp() {
       << "\nThe following arguments for quantization are optional:\n"
       << "  -cutoff             number of words and ngrams to retain ["
       << cutoff << "]\n"
-      << "  -retrain            whether embeddings are finetuned if a cutoff "
+      << "  -retrain            whether embeddings are fine-tuned if a cutoff "
          "is applied ["
       << boolToString(retrain) << "]\n"
       << "  -qnorm              whether the norm is quantized separately ["
diff --git a/packages/node-fasttext/fastText/src/fasttext.cc b/packages/node-fasttext/fastText/src/fasttext.cc
index 4c7c87f4..33d32c7d 100644
--- a/packages/node-fasttext/fastText/src/fasttext.cc
+++ b/packages/node-fasttext/fastText/src/fasttext.cc
@@ -259,7 +259,7 @@ void FastText::loadModel(std::istream& in) {
     throw std::invalid_argument(
         "Invalid model file.\n"
         "Please download the updated model from www.fasttext.cc.\n"
-        "See issue #332 on Github for more information.\n");
+        "See issue #332 on GitHub for more information.\n");
   }
 
   in.read((char*)&args_->qout, sizeof(bool));
diff --git a/packages/node-fasttext/src/initialize.ts b/packages/node-fasttext/src/initialize.ts
index cd54d4a8..02a4cab1 100644
--- a/packages/node-fasttext/src/initialize.ts
+++ b/packages/node-fasttext/src/initialize.ts
@@ -120,9 +120,9 @@ const parseDirName = (dirName: string): ExtensionDir | undefined => {
   }
 }
 
-const acquireLock = (ressource: string): Promise => {
+const acquireLock = (resource: string): Promise => {
   return new Promise((resolve) => {
-    lock(ressource, (releaser) => {
+    lock(resource, (releaser) => {
       resolve({ release: releaser() })
     })
   })
@@ -182,14 +182,14 @@ const initialize = async (): Promise => {
         debuglog('success')
         return binding
       } catch (err) {
-        debuglog('error occured: ', err)
+        debuglog('error occurred: ', err)
       }
     }
 
     throw new Error(`Linux distribution ${rawDistribution} is not supported by ${packageName}.`)
   }
 
-  throw new Error(`The plateform ${distro.os} is not supported by ${packageName}.`)
+  throw new Error(`The platform ${distro.os} is not supported by ${packageName}.`)
 }
 
 let binding: any | undefined
diff --git a/packages/node-fasttext/src/typings.d.ts b/packages/node-fasttext/src/typings.d.ts
index 3deed57f..1fa9ea89 100644
--- a/packages/node-fasttext/src/typings.d.ts
+++ b/packages/node-fasttext/src/typings.d.ts
@@ -50,7 +50,7 @@ export type Options = {
 
   // The following arguments for quantization are optional
   cutoff: number // number of words and ngrams to retain [0]
-  retrain: boolean // finetune embeddings if a cutoff is applied [0]
+  retrain: boolean // fine-tune embeddings if a cutoff is applied [0]
   qnorm: boolean // quantizing the norm separately [0]
   qout: boolean // quantizing the classifier [0]
   dsub: number // size of each sub-vector [2]
diff --git a/packages/node-sentencepiece/README.md b/packages/node-sentencepiece/README.md
index 1a6aa421..20b98460 100644
--- a/packages/node-sentencepiece/README.md
+++ b/packages/node-sentencepiece/README.md
@@ -17,7 +17,7 @@ note : windows users also need [Build Tools for Visual Studio package](https://v
    `>> node`
 1. require node-sentencepiece package  
    `(node) var sp = require('./node-sentencepiece')`
-1. instanciate a processor  
+1. instantiate a processor  
    `(node) var proc = await makeProcessor()`
 1. load a model  
    `(node) proc.loadModel('/path/to/model/m.model')`
@@ -39,7 +39,7 @@ note : windows users also need [Build Tools for Visual Studio package](https://v
 
    `(node) var outputText = proc.decode(pieces, modelPath)`
 
-   `(node) inputText === outpuText`
+   `(node) inputText === outputText`
 
    returns:  
    `true`
diff --git a/packages/node-sentencepiece/sentencepiece/CMakeLists.txt b/packages/node-sentencepiece/sentencepiece/CMakeLists.txt
index 37f8480b..891b4575 100644
--- a/packages/node-sentencepiece/sentencepiece/CMakeLists.txt
+++ b/packages/node-sentencepiece/sentencepiece/CMakeLists.txt
@@ -18,7 +18,7 @@ message(STATUS "VERSION: ${SPM_VERSION}")
 project(sentencepiece VERSION ${SPM_VERSION} LANGUAGES C CXX)
 
 option(SPM_ENABLE_NFKC_COMPILE "Enables NFKC compile" OFF)
-option(SPM_ENABLE_SHARED "Builds shared libaries in addition to static libraries." ON)
+option(SPM_ENABLE_SHARED "Builds shared libraries in addition to static libraries." ON)
 option(SPM_BUILD_TEST "Builds test binaries." OFF)
 option(SPM_COVERAGE "Runs gcov to test coverage." OFF)
 option(SPM_ENABLE_TENSORFLOW_SHARED "Makes a tensorflow compatible shared file." OFF)
diff --git a/packages/node-sentencepiece/sentencepiece/CONTRIBUTING.md b/packages/node-sentencepiece/sentencepiece/CONTRIBUTING.md
index 06385909..12d96c0a 100644
--- a/packages/node-sentencepiece/sentencepiece/CONTRIBUTING.md
+++ b/packages/node-sentencepiece/sentencepiece/CONTRIBUTING.md
@@ -17,7 +17,7 @@ frustration later on.
 
 ### Code reviews
 All submissions, including submissions by project members, require review. We
-use Github pull requests for this purpose.
+use GitHub pull requests for this purpose.
 
 ### The small print
 Contributions made by corporations are covered by a different agreement than
diff --git a/packages/node-sentencepiece/sentencepiece/README.md b/packages/node-sentencepiece/sentencepiece/README.md
index 624b9e32..50878098 100644
--- a/packages/node-sentencepiece/sentencepiece/README.md
+++ b/packages/node-sentencepiece/sentencepiece/README.md
@@ -165,7 +165,7 @@ See [tensorflow/README.md](tensorflow/README.md)
   the input with Unicode NFKC. You can pass a comma-separated list of files.
 * `--model_prefix`: output model name prefix. `.model` and `.vocab` are generated.
 * `--vocab_size`: vocabulary size, e.g., 8000, 16000, or 32000
-* `--character_coverage`: amount of characters covered by the model, good defaults are: `0.9995` for languages with rich character set like Japanse or Chinese and `1.0` for other languages with small character set.
+* `--character_coverage`: amount of characters covered by the model, good defaults are: `0.9995` for languages with rich character set like Japanese or Chinese and `1.0` for other languages with small character set.
 * `--model_type`: model type. Choose from `unigram` (default), `bpe`, `char`, or `word`. The input sentence must be pretokenized when using `word` type.
 
 Use `--help` flag to display all parameters for training.
diff --git a/packages/node-sentencepiece/sentencepiece/src/bpe_model.cc b/packages/node-sentencepiece/sentencepiece/src/bpe_model.cc
index 86f33d73..2edf569c 100644
--- a/packages/node-sentencepiece/sentencepiece/src/bpe_model.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/bpe_model.cc
@@ -56,7 +56,7 @@ std::vector> Model::Encode(
 
   struct Symbol {
     int prev;     // prev index of this symbol. -1 for BOS.
-    int next;     // next index of tihs symbol. -1 for EOS.
+    int next;     // next index of this symbol. -1 for EOS.
     bool freeze;  // this symbol is never be merged.
     absl::string_view piece;
   };
diff --git a/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.cc b/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.cc
index 19016224..5c7284d5 100644
--- a/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.cc
@@ -90,7 +90,7 @@ void Trainer::ComputeFreq(Symbol *symbol) const {
     // remove the second one to avoid double counts.
     // If the right symbol in the first bigram and the left symbol in the
     // second bigram have the same position, (pos.left == prev_pos.right),
-    // duplicated bigram exisit.
+    // duplicated bigram exists.
     // Also, symbols_[sid][left] and symbols_[sid]right] must store
     // the same symbols in symbol->left and symbols->right.
     if ((pos.sid == prev_pos.sid && pos.left == prev_pos.right) ||
@@ -215,8 +215,8 @@ util::Status Trainer::Train() {
   // Main loop.
   CHECK_OR_RETURN(final_pieces_.empty());
   while (final_pieces_.size() < static_cast(vocab_size)) {
-    constexpr int kUpdateActiveSymbolsInteval = 100;
-    if (final_pieces_.size() % kUpdateActiveSymbolsInteval == 0) {
+    constexpr int kUpdateActiveSymbolsInterval = 100;
+    if (final_pieces_.size() % kUpdateActiveSymbolsInterval == 0) {
       UpdateActiveSymbols();
     }
 
@@ -268,7 +268,7 @@ util::Status Trainer::Train() {
       const Position pos = DecodePos(encoded_pos);
 
       if (symbols_[pos.sid][pos.left] == nullptr) {
-        // left index might be NULL (set in the privous iteration)
+        // left index might be NULL (set in the previous iteration)
         // when left_symbol == right_symbol.
         continue;
       }
diff --git a/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.h b/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.h
index 79d678f6..061fd51c 100644
--- a/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.h
+++ b/packages/node-sentencepiece/sentencepiece/src/bpe_model_trainer.h
@@ -40,7 +40,7 @@ class Trainer : public TrainerInterface {
   struct Symbol {
     const Symbol *left;              // left symbol in bigram
     const Symbol *right;             // right symbol in bigram
-    string_util::UnicodeText chars;  // all flattend chracter sequence
+    string_util::UnicodeText chars;  // all flattened character sequence
     bool is_unk;                     // true if this symbol is unknown.
     uint64 fp;                       // fingerprint of this symbol.
     uint64 freq;                     // frequency of this symbol.
@@ -100,7 +100,7 @@ class Trainer : public TrainerInterface {
   // Adds it to symbols_cache_ and active_symbols_.
   void AddNewPair(int sid, int left, int right);
 
-  // Resets the fequency of bigram [symbols_[sid][left] symbols_[sid][right]],
+  // Resets the frequency of bigram [symbols_[sid][left] symbols_[sid][right]],
   // if this bigram is not |best|.
   void ResetFreq(int sid, int left, int right, const Symbol *best);
 
@@ -114,7 +114,7 @@ class Trainer : public TrainerInterface {
   // Set of symbols from which we find the best symbol in each iteration.
   std::set active_symbols_;
 
-  // Stores symbols allocated in heap so that we can delete them at onece.
+  // Stores symbols allocated in heap so that we can delete them at once.
   std::vector allocated_;
 
   // Sentences. symbols_[sid][index] stores a symbol in sentence_[sid][index].
diff --git a/packages/node-sentencepiece/sentencepiece/src/builder.cc b/packages/node-sentencepiece/sentencepiece/src/builder.cc
index a5425277..f3a0b175 100644
--- a/packages/node-sentencepiece/sentencepiece/src/builder.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/builder.cc
@@ -202,7 +202,7 @@ util::Status Builder::CompileCharsMap(const CharsMap &chars_map,
     max_nodes_size = std::max(num_nodes, max_nodes_size);
   }
   CHECK_LT_OR_RETURN(max_nodes_size, Normalizer::kMaxTrieResultsSize)
-      << "This charmaps contain many shared prefix. "
+      << "This chars map contains many shared prefix. "
       << "The number of shared prefix must be less than "
       << Normalizer::kMaxTrieResultsSize;
 
@@ -480,7 +480,7 @@ util::Status Builder::BuildNmtNFKC_CFMap(CharsMap *chars_map) {
 // static
 util::Status Builder::LoadCharsMap(absl::string_view filename,
                                    CharsMap *chars_map) {
-  LOG(INFO) << "Loading maping file: " << filename.data();
+  LOG(INFO) << "Loading mapping file: " << filename.data();
   CHECK_OR_RETURN(chars_map);
 
   auto input = filesystem::NewReadableFile(filename);
diff --git a/packages/node-sentencepiece/sentencepiece/src/builder_test.cc b/packages/node-sentencepiece/sentencepiece/src/builder_test.cc
index 93bad31d..d7675d93 100644
--- a/packages/node-sentencepiece/sentencepiece/src/builder_test.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/builder_test.cc
@@ -164,7 +164,7 @@ TEST(BuilderTest, LoadCharsMapTest) {
 #endif
 }
 
-TEST(BuilderTest, LoadCharsMapWithEmptyeTest) {
+TEST(BuilderTest, LoadCharsMapWithEmptyTest) {
   test::ScopedTempFile test_tsv("test.tsv");
   test::ScopedTempFile test_out_tsv("test_out.tsv");
   {
diff --git a/packages/node-sentencepiece/sentencepiece/src/error.cc b/packages/node-sentencepiece/sentencepiece/src/error.cc
index 30f1da9a..fe3b54c9 100644
--- a/packages/node-sentencepiece/sentencepiece/src/error.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/error.cc
@@ -139,7 +139,7 @@ std::string Status::ToString() const {
       result = "Data loss";
       break;
     default:
-      result = "Unkown code:";
+      result = "Unknown code:";
       break;
   }
 
diff --git a/packages/node-sentencepiece/sentencepiece/src/flags.cc b/packages/node-sentencepiece/sentencepiece/src/flags.cc
index 99432f9a..c493e7e7 100644
--- a/packages/node-sentencepiece/sentencepiece/src/flags.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/flags.cc
@@ -58,7 +58,7 @@ bool SetFlag(const std::string &name, const std::string &value) {
   std::string v = value;
   Flag *flag = it->second;
 
-  // If empty value is set, we assume true or emtpy string is set
+  // If empty value is set, we assume true or empty string is set
   // for boolean or string option. With other types, setting fails.
   if (value.empty()) {
     switch (flag->type) {
@@ -133,10 +133,10 @@ bool CommandLineGetFlag(int argc, char **argv, std::string *key,
 }  // namespace
 
 FlagRegister::FlagRegister(const char *name, void *storage,
-                           const void *default_storage, int shortype,
+                           const void *default_storage, int shorttype,
                            const char *help)
     : flag_(new Flag) {
-  flag_->type = shortype;
+  flag_->type = shorttype;
   flag_->storage = storage;
   flag_->default_storage = default_storage;
   flag_->help = help;
diff --git a/packages/node-sentencepiece/sentencepiece/src/flags.h b/packages/node-sentencepiece/sentencepiece/src/flags.h
index 2b7dac34..84ed19c4 100644
--- a/packages/node-sentencepiece/sentencepiece/src/flags.h
+++ b/packages/node-sentencepiece/sentencepiece/src/flags.h
@@ -29,7 +29,7 @@ struct Flag;
 class FlagRegister {
  public:
   FlagRegister(const char *name, void *storage, const void *default_storage,
-               int shorttpe, const char *help);
+               int shorttype, const char *help);
   ~FlagRegister();
 
  private:
diff --git a/packages/node-sentencepiece/sentencepiece/src/normalizer.cc b/packages/node-sentencepiece/sentencepiece/src/normalizer.cc
index e56503fb..c9657c2f 100644
--- a/packages/node-sentencepiece/sentencepiece/src/normalizer.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/normalizer.cc
@@ -239,7 +239,7 @@ std::pair Normalizer::NormalizePrefix(
   } else {
     result.second = longest_length;
     // No need to pass the size of normalized sentence,
-    // since |normalized| is delimitered by "\0".
+    // since |normalized| is delimited by "\0".
     result.first = absl::string_view(&normalized_[longest_value]);
   }
 
diff --git a/packages/node-sentencepiece/sentencepiece/src/normalizer.h b/packages/node-sentencepiece/sentencepiece/src/normalizer.h
index ba614669..3b45a136 100644
--- a/packages/node-sentencepiece/sentencepiece/src/normalizer.h
+++ b/packages/node-sentencepiece/sentencepiece/src/normalizer.h
@@ -131,7 +131,7 @@ class Normalizer {
   // Internal trie for efficient longest matching.
   std::unique_ptr trie_;
 
-  // "\0" delimitered output string.
+  // "\0" delimited output string.
   // the value of |trie_| stores pointers to this string.
   const char *normalized_ = nullptr;
 
diff --git a/packages/node-sentencepiece/sentencepiece/src/normalizer_test.cc b/packages/node-sentencepiece/sentencepiece/src/normalizer_test.cc
index 2a02718d..edc6a4ec 100644
--- a/packages/node-sentencepiece/sentencepiece/src/normalizer_test.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/normalizer_test.cc
@@ -146,7 +146,7 @@ TEST(NormalizerTest, NormalizeWithoutEscapeWhitespacesTest) {
   EXPECT_EQ("A B C", normalizer.Normalize("A  B  C"));
 }
 
-TEST(NormalizeTest, NomalizeWithSpaceContainedRules) {
+TEST(NormalizeTest, NormalizeWithSpaceContainedRules) {
   Builder::CharsMap charsmap;
 
   auto AddRule = [&](const std::string &src, const std::string &trg) {
@@ -160,7 +160,7 @@ TEST(NormalizeTest, NomalizeWithSpaceContainedRules) {
     charsmap[src_chars] = trg_chars;
   };
 
-  // Adds rules containing whitespaes.
+  // Adds rules containing whitespace.
   AddRule("a", " A");
   AddRule("b", "B");
   AddRule("c", "D E");
@@ -371,7 +371,7 @@ TEST(NormalizerTest, StatusTest) {
   NormalizerSpec spec;
   {
     const Normalizer normalizer(spec);
-    EXPECT_OK(normalizer.status());  // fallback to identity.
+    EXPECT_OK(normalizer.status());  // fall back to identity.
   }
 
   {
diff --git a/packages/node-sentencepiece/sentencepiece/src/sentencepiece_model.proto b/packages/node-sentencepiece/sentencepiece/src/sentencepiece_model.proto
index 61438c73..6f016edf 100644
--- a/packages/node-sentencepiece/sentencepiece/src/sentencepiece_model.proto
+++ b/packages/node-sentencepiece/sentencepiece/src/sentencepiece_model.proto
@@ -45,7 +45,7 @@ message TrainerSpec {
   enum ModelType {
     UNIGRAM = 1;   // Unigram language model with dynamic algorithm
     BPE     = 2;   // Byte Pair Encoding
-    WORD    = 3;   // Delimitered by whitespace.
+    WORD    = 3;   // Delimited by whitespace.
     CHAR    = 4;   // tokenizes into character sequence
   }
   optional ModelType model_type = 3 [ default = UNIGRAM ];
@@ -154,7 +154,7 @@ message TrainerSpec {
   repeated string user_defined_symbols = 31;
 
   // `vocab_size` is treated as hard limit. Crash if
-  // the model can not produce the vocab of size `vocab_size`,
+  // the model cannot produce the vocab of size `vocab_size`,
   // When `hard_vocab_limit` is false, vocab_size is treated
   // as soft limit. Note that when model_type=char,
   // always assumes hard_vocab_limit = false.
@@ -168,7 +168,7 @@ message TrainerSpec {
   // Reserved special meta tokens.
   // * -1 is not used.
   // * unk_id must not be -1.
-  // Id must starts with 0 and be contigous.
+  // ID must starts with 0 and be contiguous.
   optional int32 unk_id = 40 [ default = 0 ];    // 
   optional int32 bos_id = 41 [ default = 1 ];    // 
   optional int32 eos_id = 42 [ default = 2 ];    // 
@@ -188,7 +188,7 @@ message TrainerSpec {
   extensions 200 to max;
 };
 
-// NormalizerSpec encodes a various parameters for string normalizaiton
+// NormalizerSpec encodes a various parameters for string normalization
 message NormalizerSpec {
   // name of normalization rule.
   optional string name = 1;
diff --git a/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor.h b/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor.h
index 8d6f6005..40f382fa 100644
--- a/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor.h
+++ b/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor.h
@@ -364,7 +364,7 @@ class SentencePieceProcessor {
 
   // They are used in Python interface. Returns serialized proto.
   // In python module, we can get access to the full Proto after
-  // deserialzing the returned byte sequence.
+  // deserializing the returned byte sequence.
   virtual util::bytes EncodeAsSerializedProto(
       util::min_string_view input) const;
 
diff --git a/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor_test.cc b/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor_test.cc
index 9ec2c605..b9b77708 100644
--- a/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor_test.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/sentencepiece_processor_test.cc
@@ -262,7 +262,7 @@ TEST(SentencepieceProcessorTest, EncodeTest) {
     EXPECT_NOT_OK(sp.Encode("ABC DEF", &spt));
   }
 
-  // Halfwidth to Fullwidith katakana normalization.
+  // Halfwidth to Fullwidth katakana normalization.
   {
     auto mock = MakeUnique();
     const EncodeResult result = {{WS "グー", 3}, {"グル", 4}, {"", 2}};
@@ -493,8 +493,8 @@ TEST(SentencepieceProcessorTest, DecodeTest) {
     auto mock = MakeUnique();
     sp.SetModel(std::move(mock));
 
-    const auto normalizaiton_spec = MakeDefaultNormalizerSpec();
-    sp.SetNormalizer(MakeUnique(normalizaiton_spec));
+    const auto normalization_spec = MakeDefaultNormalizerSpec();
+    sp.SetNormalizer(MakeUnique(normalization_spec));
 
     SentencePieceText spt;
 
@@ -546,8 +546,8 @@ TEST(SentencepieceProcessorTest, DecodeTest) {
     auto mock = MakeUnique();
     sp.SetModel(std::move(mock));
 
-    const auto normalizaiton_spec = MakeDefaultNormalizerSpec();
-    sp.SetNormalizer(MakeUnique(normalizaiton_spec));
+    const auto normalization_spec = MakeDefaultNormalizerSpec();
+    sp.SetNormalizer(MakeUnique(normalization_spec));
 
     SentencePieceText spt;
 
@@ -565,8 +565,8 @@ TEST(SentencepieceProcessorTest, DecodeTest) {
     auto mock = MakeUnique();
     sp.SetModel(std::move(mock));
 
-    const auto normalizaiton_spec = MakeDefaultNormalizerSpec();
-    sp.SetNormalizer(MakeUnique(normalizaiton_spec));
+    const auto normalization_spec = MakeDefaultNormalizerSpec();
+    sp.SetNormalizer(MakeUnique(normalization_spec));
 
     SentencePieceText spt;
 
@@ -584,8 +584,8 @@ TEST(SentencepieceProcessorTest, DecodeTest) {
     auto mock = MakeUnique();
     sp.SetModel(std::move(mock));
 
-    const auto normalizaiton_spec = MakeDefaultNormalizerSpec();
-    sp.SetNormalizer(MakeUnique(normalizaiton_spec));
+    const auto normalization_spec = MakeDefaultNormalizerSpec();
+    sp.SetNormalizer(MakeUnique(normalization_spec));
 
     SentencePieceText spt;
 
diff --git a/packages/node-sentencepiece/sentencepiece/src/spm_normalize_main.cc b/packages/node-sentencepiece/sentencepiece/src/spm_normalize_main.cc
index 9ae5a2c5..96f7c8a8 100644
--- a/packages/node-sentencepiece/sentencepiece/src/spm_normalize_main.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/spm_normalize_main.cc
@@ -32,7 +32,7 @@ DEFINE_string(normalization_rule_name, "",
 DEFINE_string(normalization_rule_tsv, "", "Normalization rule TSV file. ");
 DEFINE_bool(remove_extra_whitespaces, true, "Remove extra whitespaces");
 DEFINE_bool(decompile, false,
-            "Decompile compiled charamap and output it as TSV.");
+            "Decompile compiled charmap and output it as TSV.");
 DEFINE_string(output, "", "Output filename");
 
 using sentencepiece::ModelProto;
diff --git a/packages/node-sentencepiece/sentencepiece/src/trainer_interface.h b/packages/node-sentencepiece/sentencepiece/src/trainer_interface.h
index 8508b59a..594bcb65 100644
--- a/packages/node-sentencepiece/sentencepiece/src/trainer_interface.h
+++ b/packages/node-sentencepiece/sentencepiece/src/trainer_interface.h
@@ -76,14 +76,14 @@ class TrainerInterface {
  protected:
   // Returns true if |piece| is valid sentence piece.
   // The result is affected by
-  // max_sentencepiece_length, split_by_whiespace, split_by_unicode_script.
+  // max_sentencepiece_length, split_by_whitespace, split_by_unicode_script.
   bool IsValidSentencePiece(const string_util::UnicodeText &piece) const;
 
   // Loads all sentences from spec.input().
   // It loads at most input_sentence_size sentences.
   util::Status LoadSentences();
 
-  // Splits all sentencecs by whitespaces and
+  // Splits all sentences by whitespaces and
   // replace the |sentences_| with tokenized string.
   // e.g.,
   //  [ ["hello world ", 1], ["hi world]" ] =>
diff --git a/packages/node-sentencepiece/sentencepiece/src/trainer_interface_test.cc b/packages/node-sentencepiece/sentencepiece/src/trainer_interface_test.cc
index 3229c6d9..c99bb55c 100644
--- a/packages/node-sentencepiece/sentencepiece/src/trainer_interface_test.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/trainer_interface_test.cc
@@ -281,7 +281,7 @@ TEST(TrainerInterfaceTest, OverrideSpecialPiecesTest) {
     trainer_spec.set_eos_id(20);
     trainer_spec.set_pad_id(30);
 
-    // ,  are treated as USER_DEFIEND,
+    // ,  are treated as USER_DEFINED,
     //  is CONTROL.
     trainer_spec.add_user_defined_symbols("");
     trainer_spec.add_user_defined_symbols("");
diff --git a/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.cc b/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.cc
index a2be512d..07864f6b 100644
--- a/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.cc
@@ -123,7 +123,7 @@ TrainerModel::SentencePieces Trainer::MakeSeedSentencePieces() const {
   std::vector D(n);   // depths of internal node
 
   // Makes a suffix array to extract all sub strings occurring
-  // more than 2 times in the sentence.
+  // more than two times in the sentence.
   constexpr int kAlphabetSize = 0x110000;  // All UCS4 range.
   int node_num = 0;
   LOG(INFO) << "Making suffix array...";
@@ -381,7 +381,7 @@ TrainerModel::SentencePieces Trainer::PruneSentencePieces(
       //         = current_sum + freq[i] (alternatives - 1)
       const float logsum_alt = log(sum + freq[i] * (alternatives.size() - 1));
 
-      // The frequencies of altenatives are increased by freq[i].
+      // The frequencies of alternatives are increased by freq[i].
       float logprob_alt = 0.0;
       for (const int n : alternatives[i]) {
         logprob_alt += (log(freq[n] + freq[i]) - logsum_alt);
@@ -500,7 +500,7 @@ util::Status Trainer::Train() {
     model.SetSentencePieces(std::move(new_sentencepieces));
   }  // end of EM iteration
 
-  // Finally, adjusts the size of sentencepices to be |vocab_size|.
+  // Finally, adjusts the size of sentencepieces to be |vocab_size|.
   final_pieces_ = FinalizeSentencePieces(model);
 
   return Save();
diff --git a/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.h b/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.h
index a3d03931..bf1afb39 100644
--- a/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.h
+++ b/packages/node-sentencepiece/sentencepiece/src/unigram_model_trainer.h
@@ -39,7 +39,7 @@ class TrainerModel : public Model {
   TrainerModel() {}
   TrainerModel(const ModelProto &model_proto) = delete;
   TrainerModel(const TrainerSpec &trainer_spec,
-               const NormalizerSpec &normalizaiton_spec);
+               const NormalizerSpec &normalization_spec);
   ~TrainerModel() override;
 
   // Returns the sentencepieces.
diff --git a/packages/node-sentencepiece/sentencepiece/src/util.h b/packages/node-sentencepiece/sentencepiece/src/util.h
index 9479e2c9..4bb8063b 100644
--- a/packages/node-sentencepiece/sentencepiece/src/util.h
+++ b/packages/node-sentencepiece/sentencepiece/src/util.h
@@ -259,7 +259,7 @@ std::string UnicodeTextToUTF8(const UnicodeText &utext);
 
 }  // namespace string_util
 
-// other map/ptr utilties
+// other map/ptr utilities
 namespace port {
 
 template 
diff --git a/packages/node-sentencepiece/sentencepiece/src/util_test.cc b/packages/node-sentencepiece/sentencepiece/src/util_test.cc
index 0922b255..a2bc079f 100644
--- a/packages/node-sentencepiece/sentencepiece/src/util_test.cc
+++ b/packages/node-sentencepiece/sentencepiece/src/util_test.cc
@@ -356,7 +356,7 @@ TEST(UtilTest, DecodeUTF8Test) {
 
     for (size_t i = 0; i < 4; ++i) {
       // return values of string_util::DecodeUTF8 is not defined.
-      // TODO(taku) implement an workaround.
+      // TODO(taku) implement a workaround.
       EXPECT_EQ(kUnicodeError,
                 string_util::DecodeUTF8(
                     kInvalidData[i], kInvalidData[i] + strlen(kInvalidData[i]),
diff --git a/packages/node-sentencepiece/src/initialize.ts b/packages/node-sentencepiece/src/initialize.ts
index cd54d4a8..02a4cab1 100644
--- a/packages/node-sentencepiece/src/initialize.ts
+++ b/packages/node-sentencepiece/src/initialize.ts
@@ -120,9 +120,9 @@ const parseDirName = (dirName: string): ExtensionDir | undefined => {
   }
 }
 
-const acquireLock = (ressource: string): Promise => {
+const acquireLock = (resource: string): Promise => {
   return new Promise((resolve) => {
-    lock(ressource, (releaser) => {
+    lock(resource, (releaser) => {
       resolve({ release: releaser() })
     })
   })
@@ -182,14 +182,14 @@ const initialize = async (): Promise => {
         debuglog('success')
         return binding
       } catch (err) {
-        debuglog('error occured: ', err)
+        debuglog('error occurred: ', err)
       }
     }
 
     throw new Error(`Linux distribution ${rawDistribution} is not supported by ${packageName}.`)
   }
 
-  throw new Error(`The plateform ${distro.os} is not supported by ${packageName}.`)
+  throw new Error(`The platform ${distro.os} is not supported by ${packageName}.`)
 }
 
 let binding: any | undefined
diff --git a/packages/node-svm/README.md b/packages/node-svm/README.md
index 1f7d1a53..dd78c4b9 100644
--- a/packages/node-svm/README.md
+++ b/packages/node-svm/README.md
@@ -14,7 +14,7 @@ Why did we make a complete reimplementation? What is different from previous [no
 
 1. [node-svm](https://github.com/nicolaspanel/node-svm) doesn't build for nodejs version > 10...
 
-   It's written using [Native Abstractions for Node.js (nan)](https://github.com/nodejs/nan) which is an old API for node binding developpement.
+   It's written using [Native Abstractions for Node.js (nan)](https://github.com/nodejs/nan) which is an old API for node binding development.
 
    Our binding is written using [node-addon-api (napi)](https://github.com/nodejs/node-addon-api) which is intended to insulate addons from changes in the underlying JavaScript engine…
 
diff --git a/packages/node-svm/cppsrc/nsvm.cpp b/packages/node-svm/cppsrc/nsvm.cpp
index 808bb775..7b8305e4 100644
--- a/packages/node-svm/cppsrc/nsvm.cpp
+++ b/packages/node-svm/cppsrc/nsvm.cpp
@@ -104,7 +104,7 @@ Napi::Value NSVM::svmTrainAsync(const Napi::CallbackInfo &info)
 
   if (info.Length() != 4)
   {
-    Napi::TypeError::New(env, "train_async expects at 4 arguments: train params, X, y adn the callback function").ThrowAsJavaScriptException();
+    Napi::TypeError::New(env, "train_async expects at 4 arguments: train params, X, y and the callback function").ThrowAsJavaScriptException();
     return env.Null();
   }
 
@@ -171,7 +171,7 @@ Napi::Value NSVM::svmPredict(const Napi::CallbackInfo &info)
 
   if (!this->_state->modelIsTrained)
   {
-    Napi::TypeError::New(env, "model was already freed from memory, instanciate a new NSVM").ThrowAsJavaScriptException();
+    Napi::TypeError::New(env, "model was already freed from memory, instantiate a new NSVM").ThrowAsJavaScriptException();
     return env.Null();
   }
 
@@ -199,7 +199,7 @@ Napi::Value NSVM::svmPredictAsync(const Napi::CallbackInfo &info)
 
   if (!this->_state->modelIsTrained)
   {
-    Napi::TypeError::New(env, "model was already freed from memory, instanciate a new NSVM").ThrowAsJavaScriptException();
+    Napi::TypeError::New(env, "model was already freed from memory, instantiate a new NSVM").ThrowAsJavaScriptException();
     return env.Null();
   }
 
@@ -235,7 +235,7 @@ Napi::Value NSVM::svmPredictProbability(const Napi::CallbackInfo &info)
 
   if (!this->_state->modelIsTrained)
   {
-    Napi::TypeError::New(env, "model was already freed from memory, instanciate a new NSVM").ThrowAsJavaScriptException();
+    Napi::TypeError::New(env, "model was already freed from memory, instantiate a new NSVM").ThrowAsJavaScriptException();
     return env.Null();
   }
 
@@ -270,7 +270,7 @@ Napi::Value NSVM::svmPredictProbabilityAsync(const Napi::CallbackInfo &info)
 
   if (!this->_state->modelIsTrained)
   {
-    Napi::TypeError::New(env, "model was already freed from memory, instanciate a new NSVM").ThrowAsJavaScriptException();
+    Napi::TypeError::New(env, "model was already freed from memory, instantiate a new NSVM").ThrowAsJavaScriptException();
     return env.Null();
   }
 
diff --git a/packages/node-svm/cppsrc/train.cpp b/packages/node-svm/cppsrc/train.cpp
index f1d9ced2..3879ceb8 100644
--- a/packages/node-svm/cppsrc/train.cpp
+++ b/packages/node-svm/cppsrc/train.cpp
@@ -40,7 +40,7 @@ bool train::train(struct svm_parameter ¶ms,
 
     if (params.svm_type == ONE_CLASS && params.probability)
     {
-        results.error_reason = "Probablity prediction with svm_type=ONE_CLASS is not supported";
+        results.error_reason = "Probability prediction with svm_type=ONE_CLASS is not supported";
         return false;
     }
 
diff --git a/packages/node-svm/cppsrc/utils.cpp b/packages/node-svm/cppsrc/utils.cpp
index e7333496..3d7b9594 100644
--- a/packages/node-svm/cppsrc/utils.cpp
+++ b/packages/node-svm/cppsrc/utils.cpp
@@ -19,7 +19,7 @@ void napiToSvmModel(const Napi::Object &napiModel, svm_model &model)
 Napi::Object svmModelToNapi(const Napi::Env &env, const svm_model &model, unsigned int nSamples, unsigned int nFeatures)
 {
     unsigned int k = model.nr_class;
-    unsigned int pairwaise_combinations = k * (k - 1) / 2;
+    unsigned int pairwise_combinations = k * (k - 1) / 2;
 
     unsigned int nSupports = model.l;
 
@@ -29,9 +29,9 @@ Napi::Object svmModelToNapi(const Napi::Env &env, const svm_model &model, unsign
     napiModel.Set("l", nSupports);
     napiModel.Set("SV", nodeMatrixToNapi(env, model.SV, nSupports, nFeatures));
     napiModel.Set("sv_coef", matrixToNapi(env, model.sv_coef, k - 1, nSupports));
-    napiModel.Set("rho", arrayToNapi(env, model.rho, pairwaise_combinations));
-    napiModel.Set("probA", arrayToNapi(env, model.probA, pairwaise_combinations));
-    napiModel.Set("probB", arrayToNapi(env, model.probB, pairwaise_combinations));
+    napiModel.Set("rho", arrayToNapi(env, model.rho, pairwise_combinations));
+    napiModel.Set("probA", arrayToNapi(env, model.probA, pairwise_combinations));
+    napiModel.Set("probB", arrayToNapi(env, model.probB, pairwise_combinations));
     napiModel.Set("sv_indices", arrayToNapi(env, model.sv_indices, nSupports));
     napiModel.Set("label", arrayToNapi(env, model.label, k));
     napiModel.Set("nSV", arrayToNapi(env, model.nSV, k));
diff --git a/packages/node-svm/libsvm/svm-predict.c b/packages/node-svm/libsvm/svm-predict.c
index 7a0fa154..5fec6d54 100644
--- a/packages/node-svm/libsvm/svm-predict.c
+++ b/packages/node-svm/libsvm/svm-predict.c
@@ -219,7 +219,7 @@ int main(int argc, char **argv)
 	{
 		if(svm_check_probability_model(model)==0)
 		{
-			fprintf(stderr,"Model does not support probabiliy estimates\n");
+			fprintf(stderr,"Model does not support probability estimates\n");
 			exit(1);
 		}
 	}
diff --git a/packages/node-svm/libsvm/svm.cpp b/packages/node-svm/libsvm/svm.cpp
index 71d7dd6e..45d703a3 100644
--- a/packages/node-svm/libsvm/svm.cpp
+++ b/packages/node-svm/libsvm/svm.cpp
@@ -788,7 +788,7 @@ int Solver::select_working_set(int &out_i, int &out_j)
 	// return i,j such that
 	// i: maximizes -y_i * grad(f)_i, i in I_up(\alpha)
 	// j: minimizes the decrease of obj value
-	//    (if quadratic coefficeint <= 0, replace it with tau)
+	//    (if quadratic coefficient <= 0, replace it with tau)
 	//    -y_j*grad(f)_j < -y_i*grad(f)_i, j in I_low(\alpha)
 
 	double Gmax = -INF;
@@ -1031,7 +1031,7 @@ int Solver_NU::select_working_set(int &out_i, int &out_j)
 	// return i,j such that y_i = y_j and
 	// i: maximizes -y_i * grad(f)_i, i in I_up(\alpha)
 	// j: minimizes the decrease of obj value
-	//    (if quadratic coefficeint <= 0, replace it with tau)
+	//    (if quadratic coefficient <= 0, replace it with tau)
 	//    -y_j*grad(f)_j < -y_i*grad(f)_i, j in I_low(\alpha)
 
 	double Gmaxp = -INF;
@@ -1701,7 +1701,7 @@ static decision_function svm_train_one(
 	return f;
 }
 
-// Platt's binary SVM Probablistic Output: an improvement from Lin et al.
+// Platt's binary SVM Probabilistic Output: an improvement from Lin et al.
 static void sigmoid_train(
 	int l, const double *dec_values, const double *labels,
 	double& A, double& B)
diff --git a/packages/node-svm/libsvm/svm.h b/packages/node-svm/libsvm/svm.h
index 1f827121..6b871067 100644
--- a/packages/node-svm/libsvm/svm.h
+++ b/packages/node-svm/libsvm/svm.h
@@ -59,9 +59,9 @@ struct svm_model
 	struct svm_node **SV;		/* SVs (SV[l]) */
 	double **sv_coef;	/* coefficients for SVs in decision functions (sv_coef[k-1][l]) */
 	double *rho;		/* constants in decision functions (rho[k*(k-1)/2]) */
-	double *probA;		/* pariwise probability information */
+	double *probA;		/* pairwise probability information */
 	double *probB;
-	int *sv_indices;        /* sv_indices[0,...,nSV-1] are values in [1,...,num_traning_data] to indicate SVs in the training set */
+	int *sv_indices;        /* sv_indices[0,...,nSV-1] are values in [1,...,num_training_data] to indicate SVs in the training set */
 
 	/* for classification only */
 
diff --git a/packages/node-svm/src/initialize.ts b/packages/node-svm/src/initialize.ts
index cd54d4a8..02a4cab1 100644
--- a/packages/node-svm/src/initialize.ts
+++ b/packages/node-svm/src/initialize.ts
@@ -120,9 +120,9 @@ const parseDirName = (dirName: string): ExtensionDir | undefined => {
   }
 }
 
-const acquireLock = (ressource: string): Promise => {
+const acquireLock = (resource: string): Promise => {
   return new Promise((resolve) => {
-    lock(ressource, (releaser) => {
+    lock(resource, (releaser) => {
       resolve({ release: releaser() })
     })
   })
@@ -182,14 +182,14 @@ const initialize = async (): Promise => {
         debuglog('success')
         return binding
       } catch (err) {
-        debuglog('error occured: ', err)
+        debuglog('error occurred: ', err)
       }
     }
 
     throw new Error(`Linux distribution ${rawDistribution} is not supported by ${packageName}.`)
   }
 
-  throw new Error(`The plateform ${distro.os} is not supported by ${packageName}.`)
+  throw new Error(`The platform ${distro.os} is not supported by ${packageName}.`)
 }
 
 let binding: any | undefined
diff --git a/packages/worker/readme.md b/packages/worker/readme.md
index 0d7c265c..b5d72cc1 100644
--- a/packages/worker/readme.md
+++ b/packages/worker/readme.md
@@ -21,4 +21,4 @@ Offers functions and callback that makes handling a worker as easy as calling a
 
 ## Licensing
 
-This software is protected by the same license as the [main Botpress repository](https://github.com/botpress/botpress). You can find the license file [here](https://github.com/botpress/botpress/blob/master/LICENSE).
+This software is protected by the same [license](https://github.com/botpress/botpress/blob/master/LICENSE) as the [main Botpress repository](https://github.com/botpress/botpress).
diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts
index 1418050c..7a47a6a2 100644
--- a/packages/worker/src/index.ts
+++ b/packages/worker/src/index.ts
@@ -1,6 +1,6 @@
 import { TaskCanceledError, TaskAlreadyStartedError, TaskExitedUnexpectedlyError } from './errors'
-import { ProcessEntyPoint, ProcessPool } from './process-pool'
-import { ThreadEntyPoint, ThreadPool } from './thread-pool'
+import { ProcessEntryPoint, ProcessPool } from './process-pool'
+import { ThreadEntryPoint, ThreadPool } from './thread-pool'
 
 import * as types from './typings'
 
@@ -13,8 +13,8 @@ export const errors: typeof types.errors = {
 export const makeProcessPool: typeof types.makeProcessPool = (logger: types.Logger, config: types.PoolOptions) =>
   new ProcessPool(logger, config)
 export const makeProcessEntryPoint: typeof types.makeProcessEntryPoint = (config?: types.EntryPointOptions) =>
-  new ProcessEntyPoint(config)
+  new ProcessEntryPoint(config)
 export const makeThreadPool: typeof types.makeThreadPool = (logger: types.Logger, config: types.PoolOptions) =>
   new ThreadPool(logger, config)
 export const makeThreadEntryPoint: typeof types.makeThreadEntryPoint = (config?: types.EntryPointOptions) =>
-  new ThreadEntyPoint(config)
+  new ThreadEntryPoint(config)
diff --git a/packages/worker/src/process-pool.ts b/packages/worker/src/process-pool.ts
index 8093203d..16f23be7 100644
--- a/packages/worker/src/process-pool.ts
+++ b/packages/worker/src/process-pool.ts
@@ -27,7 +27,7 @@ export class ProcessPool extends WorkerPool {
   }
 }
 
-export class ProcessEntyPoint extends WorkerEntryPoint {
+export class ProcessEntryPoint extends WorkerEntryPoint {
   constructor(config?: EntryPointOptions) {
     super(config)
   }
diff --git a/packages/worker/src/thread-pool.ts b/packages/worker/src/thread-pool.ts
index 2494245d..71182095 100644
--- a/packages/worker/src/thread-pool.ts
+++ b/packages/worker/src/thread-pool.ts
@@ -19,7 +19,7 @@ export class ThreadPool extends WorkerPool {
   }
 }
 
-export class ThreadEntyPoint extends WorkerEntryPoint {
+export class ThreadEntryPoint extends WorkerEntryPoint {
   constructor(config?: EntryPointOptions) {
     super(config)
   }
diff --git a/packages/worker/src/typings.d.ts b/packages/worker/src/typings.d.ts
index 48a96a5c..65c308d2 100644
--- a/packages/worker/src/typings.d.ts
+++ b/packages/worker/src/typings.d.ts
@@ -74,12 +74,12 @@ export type ProcessPool = WorkerPool & {
   cancel(id: string)
 }
 
-export type ProcessEntyPoint = {} & WorkerEntryPoint
+export type ProcessEntryPoint = {} & WorkerEntryPoint
 
 export type ThreadPool = {} & WorkerPool
-export type ThreadEntyPoint = {} & WorkerEntryPoint
+export type ThreadEntryPoint = {} & WorkerEntryPoint
 
 export const makeProcessPool: (logger: Logger, config: PoolOptions) => ProcessPool
-export const makeProcessEntryPoint: (config?: EntryPointOptions) => ProcessEntyPoint
+export const makeProcessEntryPoint: (config?: EntryPointOptions) => ProcessEntryPoint
 export const makeThreadPool: (logger: Logger, config: PoolOptions) => ThreadPool
-export const makeThreadEntryPoint: (config?: EntryPointOptions) => ThreadEntyPoint
+export const makeThreadEntryPoint: (config?: EntryPointOptions) => ThreadEntryPoint
diff --git a/readme.md b/readme.md
index f385412a..f60e570e 100644
--- a/readme.md
+++ b/readme.md
@@ -24,7 +24,7 @@ Check out each individual packages for more details.
 
 ## Running from pre-built binaries
 
-New executable binary files are packaged at every release. You can download those directly on release page located [here](https://github.com/botpress/nlu/releases).
+New executable binary files are packaged at every release. You can download those directly on the [release page](https://github.com/botpress/nlu/releases).
 
 ## Telemetry
 
@@ -43,7 +43,7 @@ The important environment variables for configuring tracing are:
 - OTEL_EXPORTER_JAEGER_ENDPOINT url Sets the Jaeger collector endpoint
 - OTEL_SERVICE_NAME string Sets the service name given to a trace
 - OTEL_SERVICE_VERSION string Sets the current running version of the service
-- OTEL_SERVICE_VERSION_INSTANCE_ID string Sets the node intance id on which the service is running on
+- OTEL_SERVICE_VERSION_INSTANCE_ID string Sets the node instance id on which the service is running on
 - OTEL_SERVICE_NAMESPACE string Sets the namespace of the service
 - OTEL_DEPLOYMENT_ENVIRONMENT string Sets the environment of the service
 
@@ -59,4 +59,4 @@ The NLU Server's only purpose is to do NLU.
 
 ## Licensing
 
-Different licences may apply to differents packages of the [./packages](https://github.com/botpress/nlu/tree/master/packages) directory. If no licence is specified, the package is protected by the same license as the [v12 Botpress repository](https://github.com/botpress/v12).
+Different licences may apply to different packages of the [./packages](https://github.com/botpress/nlu/tree/master/packages) directory. If no licence is specified, the package is protected by the same license as the [v12 Botpress repository](https://github.com/botpress/v12).
diff --git a/scripts/gulp.release.js b/scripts/gulp.release.js
index 4ad70e6a..2ab8f586 100644
--- a/scripts/gulp.release.js
+++ b/scripts/gulp.release.js
@@ -60,7 +60,7 @@ const bumpVersion = (cb) => {
       {
         jump: {
           alias: 'j',
-          description: 'Weither to jump by a major, a minor or a patch',
+          description: 'Whether to jump by a major, a minor, or a patch',
           choices: ['major', 'minor', 'patch'],
           type: 'string',
           demandOption: true
diff --git a/scripts/utils/spawn.js b/scripts/utils/spawn.js
index 0f10991a..e30a7f7f 100644
--- a/scripts/utils/spawn.js
+++ b/scripts/utils/spawn.js
@@ -6,8 +6,8 @@ const spawn = (program, args, params) => {
   logger.info(`Launching '${cmd}'`)
   return new Promise(async (resolve, reject) => {
     try {
-      const spawnedPocess = child_process.spawn(program, args, params)
-      spawnedPocess.on('exit', (code, signal) => {
+      const spawnedProcess = child_process.spawn(program, args, params)
+      spawnedProcess.on('exit', (code, signal) => {
         if (code !== 0) {
           const error = new Error(`Process exited with exit-code ${code} and signal ${signal}`)
           reject(error)