Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
NuGet update for Text Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosP-MS committed Feb 7, 2020
1 parent 8b2f234 commit bffcb88
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Kiosk/CognitiveServiceApiKeyTester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ public static async Task TestTextAnalyticsApiKeyAsync(string key, string apiEndp
Endpoint = apiEndpoint
};

await client.SentimentAsync(multiLanguageBatchInput:
await client.SentimentBatchAsync(multiLanguageBatchInput:
new MultiLanguageBatchInput(
new List<MultiLanguageInput>()
{
new MultiLanguageInput("en", "0", "I had the best day of my life."),
new MultiLanguageInput("0", "I had the best day of my life.", "en"),
}));
}
}
Expand Down
4 changes: 2 additions & 2 deletions Kiosk/IntelligentKioskSample.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2036
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntelligentKioskSample", "IntelligentKioskSample.csproj", "{B08D337A-AF9F-4705-B8C1-C7F07FACD8C5}"
EndProject
Expand Down
1 change: 1 addition & 0 deletions Kiosk/ServiceHelpers/Models/AnomalyDetectResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

using System;
using System.Collections.Generic;
using System.Globalization;

namespace ServiceHelpers.Models
{
Expand Down
2 changes: 1 addition & 1 deletion Kiosk/ServiceHelpers/ServiceHelpers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<Version>0.8.0-preview</Version>
</PackageReference>
<PackageReference Include="Microsoft.Azure.CognitiveServices.Language.TextAnalytics">
<Version>3.0.0</Version>
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.Azure.CognitiveServices.Vision.ComputerVision">
<Version>5.0.0</Version>
Expand Down
8 changes: 4 additions & 4 deletions Kiosk/ServiceHelpers/TextAnalyticsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public static async Task<SentimentResult> GetSentimentAsync(string[] input, stri
var inputList = new List<MultiLanguageInput>();
for (int i = 0; i < input.Length; i++)
{
inputList.Add(new MultiLanguageInput(language, i.ToString(), input[i]));
inputList.Add(new MultiLanguageInput(i.ToString(), input[i], language));
}

SentimentBatchResult result = await client.SentimentAsync(multiLanguageBatchInput: new MultiLanguageBatchInput(inputList));
SentimentBatchResult result = await client.SentimentBatchAsync(multiLanguageBatchInput: new MultiLanguageBatchInput(inputList));
IEnumerable<double> scores = result.Documents.OrderBy(x => x.Id).Select(x => x.Score.GetValueOrDefault());
return new SentimentResult { Scores = scores };
}
Expand All @@ -133,10 +133,10 @@ public static async Task<KeyPhrasesResult> GetKeyPhrasesAsync(string[] input, st
var inputList = new List<MultiLanguageInput>();
for (int i = 0; i < input.Length; i++)
{
inputList.Add(new MultiLanguageInput(language, i.ToString(), input[i]));
inputList.Add(new MultiLanguageInput(i.ToString(), input[i], language));
}

KeyPhraseBatchResult result = await client.KeyPhrasesAsync(multiLanguageBatchInput: new MultiLanguageBatchInput(inputList));
KeyPhraseBatchResult result = await client.KeyPhrasesBatchAsync(multiLanguageBatchInput: new MultiLanguageBatchInput(inputList));
IEnumerable<IList<string>> keyPhrases = result.Documents.OrderBy(x => x.Id).Select(x => x.KeyPhrases);
return new KeyPhrasesResult() { KeyPhrases = keyPhrases };
}
Expand Down

0 comments on commit bffcb88

Please sign in to comment.