(prompt: string, known: (word: string) => boolean)
| 131 | * ("test"), or only greetings ("hallo du"). The name of the selection or of a known symbol |
| 132 | * is a question about it. */ |
| 133 | export function noQuestion(prompt: string, known: (word: string) => boolean): boolean { |
| 134 | const words = prompt.toLowerCase().match(/[\p{L}\p{N}_][\p{L}\p{N}_.:/-]*/gu) ?? []; |
| 135 | if (!words.length) return true; |
| 136 | if (words.some(word => known(word.replace(/[.:/-]+$/, '')))) return false; |
| 137 | if (words.length === 1) return !ONE_WORD_QUESTION.test(words[0]); |
| 138 | return words.length <= 3 && words.every(word => GREETINGS.has(word)); |
| 139 | } |
| 140 | |
| 141 | /** What the examples of a prompt without a question are about; a Galaxy selection with its evidence. */ |
| 142 | export type ExampleSubject = { kind: 'galaxy'; name: string; evidence?: GalaxyEvidence } | { kind: 'other'; name: string } | { kind: 'marked' }; |
no test coverage detected