-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Cognitive Services Data Plane Vision+Language SDK #3604
Merged
Merged
Changes from 10 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0fd88bf
Adding Vision SDK.
DavidLiCIG 975007a
Add Text Analytics SDK.
DavidLiCIG 6d5299c
Adding Vision
DavidLiCIG fcc2b9c
Removing key.
DavidLiCIG 97895d4
Removing unneeded files
DavidLiCIG b14e4b9
Removing key.
DavidLiCIG 3bd1247
Hooking up Cognitive SDKs with build.
DavidLiCIG ed0da9a
Updating Swagger spec.
DavidLiCIG 251006f
Fix build
DavidLiCIG 3d8b3d4
Moving files around and adding sub namespace for TA.
DavidLiCIG a3f68ec
Merge branch 'psSdkJson6' into psSdkJson6
shahabhijeet 0761253
Merge remote-tracking branch 'azure-sdk-for-net/psSdkJson6' into Offi…
DavidLiCIG 5c220e3
Moving managemenet and dataplane folders into their respective folders.
DavidLiCIG cf8fee6
Updating csproj and files based on comments.
DavidLiCIG 75427ce
Simplifying csprojects
DavidLiCIG f1b0d1f
Merge branch 'psSdkJson6' of https://github.com/DavidLiCIG/azure-sdk-…
DavidLiCIG 9e41f33
Move to temp directory
DavidLiCIG 349f35d
Move back to dataPlane with right casing
DavidLiCIG d394cc1
Move to dataPlane directory
DavidLiCIG a3dc7e9
Fixing presumptive OS specific path convention.
DavidLiCIG e9e182b
Adding Assembly.Info for Language
DavidLiCIG 529c38d
Adding AssemblyInfo for VIsion
DavidLiCIG 58508d0
Updates based on feedback.
DavidLiCIG 8ab7c50
Adding a simple readme.md.
DavidLiCIG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...itiveServices/data-plane/Language/Microsoft.CognitiveServices.Language.Tests/BaseTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Microsoft.CognitiveServices.Language.TextAnalytics; | ||
using System.Net.Http; | ||
|
||
namespace Language.Tests | ||
{ | ||
public abstract class BaseTests | ||
{ | ||
public static bool IsTestTenant = false; | ||
private static string SubscriptionKey = ""; | ||
private static string Region = null; | ||
|
||
static BaseTests() | ||
{ | ||
// Retrieve the configuration information. | ||
|
||
Region = "WestUS"; | ||
} | ||
|
||
protected ITextAnalyticsAPI GetClient(DelegatingHandler handler) | ||
{ | ||
ITextAnalyticsAPI client; | ||
client = new TextAnalyticsAPI(handlers: handler); | ||
client.SubscriptionKey = SubscriptionKey; | ||
|
||
return client; | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...rosoft.CognitiveServices.Language.Tests/Microsoft.CognitiveServices.Language.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('AzSdk.test.reference.props'))" /> | ||
<PropertyGroup> | ||
<PackageId>Microsoft.CognitiveServices.Language.Tests</PackageId> | ||
<Description>Microsoft.CognitiveServices.Language.Tests Class Library</Description> | ||
<AssemblyName>Microsoft.CognitiveServices.Language.Tests</AssemblyName> | ||
<VersionPrefix>1.0.0-preview</VersionPrefix> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp1.1</TargetFramework> | ||
<RootNamespace>Language.Tests</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="1.6.0-preview" /> | ||
<ProjectReference Include="..\Microsoft.CognitiveServices.Language\Microsoft.CognitiveServices.Language.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Update="SessionRecords\**\*.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="Helpers\" /> | ||
</ItemGroup> | ||
|
||
</Project> |
55 changes: 55 additions & 0 deletions
55
...Tests/SessionRecords/Language.TextAnalytics.Tests.DetectLanguageTests/DetectLanguage.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"Entries": [ | ||
{ | ||
"RequestUri": "/text/analytics/v2.0/languages", | ||
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAvbGFuZ3VhZ2Vz", | ||
"RequestMethod": "POST", | ||
"RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}", | ||
"RequestHeaders": { | ||
"Content-Type": [ | ||
"application/json; charset=utf-8" | ||
], | ||
"Content-Length": [ | ||
"98" | ||
], | ||
"Ocp-Apim-Subscription-Key": [ | ||
"" | ||
], | ||
"User-Agent": [ | ||
"FxVersion/4.6.25211.01", | ||
"Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0" | ||
] | ||
}, | ||
"ResponseBody": "{\r\n \"documents\": [\r\n {\r\n \"id\": \"id\",\r\n \"detectedLanguages\": [\r\n {\r\n \"name\": \"English\",\r\n \"iso6391Name\": \"en\",\r\n \"score\": 1.0\r\n }\r\n ]\r\n }\r\n ],\r\n \"errors\": []\r\n}", | ||
"ResponseHeaders": { | ||
"Content-Type": [ | ||
"application/json; charset=utf-8" | ||
], | ||
"Date": [ | ||
"Wed, 30 Aug 2017 02:11:18 GMT" | ||
], | ||
"Transfer-Encoding": [ | ||
"chunked" | ||
], | ||
"x-ms-transaction-count": [ | ||
"1" | ||
], | ||
"x-aml-ta-request-id": [ | ||
"473e3a1f-cf5e-4230-85b5-68fe2518370f" | ||
], | ||
"X-Content-Type-Options": [ | ||
"nosniff" | ||
], | ||
"apim-request-id": [ | ||
"69e6aeb0-e601-42ca-9468-f0cfaa408708" | ||
], | ||
"Strict-Transport-Security": [ | ||
"max-age=31536000; includeSubDomains; preload" | ||
] | ||
}, | ||
"StatusCode": 200 | ||
} | ||
], | ||
"Names": {}, | ||
"Variables": {} | ||
} |
55 changes: 55 additions & 0 deletions
55
...anguage.Tests/SessionRecords/Language.TextAnalytics.Tests.KeyPhrasesTests/KeyPhrases.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"Entries": [ | ||
{ | ||
"RequestUri": "/text/analytics/v2.0/keyPhrases", | ||
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAva2V5UGhyYXNlcw==", | ||
"RequestMethod": "POST", | ||
"RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}", | ||
"RequestHeaders": { | ||
"Content-Type": [ | ||
"application/json; charset=utf-8" | ||
], | ||
"Content-Length": [ | ||
"123" | ||
], | ||
"Ocp-Apim-Subscription-Key": [ | ||
"" | ||
], | ||
"User-Agent": [ | ||
"FxVersion/4.6.25211.01", | ||
"Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0" | ||
] | ||
}, | ||
"ResponseBody": "{\r\n \"documents\": [\r\n {\r\n \"keyPhrases\": [\r\n \"team mates\"\r\n ],\r\n \"id\": \"id\"\r\n }\r\n ],\r\n \"errors\": []\r\n}", | ||
"ResponseHeaders": { | ||
"Content-Type": [ | ||
"application/json; charset=utf-8" | ||
], | ||
"Date": [ | ||
"Wed, 30 Aug 2017 02:11:17 GMT" | ||
], | ||
"Transfer-Encoding": [ | ||
"chunked" | ||
], | ||
"x-ms-transaction-count": [ | ||
"1" | ||
], | ||
"x-aml-ta-request-id": [ | ||
"460baaca-7f57-42c1-8cc7-8852957d05b9" | ||
], | ||
"X-Content-Type-Options": [ | ||
"nosniff" | ||
], | ||
"apim-request-id": [ | ||
"3f09b1c9-fe3b-46bb-badf-98108c599825" | ||
], | ||
"Strict-Transport-Security": [ | ||
"max-age=31536000; includeSubDomains; preload" | ||
] | ||
}, | ||
"StatusCode": 200 | ||
} | ||
], | ||
"Names": {}, | ||
"Variables": {} | ||
} |
55 changes: 55 additions & 0 deletions
55
....Language.Tests/SessionRecords/Language.TextAnalytics.Tests.SentimentTests/Sentiment.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"Entries": [ | ||
{ | ||
"RequestUri": "/text/analytics/v2.0/sentiment", | ||
"EncodedRequestUri": "L3RleHQvYW5hbHl0aWNzL3YyLjAvc2VudGltZW50", | ||
"RequestMethod": "POST", | ||
"RequestBody": "{\r\n \"documents\": [\r\n {\r\n \"language\": \"en\",\r\n \"id\": \"id\",\r\n \"text\": \"I love my team mates\"\r\n }\r\n ]\r\n}", | ||
"RequestHeaders": { | ||
"Content-Type": [ | ||
"application/json; charset=utf-8" | ||
], | ||
"Content-Length": [ | ||
"123" | ||
], | ||
"Ocp-Apim-Subscription-Key": [ | ||
"" | ||
], | ||
"User-Agent": [ | ||
"FxVersion/4.6.25211.01", | ||
"Microsoft.CognitiveServices.Language.TextAnalytics.TextAnalyticsAPI/1.0.0" | ||
] | ||
}, | ||
"ResponseBody": "{\r\n \"documents\": [\r\n {\r\n \"score\": 0.97380387783050537,\r\n \"id\": \"id\"\r\n }\r\n ],\r\n \"errors\": []\r\n}", | ||
"ResponseHeaders": { | ||
"Content-Type": [ | ||
"application/json; charset=utf-8" | ||
], | ||
"Date": [ | ||
"Wed, 30 Aug 2017 02:11:17 GMT" | ||
], | ||
"Transfer-Encoding": [ | ||
"chunked" | ||
], | ||
"x-ms-transaction-count": [ | ||
"1" | ||
], | ||
"x-aml-ta-request-id": [ | ||
"06db056b-1bf0-4994-933a-f08eacf94053" | ||
], | ||
"X-Content-Type-Options": [ | ||
"nosniff" | ||
], | ||
"apim-request-id": [ | ||
"63c5b90f-3a35-48c3-bb85-d89218d1202e" | ||
], | ||
"Strict-Transport-Security": [ | ||
"max-age=31536000; includeSubDomains; preload" | ||
] | ||
}, | ||
"StatusCode": 200 | ||
} | ||
], | ||
"Names": {}, | ||
"Variables": {} | ||
} |
34 changes: 34 additions & 0 deletions
34
.../Language/Microsoft.CognitiveServices.Language.Tests/TextAnalytics/DetectLanguageTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Language.Tests; | ||
using Microsoft.Azure.Test.HttpRecorder; | ||
using Microsoft.CognitiveServices.Language.TextAnalytics; | ||
using Microsoft.CognitiveServices.Language.TextAnalytics.Models; | ||
using Microsoft.Rest.ClientRuntime.Azure.TestFramework; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Language.TextAnalytics.Tests | ||
{ | ||
public class DetectLanguageTests : BaseTests | ||
{ | ||
[Fact] | ||
public void DetectLanguage() | ||
{ | ||
using (MockContext context = MockContext.Start(this.GetType().FullName)) | ||
{ | ||
HttpMockServer.Initialize(this.GetType().FullName, "DetectLanguage"); | ||
ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance()); | ||
LanguageBatchResultV2 result = client.DetectLanguage( | ||
new BatchInputV2( | ||
new List<InputV2>() | ||
{ | ||
new InputV2("id","I love my team mates") | ||
})); | ||
|
||
Assert.Equal("English", result.Documents[0].DetectedLanguages[0].Name); | ||
Assert.Equal("en", result.Documents[0].DetectedLanguages[0].Iso6391Name); | ||
Assert.True(result.Documents[0].DetectedLanguages[0].Score > 0.7); | ||
context.Stop(); | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...lane/Language/Microsoft.CognitiveServices.Language.Tests/TextAnalytics/KeyPhrasesTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Language.Tests; | ||
using Microsoft.Azure.Test.HttpRecorder; | ||
using Microsoft.CognitiveServices.Language.TextAnalytics; | ||
using Microsoft.CognitiveServices.Language.TextAnalytics.Models; | ||
using Microsoft.Rest.ClientRuntime.Azure.TestFramework; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Language.TextAnalytics.Tests | ||
{ | ||
public class KeyPhrasesTests : BaseTests | ||
{ | ||
[Fact] | ||
public void KeyPhrases() | ||
{ | ||
using (MockContext context = MockContext.Start(this.GetType().FullName)) | ||
{ | ||
HttpMockServer.Initialize(this.GetType().FullName, "KeyPhrases"); | ||
ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance()); | ||
KeyPhraseBatchResultV2 result = client.KeyPhrases( | ||
new MultiLanguageBatchInputV2( | ||
new List<MultiLanguageInputV2>() | ||
{ | ||
new MultiLanguageInputV2() | ||
{ | ||
Id ="id", | ||
Text ="I love my team mates", | ||
Language ="en" | ||
} | ||
})); | ||
|
||
Assert.Equal("team mates", result.Documents[0].KeyPhrases[0]); | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...plane/Language/Microsoft.CognitiveServices.Language.Tests/TextAnalytics/SentimentTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Language.Tests; | ||
using Microsoft.Azure.Test.HttpRecorder; | ||
using Microsoft.CognitiveServices.Language.TextAnalytics; | ||
using Microsoft.CognitiveServices.Language.TextAnalytics.Models; | ||
using Microsoft.Rest.ClientRuntime.Azure.TestFramework; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
namespace Language.TextAnalytics.Tests | ||
{ | ||
public class SentimentTests : BaseTests | ||
{ | ||
[Fact] | ||
public void Sentiment() | ||
{ | ||
using (MockContext context = MockContext.Start(this.GetType().FullName)) | ||
{ | ||
HttpMockServer.Initialize(this.GetType().FullName, "Sentiment"); | ||
ITextAnalyticsAPI client = GetClient(HttpMockServer.CreateInstance()); | ||
SentimentBatchResultV2 result = client.Sentiment( | ||
new MultiLanguageBatchInputV2( | ||
new List<MultiLanguageInputV2>() | ||
{ | ||
new MultiLanguageInputV2() | ||
{ | ||
Id ="id", | ||
Text ="I love my team mates", | ||
Language ="en" | ||
} | ||
})); | ||
|
||
Assert.True(result.Documents[0].Score > 0); | ||
} | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/SDKs/CognitiveServices/data-plane/Language/Microsoft.CognitiveServices.Language.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26430.16 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CognitiveServices.Language", "Microsoft.CognitiveServices.Language\Microsoft.CognitiveServices.Language.csproj", "{6807B854-8528-4FEE-A25D-C43C3AA2D601}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CognitiveServices.Language.Tests", "Microsoft.CognitiveServices.Language.Tests\Microsoft.CognitiveServices.Language.Tests.csproj", "{5987D97A-E532-450C-BF22-A1F595C927F1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6807B854-8528-4FEE-A25D-C43C3AA2D601}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5987D97A-E532-450C-BF22-A1F595C927F1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DavidLiCIG we have certain directory structure that is being used throughout the repo.
SDKs\CognitiveServices\management
SDKs\CognitiveServices\dataPlane
we rely on particular names to build and run tests during CI build.
Please change the directory structure accordingly.