Socket
Socket
Sign inDemoInstall

@botbuildercommunity/text-analytics-middleware

Package Overview
Dependencies
263
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.2.2

example/botbuilder-sentiment-middleware-testbot.bot

12

package.json
{
"name": "@botbuildercommunity/text-analytics-middleware",
"version": "0.1.2",
"version": "0.2.2",
"description": "Bot Framework middleware component for the Cognitive Services Text Analytics API, including sentiment analysis, language detection, entity extraction, and keyword recognition.",

@@ -11,3 +11,3 @@ "main": "./lib/index.js",

"scripts": {
"postinstall": "tsc -p .",
"build": "tsc -p .",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -39,6 +39,8 @@ },

"azure-cognitiveservices-textanalytics": "^2.0.0",
"botbuilder": "^4.0.6",
"ms-rest-azure": "^2.5.9",
"typescript": "^3.1.1"
"botbuilder": "^4.3.4",
"ms-rest-azure": "^2.5.9"
},
"devDependencies": {
"typescript": "^3.4.1"
}
}

@@ -11,7 +11,9 @@ # Text Analytics Middleware

All middleware is created and use in the same way. For example, for sentiment analysis, import the `SentimentAnalysis` class from the package, and add it to your bot adapter:
All middleware is created and used in the same way. For example, for sentiment analysis, import the `SentimentAnalysis` class from the package, and add it to your bot adapter:
import { SentimentAnalysis } from "@botbuildercommunity/text-analytics-middleware";
```typescript
import { SentimentAnalysis } from '@botbuildercommunity/text-analytics-middleware';
adapter.use(new SentimentAnalysis(YOUR_TEXT_ANALYTICS_KEY, TEXT_ANALYTICS_API_ENDPOINT, SERVICE_CLIENT_OPTIONS));
adapter.use(new SentimentAnalysis(YOUR_TEXT_ANALYTICS_KEY, TEXT_ANALYTICS_API_ENDPOINT, SERVICE_CLIENT_OPTIONS));
```

@@ -31,7 +33,7 @@ > Note that the TEXT_ANALYTICS_API_ENDPOINT will be the Cognitive Services endpoint root. For example: https://eastus.api.cognitive.microsoft.com

In each case, properties are added to the `turnState` of the `TurnContext` You can retrieve them in your bot via:
In each case, properties are added to the `turnState` of the `TurnContext`. You can retrieve them in your bot via:
* `context.turnState.get("sentimentScore")` //This is a number for `SentimentAnalysis`
* `context.turnState.get("language")` //This is a string for `LanguageDetection`
* `context.turnState.get("keyPhrases")` //This is an array of strings for `KeyPhrases`
* `context.turnState.get("textEntities")` //This is an array of `EntityRecord` types` for `EntityExtraction`
* `context.turnState.get('sentimentScore')` //This is a number for `SentimentAnalysis`
* `context.turnState.get('language')` //This is a string for `LanguageDetection`
* `context.turnState.get('keyPhrases')` //This is an array of strings for `KeyPhrases`
* `context.turnState.get('textEntities')` //This is an array of `EntityRecord` types` for `EntityExtraction`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc