Download web/tests/exampleText.test.ts from lorcapoul/smol-neuron-studio: direct link, hf CLI and curl.
- Browser
- Download file 942 Bytes
-
https://huggingface.co/spaces/lorcapoul/smol-neuron-studio/resolve/main/web/tests/exampleText.test.ts
- Command line
-
hf download hf://spaces/lorcapoul/smol-neuron-studio/web/tests/exampleText.test.ts
-
curl -L -o exampleText.test.ts https://huggingface.co/spaces/lorcapoul/smol-neuron-studio/resolve/main/web/tests/exampleText.test.ts
942 Bytes
| import { describe, expect, it } from 'vitest' | |
| import { confidenceLevel, exampleSegments } from '../app/utils/exampleText' | |
| describe('exampleSegments', () => { | |
| const tokens = ['The', ' capital', ' of', ' France', ' is', ' Paris', '.', '\n', 'It'] | |
| it('parte alrededor del token marcado', () => { | |
| const s = exampleSegments(tokens, 3, 2) | |
| expect(s).toEqual({ before: ' capital of ', token: 'France', after: ' is Paris', clippedLeft: true, clippedRight: true }) | |
| }) | |
| it('sin recorte en los bordes y saltos de línea visibles', () => { | |
| const s = exampleSegments(tokens, 6, 20) | |
| expect(s.clippedLeft).toBe(false) | |
| expect(s.clippedRight).toBe(false) | |
| expect(s.after).toBe(' ↵ It') | |
| }) | |
| }) | |
| describe('confidenceLevel', () => { | |
| it.each([ | |
| [0.95, 'high'], | |
| [0.8, 'high'], | |
| [0.6, 'medium'], | |
| [0.3, 'low'], | |
| [0.1, 'none'], | |
| ])('%s → %s', (c, level) => { | |
| expect(confidenceLevel(c)).toBe(level) | |
| }) | |
| }) | |