Skip to content

Commit

Permalink
Add JSON report and update concordialang dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodp committed Apr 1, 2021
1 parent 8d52d27 commit 5bbf4e1
Show file tree
Hide file tree
Showing 59 changed files with 2,859 additions and 1,233 deletions.
5 changes: 3 additions & 2 deletions __tests__/SimpleCompiler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE, DEFAULT_ENCODING } from '../modules/app/default-options';
import { Document, FileInfo } from '../modules/ast';
Expand All @@ -11,7 +12,7 @@ import { NLPBasedSentenceRecognizer } from '../modules/nlp/NLPBasedSentenceRecog
import { NLPTrainer } from '../modules/nlp/NLPTrainer';
import { Parser } from '../modules/parser/Parser';
import { AugmentedSpec } from '../modules/req/AugmentedSpec';
import { FSFileHandler } from '../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../modules/util/fs/FSFileHandler';

/**
* Useful for testing purposes.
Expand All @@ -27,7 +28,7 @@ export class SimpleCompiler {

langDir = resolve( this.dir, DEFAULT_DIR_LANGUAGE );

fileHandler = new FSFileHandler( fs, DEFAULT_ENCODING );
fileHandler = new FSFileHandler( fs, promisify, DEFAULT_ENCODING );

langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
this.langDir,
Expand Down
5 changes: 3 additions & 2 deletions __tests__/compiler/SingleFileCompiler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../modules/app/default-options';
import { Document } from '../../modules/ast/Document';
Expand All @@ -10,7 +11,7 @@ import { Lexer } from '../../modules/lexer/Lexer';
import { NLPBasedSentenceRecognizer } from '../../modules/nlp/NLPBasedSentenceRecognizer';
import { NLPTrainer } from '../../modules/nlp/NLPTrainer';
import { Parser } from '../../modules/parser/Parser';
import { FSFileHandler } from '../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../modules/util/fs/FSFileHandler';

describe( 'SingleFileCompiler', () => {

Expand All @@ -19,7 +20,7 @@ describe( 'SingleFileCompiler', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader =
new JsonLanguageContentLoader( langDir, {}, fileHandler, fileHandler );

Expand Down
5 changes: 3 additions & 2 deletions __tests__/db/AlaSqlDatabaseInterface.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE, DEFAULT_LANGUAGE } from '../../modules/app/default-options';
import { Database, DatabaseProperties, DatabaseProperty, Document, Table } from '../../modules/ast';
Expand All @@ -8,7 +9,7 @@ import { JsonLanguageContentLoader, LanguageContentLoader } from '../../modules/
import { Lexer } from '../../modules/lexer/Lexer';
import { Parser } from '../../modules/parser/Parser';
import { NodeTypes } from '../../modules/req/NodeTypes';
import { FSFileHandler } from '../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../modules/util/fs/FSFileHandler';

describe( 'AlaSqlDatabaseInterface', () => {

Expand All @@ -18,7 +19,7 @@ describe( 'AlaSqlDatabaseInterface', () => {
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

let parser = new Parser();
const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader =
new JsonLanguageContentLoader( langDir, {}, fileHandler, fileHandler );
let lexer: Lexer = new Lexer( DEFAULT_LANGUAGE, langLoader );
Expand Down
6 changes: 4 additions & 2 deletions __tests__/db/database-package-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { fs, vol } from 'memfs';
import * as path from 'path';
import { promisify } from 'util';

import { allInstalledDatabases, databasePackageNameFor } from '../../modules/db/database-package-manager';
import { FSDirSearcher } from '../../modules/util/file';
import { FSDirSearcher } from '../../modules/util/fs/FSDirSearcher';

describe( 'database-package-manager', () => {

Expand All @@ -25,7 +27,7 @@ describe( 'database-package-manager', () => {
vol.mkdirpSync( path.join( localModulesDir, 'database-js' ) );
vol.mkdirpSync( path.join( localModulesDir, 'database-js-json' ) );

const s = new FSDirSearcher( fs );
const s = new FSDirSearcher( fs, promisify );
const r = await allInstalledDatabases( localModulesDir, s );

expect( r.length ).toEqual( 1 );
Expand Down
2 changes: 1 addition & 1 deletion __tests__/language/LanguageManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join, resolve } from 'path';

import { DEFAULT_DIR_LANGUAGE } from '../../modules/app/default-options';
import { LanguageManager } from '../../modules/language/LanguageManager';
import { FSFileSearcher } from '../../modules/util/file/FSFileSearcher';
import { FSFileSearcher } from '../../modules/util/fs/FSFileSearcher';

describe( 'LanguageManager', () => {

Expand Down
6 changes: 4 additions & 2 deletions __tests__/language/locale-manager.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { fs, vol } from 'memfs';
import * as path from 'path';
import { promisify } from 'util';

import { installedDateLocales } from '../../modules/language/locale-manager';
import { FSDirSearcher } from '../../modules/util/file';
import { FSDirSearcher } from '../../modules/util/fs/FSDirSearcher';

describe( 'locale-manager', () => {

Expand All @@ -28,7 +30,7 @@ describe( 'locale-manager', () => {
vol.mkdirpSync( path.join( localeDir, enUS ) );
vol.mkdirpSync( path.join( localeDir, ptBR ) );

const s = new FSDirSearcher( fs );
const s = new FSDirSearcher( fs, promisify );
const r = await installedDateLocales( localModulesDir, s, path );

expect( r.length ).toEqual( 2 );
Expand Down
5 changes: 3 additions & 2 deletions __tests__/lexer/Lexer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE, DEFAULT_LANGUAGE } from '../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../modules/language';
import { Lexer } from '../../modules/lexer/Lexer';
import { NodeTypes } from '../../modules/req/NodeTypes';
import { FSFileHandler } from '../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../modules/util/fs/FSFileHandler';

describe( 'Lexer', () => {

const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );

const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/DatabasePropertyRecognizer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../modules/app/default-options';
import { DatabaseProperty } from '../../modules/ast';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../modules/language';
import { DatabasePropertyRecognizer, NLP, NLPTrainer } from '../../modules/nlp';
import { NodeTypes } from '../../modules/req/NodeTypes';
import { FSFileHandler } from '../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../modules/util/fs/FSFileHandler';

describe( 'DatabasePropertyRecognizer', () => {

Expand All @@ -17,7 +18,7 @@ describe( 'DatabasePropertyRecognizer', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader =
new JsonLanguageContentLoader( langDir, {}, fileHandler, fileHandler );

Expand Down
7 changes: 4 additions & 3 deletions __tests__/nlp/UIPropertyRecognizer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../modules/app/default-options';
import { UIProperty } from '../../modules/ast/UIProperty';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../modules/language';
import { NLP, NLPTrainer, UIPropertyRecognizer } from '../../modules/nlp';
import { NodeTypes } from '../../modules/req/NodeTypes';
import { FSFileHandler } from '../../modules/util/file/FSFileHandler';
import { DEFAULT_DIR_LANGUAGE } from '../../modules/app/default-options';
import { FSFileHandler } from '../../modules/util/fs/FSFileHandler';

describe( 'UIPropertyRecognizer', () => {

Expand All @@ -17,7 +18,7 @@ describe( 'UIPropertyRecognizer', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader =
new JsonLanguageContentLoader( langDir, {}, fileHandler, fileHandler );

Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/en/date.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Clock, DateTimeFormatter, LocalDate } from '@js-joda/core';
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Entities, NLP, NLPResult, NLPTrainer } from '../../../modules/nlp';
import { FSFileHandler } from '../../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveUIEntities } from '../entity-util';

describe( 'nlp.en.date', () => {
Expand All @@ -18,7 +19,7 @@ describe( 'nlp.en.date', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/en/datetime.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Clock, DateTimeFormatter, LocalDateTime } from '@js-joda/core';
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Entities, Intents, NLP, NLPResult, NLPTrainer } from '../../../modules/nlp';
import { FSFileHandler } from '../../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveUIEntities, shouldNotHaveEntities } from '../entity-util';

describe( 'nlp.en.datetime', () => {
Expand All @@ -18,7 +19,7 @@ describe( 'nlp.en.datetime', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/en/time.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Clock, DateTimeFormatter, LocalTime } from '@js-joda/core';
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Entities, Intents, NLP, NLPResult, NLPTrainer } from '../../../modules/nlp';
import { FSFileHandler } from '../../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveUIEntities, shouldNotHaveEntities } from '../entity-util';

describe( 'nlp.en.time', () => {
Expand All @@ -18,7 +19,7 @@ describe( 'nlp.en.time', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/pt/date.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Clock, DateTimeFormatter, LocalDate } from '@js-joda/core';
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Intents, NLP, NLPResult, NLPTrainer } from '../../../modules/nlp';
import { Entities } from '../../../modules/nlp/Entities';
import { FSFileHandler } from '../../../modules/util/file';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveUIEntities, shouldNotHaveEntities } from '../entity-util';

describe( 'nlp.pt.date', () => {
Expand All @@ -19,7 +20,7 @@ describe( 'nlp.pt.date', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/pt/datetime.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Clock, DateTimeFormatter, LocalDateTime } from '@js-joda/core';
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Entities, Intents, NLP, NLPResult, NLPTrainer } from '../../../modules/nlp';
import { FSFileHandler } from '../../../modules/util/file/FSFileHandler';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveUIEntities, shouldNotHaveEntities } from '../entity-util';


Expand All @@ -19,7 +20,7 @@ describe( 'nlp.pt.datetime', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/pt/testcase.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Intents, NLP, NLPResult, NLPTrainer } from '../../../modules/nlp';
import { Entities } from '../../../modules/nlp/Entities';
import { FSFileHandler } from '../../../modules/util/file';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveTestCaseEntities } from '../entity-util';

describe( 'nlp.pt.testcase', () => {
Expand All @@ -16,7 +17,7 @@ describe( 'nlp.pt.testcase', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/pt/time.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Clock, DateTimeFormatter, LocalTime } from '@js-joda/core';
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Intents, NLP, NLPResult, NLPTrainer } from '../../../modules/nlp';
import { Entities } from '../../../modules/nlp/Entities';
import { FSFileHandler } from '../../../modules/util/file';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveUIEntities, shouldNotHaveEntities } from '../entity-util';

describe( 'nlp.pt.time', () => {
Expand All @@ -19,7 +20,7 @@ describe( 'nlp.pt.time', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
5 changes: 3 additions & 2 deletions __tests__/nlp/pt/ui.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as fs from 'fs';
import { resolve } from 'path';
import { promisify } from 'util';

import { DEFAULT_DIR_LANGUAGE } from '../../../modules/app/default-options';
import { JsonLanguageContentLoader, LanguageContentLoader } from '../../../modules/language';
import { Intents, NLP, NLPTrainer } from '../../../modules/nlp';
import { Entities } from '../../../modules/nlp/Entities';
import { FSFileHandler } from '../../../modules/util/file';
import { FSFileHandler } from '../../../modules/util/fs/FSFileHandler';
import { shouldHaveUIEntities } from '../entity-util';

describe( 'nlp.pt.ui', () => {
Expand All @@ -16,7 +17,7 @@ describe( 'nlp.pt.ui', () => {
const dir = resolve( process.cwd(), 'dist/' );
const langDir = resolve( dir, DEFAULT_DIR_LANGUAGE );

const fileHandler = new FSFileHandler( fs );
const fileHandler = new FSFileHandler( fs, promisify );
const langLoader: LanguageContentLoader = new JsonLanguageContentLoader(
langDir,
{},
Expand Down
Loading

0 comments on commit 5bbf4e1

Please sign in to comment.