Skip to content

Commit

Permalink
Fix #9 about the parameter language
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodp committed Jun 1, 2018
1 parent e1509ab commit fe1bce4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/modules/app/CompilerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CompilerController {
compile(options, cli) {
return __awaiter(this, void 0, void 0, function* () {
const langLoader = new LanguageContentLoader_1.JsonLanguageContentLoader(options.languageDir, {}, options.encoding);
let lexer = (new LexerBuilder_1.LexerBuilder(langLoader)).build(options);
let lexer = (new LexerBuilder_1.LexerBuilder(langLoader)).build(options, options.language);
let parser = new Parser_1.Parser();
let nlpTrainer = new NLPTrainer_1.NLPTrainer(langLoader);
let nlpBasedSentenceRecognizer = new NLPBasedSentenceRecognizer_1.NLPBasedSentenceRecognizer(nlpTrainer);
Expand Down
6 changes: 5 additions & 1 deletion dist/modules/util/SimpleCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ class SimpleCompiler {
lines.forEach((val, index) => this.lexer.addNodeFromLine(val, index + 1));
let doc = {};
doc.fileInfo = fileInfo;
this.singleDocProcessor.analyzeNodes(doc, this.lexer, this.parser, this.nlpRec, this.language);
let language = this.language;
if (doc.language) {
language = doc.language.value;
}
this.singleDocProcessor.analyzeNodes(doc, this.lexer, this.parser, this.nlpRec, language);
spec.docs.push(doc);
return doc;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/app/CompilerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class CompilerController {
const langLoader: LanguageContentLoader =
new JsonLanguageContentLoader( options.languageDir, {}, options.encoding );

let lexer: Lexer = ( new LexerBuilder( langLoader ) ).build( options );
let lexer: Lexer = ( new LexerBuilder( langLoader ) ).build( options, options.language );
let parser: Parser = new Parser();

let nlpTrainer: NLPTrainer = new NLPTrainer( langLoader );
Expand Down
8 changes: 7 additions & 1 deletion modules/util/SimpleCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ export class SimpleCompiler {
lines.forEach( ( val, index ) => this.lexer.addNodeFromLine( val, index + 1 ) );
let doc: Document = {} as Document;
doc.fileInfo = fileInfo;
this.singleDocProcessor.analyzeNodes( doc, this.lexer, this.parser, this.nlpRec, this.language );

let language = this.language;
if ( doc.language ) {
language = doc.language.value;
}

this.singleDocProcessor.analyzeNodes( doc, this.lexer, this.parser, this.nlpRec, language );
spec.docs.push( doc );
return doc;
}
Expand Down

0 comments on commit fe1bce4

Please sign in to comment.