| 1 | import type * as comprehend from "@distilled.cloud/aws/comprehend"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `comprehend:DetectDominantLanguage` — determine the |
| 7 | * dominant language of the input text (returns RFC 5646 language codes with |
| 8 | * confidence scores). |
| 9 | * |
| 10 | * Comprehend's synchronous detect APIs are pure pay-per-call with no |
| 11 | * resource to manage: the binding takes no arguments and grants the action |
| 12 | * on `*` (it has no resource-level IAM). |
| 13 | * |
| 14 | * ### Real-Time Analysis |
| 15 | * **Example:** Detect the Language of a Document |
| 16 | * ```typescript |
| 17 | * // init |
| 18 | * const detectDominantLanguage = yield* AWS.Comprehend.DetectDominantLanguage(); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const result = yield* detectDominantLanguage({ |
| 22 | * Text: "Bob ordered two sandwiches yesterday.", |
| 23 | * }); |
| 24 | * // result.Languages[0].LanguageCode === "en" |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface DetectDominantLanguage extends Binding.Service< |
| 30 | DetectDominantLanguage, |
| 31 | "AWS.Comprehend.DetectDominantLanguage", |
| 32 | () => Effect.Effect< |
| 33 | ( |
| 34 | request: comprehend.DetectDominantLanguageRequest, |
| 35 | ) => Effect.Effect< |
| 36 | comprehend.DetectDominantLanguageResponse, |
| 37 | comprehend.DetectDominantLanguageError |
| 38 | > |
| 39 | > |
| 40 | > {} |
| 41 | export const DetectDominantLanguage = Binding.Service<DetectDominantLanguage>( |
| 42 | "AWS.Comprehend.DetectDominantLanguage", |
| 43 | ); |