From 65a0e9d187ad35fa5330dc418b4f45b56235a7e3 Mon Sep 17 00:00:00 2001 From: Eddie Antonio Santos Date: Wed, 11 Sep 2019 10:37:55 -0600 Subject: [PATCH] Remove class-based word breaker. This method of specifying a word breaker was not fully implemented, and is undocumented. --- .../lexical-model-compiler.ts | 9 --------- .../lexical-model-compiler/lexical-model.ts | 18 +----------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/developer/js/source/lexical-model-compiler/lexical-model-compiler.ts b/developer/js/source/lexical-model-compiler/lexical-model-compiler.ts index b33098fe81..e6649acd17 100644 --- a/developer/js/source/lexical-model-compiler/lexical-model-compiler.ts +++ b/developer/js/source/lexical-model-compiler/lexical-model-compiler.ts @@ -22,8 +22,6 @@ export default class LexicalModelCompiler { * @param sourcePath Where to find auxilary sources files */ generateLexicalModelCode(model_id: string, modelSource: LexicalModelSource, sourcePath: string) { - let compiler = this; - // TODO: add metadata in comment const filePrefix: string = `(function() {\n'use strict';\n`; const fileSuffix: string = `})();`; @@ -42,13 +40,6 @@ export default class LexicalModelCompiler { // Note: the .toString() might just be the property name, but we want a // plain function: .replace(/^wordBreak(ing|er)\b/, 'function'); - } else if (wordBreakerSpec.sources) { - compiler.logError('class-based word breaker is not officially supported :/'); - let wordBreakerSources: string[] = wordBreakerSpec.sources.map(function(source) { - return fs.readFileSync(path.join(sourcePath, source), 'utf8'); - }); - - wordBreakerSourceCode = this.transpileSources(wordBreakerSources).join('\n'); } } diff --git a/developer/js/source/lexical-model-compiler/lexical-model.ts b/developer/js/source/lexical-model-compiler/lexical-model.ts index 7dce790eb9..be22403a01 100644 --- a/developer/js/source/lexical-model-compiler/lexical-model.ts +++ b/developer/js/source/lexical-model-compiler/lexical-model.ts @@ -4,22 +4,6 @@ */ /// -/** - * ****** TODO: DELETE ME****** - * - * This form of specifying word breakers is not implemented. - * - */ -interface ClassBasedWordBreaker { - allowedCharacters?: { initials?: string, medials?: string, finals?: string } | string, - defaultBreakCharacter?: string - sources?: Array; - /** - * The name of the type to instantiate (without parameters) as the base object for a custom word-breaking model. - */ - rootClass?: string -} - interface LexicalModel { readonly format: 'trie-1.0'|'fst-foma-1.0'|'custom-1.0', //... metadata ... @@ -41,7 +25,7 @@ interface LexicalModelSource extends LexicalModel { * - word breaking function -- provide your own function that breaks words. * - class-based word-breaker - may be supported in the future. */ - readonly wordBreaker?: 'default' | 'ascii' | WordBreakingFunction | ClassBasedWordBreaker; + readonly wordBreaker?: 'default' | 'ascii' | WordBreakingFunction; /** * How to simplify words, to convert them into simplifired search keys