|
1 | 1 | import winkNlp, {
|
2 |
| - Sentences, |
3 |
| - CustomEntities, |
4 |
| - SelectedCustomEntities, |
5 |
| - Entities, |
6 |
| - SelectedEntities, |
7 |
| - Tokens, |
8 |
| - SelectedTokens, |
9 |
| - ItsFunction, |
10 |
| - AsFunction, |
| 2 | + Sentences, |
| 3 | + CustomEntities, |
| 4 | + SelectedCustomEntities, |
| 5 | + Entities, |
| 6 | + SelectedEntities, |
| 7 | + Tokens, |
| 8 | + SelectedTokens, |
| 9 | + ItemCustomEntity, |
| 10 | + ItemEntity, |
| 11 | + ItemSentence, |
| 12 | + ItemToken, |
| 13 | + Document, |
| 14 | + ItsFunction, |
| 15 | + AsFunction, |
11 | 16 | } from 'wink-nlp';
|
12 | 17 | import model from 'wink-eng-lite-web-model';
|
13 | 18 |
|
@@ -35,9 +40,37 @@ customEntities.out(its.value, as.array);
|
35 | 40 | // $ExpectType string[]
|
36 | 41 | customEntities.out(its.value, as.array);
|
37 | 42 |
|
38 |
| -type OutApplicable = Sentences | CustomEntities | SelectedCustomEntities | Entities | SelectedEntities | Tokens | SelectedTokens; |
| 43 | +type ColOutApplicable = Sentences | CustomEntities | SelectedCustomEntities | Entities | SelectedEntities | Tokens | SelectedTokens; |
39 | 44 |
|
40 |
| -// $ExpectType <T, U>(toOut: OutApplicable, itsf: ItsFunction<T>, asf: AsFunction<T, U>) => U |
41 |
| -function myOut<T, U>(toOut: OutApplicable, itsf: ItsFunction<T>, asf: AsFunction<T, U>): U { |
| 45 | +// collection out |
| 46 | +// $ExpectType <T, U>(toOut: ColOutApplicable, itsf: ItsFunction<T>, asf: AsFunction<T, U>) => U |
| 47 | +function myColOut<T, U>(toOut: ColOutApplicable, itsf: ItsFunction<T>, asf: AsFunction<T, U>): U { |
42 | 48 | return (toOut.out(itsf, asf) as any) as U;
|
43 | 49 | }
|
| 50 | + |
| 51 | +// $ExpectType string[] | boolean[] | [token: boolean, freq: number][] |
| 52 | +customEntities.out(its.contractionFlag, as.freqTable); |
| 53 | + |
| 54 | +// $ExpectType [token: boolean, freq: number][] |
| 55 | +myColOut(customEntities, its.contractionFlag, as.freqTable); |
| 56 | + |
| 57 | +// $ExpectType string[] |
| 58 | +doc.tokens().out(); |
| 59 | + |
| 60 | +// $ExpectType string[] | boolean[] |
| 61 | +doc.tokens().out(its.abbrevFlag); |
| 62 | + |
| 63 | +// run out on item types |
| 64 | +type ItemOutApplicable = ItemCustomEntity | ItemEntity | ItemSentence | ItemToken | Document; |
| 65 | + |
| 66 | +// item out |
| 67 | +// $ExpectType <T>(toOut: ItemOutApplicable, itsf: ItsFunction<T>) => T |
| 68 | +function myItemOut<T>(toOut: ItemOutApplicable, itsf: ItsFunction<T>): T { |
| 69 | + return (toOut.out(itsf) as any) as T; |
| 70 | +} |
| 71 | + |
| 72 | +// $ExpectType string | number[] |
| 73 | +doc.out(its.span); |
| 74 | + |
| 75 | +// $ExpectType number[] |
| 76 | +myItemOut(doc, its.span); |
0 commit comments