Spaces:
Sleeping
Sleeping
Download src/lib/exampleUtils.ts from taboola-cz/quiz_flash: direct link, hf CLI and curl.
- Browser
- Download file 588 Bytes
-
https://huggingface.co/spaces/taboola-cz/quiz_flash/resolve/main/src/lib/exampleUtils.ts
- Command line
-
hf download hf://spaces/taboola-cz/quiz_flash/src/lib/exampleUtils.ts
-
curl -L -o exampleUtils.ts https://huggingface.co/spaces/taboola-cz/quiz_flash/resolve/main/src/lib/exampleUtils.ts
588 Bytes
| import type { PromptExample } from '@/types/example'; | |
| /** | |
| * Get all unique sub-types from a collection of examples | |
| */ | |
| export function getUniqueSubTypes(examples: PromptExample[]): string[] { | |
| const subTypes = new Set<string>(); | |
| examples.forEach(example => { | |
| if (example.子題型) { | |
| subTypes.add(example.子題型); | |
| } | |
| }); | |
| return Array.from(subTypes); | |
| } | |
| /** | |
| * Filter examples by sub-type | |
| */ | |
| export function getExamplesBySubType(examples: PromptExample[], subType: string): PromptExample[] { | |
| return examples.filter(example => example.子題型 === subType); | |
| } | |