import { ExtractionRule , ExtractionScore } from './base' ; export class BasicExtrationRule extends ExtractionRule { name = 'basic' ; shouldExtract ( str ) { const s = str . replace ( /\$\{.*?\}/g , '' ) . trim ( ) ; if ( s . length === 0 ) return ExtractionScore . MustExclude ; if ( s . match ( /^{.*}$/ ) ) return ExtractionScore . MustExclude ; if ( s . includes ( ' ' ) && s . match ( /\w/ ) ) return ExtractionScore . ShouldInclude ; if ( s . match ( /[a-z][A-Z0-9]/ ) ) return ExtractionScore . ShouldExclude ; if ( s . match ( /^[a-z0-9-]+$/ ) ) return ExtractionScore . ShouldExclude ; if ( s . match ( /^[A-Z0-9-]+$/ ) ) return ExtractionScore . ShouldExclude ; if ( s . match ( /^[\d.]+$/ ) ) return ExtractionScore . ShouldExclude ; if ( s . match ( /^[A-Za-z0-9]+$/ ) ) return ExtractionScore . ShouldInclude ; if ( s . length === 1 && ! '/.-\\:+$^#_"\',' . includes ( s ) ) return ExtractionScore . ShouldInclude ; } }