( code: string, options: GenerateOptions )
| 8 | } |
| 9 | |
| 10 | export function isProfileCompatible( |
| 11 | code: string, |
| 12 | options: GenerateOptions |
| 13 | ): boolean { |
| 14 | const profile: HumanProfile = options.profile ?? 'default' |
| 15 | const analysis = analyze(code) |
| 16 | const prediction = predictCodeQuality(code, options) |
| 17 | |
| 18 | switch (profile) { |
| 19 | case 'children': { |
| 20 | if (analysis.memorability === 'low') return false |
| 21 | if (prediction.memorabilityScore < 0.6) return false |
| 22 | if (analysis.isSequentialAsc || analysis.isSequentialDesc) |
| 23 | return false |
| 24 | return true |
| 25 | } |
| 26 | case 'elderly': { |
| 27 | if (analysis.memorability === 'low') return false |
| 28 | if (analysis.entropy > 11 && analysis.length === 6) return false |
| 29 | return true |
| 30 | } |
| 31 | case 'asia': { |
| 32 | if (code.includes('4')) return false |
| 33 | return true |
| 34 | } |
| 35 | case 'latam': { |
| 36 | if (code[0] === '0' || code[0] === '1') return false |
| 37 | return true |
| 38 | } |
| 39 | case 'default': |
| 40 | default: |
| 41 | return true |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | export function isModeCompatible( |
| 46 | code: string, |
no test coverage detected