import { Config , Token , TokenizerConfig } from '../../core/types' ; import Tokenizer from '../../core/Tokenizer' ; import Formatter from '../../core/Formatter' ; export default abstract class AbstractFormatter { param { Object } cfg constructor ( public cfg ) { } abstract getTokenizerConfig ( ) ; param { string } query return { string } format ( query ) { return new Formatter ( this . cfg , this . tokenizer ( ) , this . tokenOverride ) . format ( query ) ; } tokenize ( query ) { return this . tokenizer ( ) . tokenize ( query ) ; } tokenizer ( ) { return new Tokenizer ( this . getTokenizerConfig ( ) ) ; } protected tokenOverride ? : ( token : Token , previousToken ? : Token ) => Token ; }