This is created to show a proof of concept for customer support using Microsoft Cognitive Service.
Imagine we have thousands of hours of recordings of customer service and what we want to achieve is the following:
- Convert speech to text
- Get text sentiment
- Get key phrases
- Ideally add additional context like persons, corporations, etc.
We use Microsoft Cognitive Services to convert speech to text and do some text analysis to get some extra context out of text.
You can either use your microphone or put a .wav
as parameter to the app for speech to text + analysis.
When using a microphone, the app will listen for your input and will start analyzing as soon as it detect a bit longer pause.
The text is then processed by Text Analysis v3.0 (also supports v2.1).
Figure: Demonstration of the app.
You'll need .NET Core 3.1 SDK to run the code. For testing you need either a microphone or a .wav
audio file.
Create following Cognitive Services in Azure Portal:
- Cognitive Services Speech
- Cognitive Services Text Analysis
Copy the values from Speech and Text Analysis into the variables in Programs.cs
.
Figure: Copy value from Azure Portal.
Run the application in CognitiveServicesDemo.CustomerSupport
folder for microphone demo.
dotnet run
To use a .wav
as an input, add the .wav
file as a parameter.
dotnet run "[path-to-wav.wav]"
Visual Studio:
Open CognitiveServicesDemo.CustomerSupport.sln
and press F5.
If you want to play a .wav
file:
- Go to
CognitiveServicesDemo.CustomerSupport
project - Find
launchSettings.json
underProperties
- Add path to
commandLineArgs
variable and escape"
and\
- Press F5
Example of launchSettings.json
:
{
"profiles": {
"CognitiveServicesDemo.CustomerSupport": {
"commandName": "Project",
"commandLineArgs": "\"C:\\DataJK\\Audio\\test.wav\""
}
}
}