idea-aws 3.13.2 → 3.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/comprehend.d.ts +8 -2
- package/dist/src/comprehend.js +11 -0
- package/package.json +1 -1
package/dist/src/comprehend.d.ts
CHANGED
|
@@ -14,9 +14,15 @@ export declare class Comprehend {
|
|
|
14
14
|
/**
|
|
15
15
|
* Inspects text and returns an inference of the prevailing sentiment (POSITIVE, NEUTRAL, MIXED, or NEGATIVE).
|
|
16
16
|
*/
|
|
17
|
-
detectSentiment(params:
|
|
17
|
+
detectSentiment(params: DetectSentimentParameters): Promise<Sentiment>;
|
|
18
|
+
/**
|
|
19
|
+
* Determines the dominant language of the input text.
|
|
20
|
+
*/
|
|
21
|
+
detectDominantLanguage(params: {
|
|
22
|
+
text: string;
|
|
23
|
+
}): Promise<string>;
|
|
18
24
|
}
|
|
19
|
-
export interface
|
|
25
|
+
export interface DetectSentimentParameters {
|
|
20
26
|
/**
|
|
21
27
|
* The language of the input contents. You can specify any of the primary languages supported by Amazon Comprehend.
|
|
22
28
|
* All contents must be in the same language. Required.
|
package/dist/src/comprehend.js
CHANGED
|
@@ -20,5 +20,16 @@ class Comprehend {
|
|
|
20
20
|
.promise();
|
|
21
21
|
return result.Sentiment;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Determines the dominant language of the input text.
|
|
25
|
+
*/
|
|
26
|
+
async detectDominantLanguage(params) {
|
|
27
|
+
if (!params.text)
|
|
28
|
+
throw new Error('Missing text');
|
|
29
|
+
const result = await this.comprehend.detectDominantLanguage({ Text: params.text }).promise();
|
|
30
|
+
if (!result.Languages.length)
|
|
31
|
+
throw new Error('Not found');
|
|
32
|
+
return result.Languages[0].LanguageCode;
|
|
33
|
+
}
|
|
23
34
|
}
|
|
24
35
|
exports.Comprehend = Comprehend;
|