PTI.Microservices.Library.AzureTextAnalytics 7.0.0.1

dotnet add package PTI.Microservices.Library.AzureTextAnalytics --version 7.0.0.1                
NuGet\Install-Package PTI.Microservices.Library.AzureTextAnalytics -Version 7.0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PTI.Microservices.Library.AzureTextAnalytics" Version="7.0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PTI.Microservices.Library.AzureTextAnalytics --version 7.0.0.1                
#r "nuget: PTI.Microservices.Library.AzureTextAnalytics, 7.0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PTI.Microservices.Library.AzureTextAnalytics as a Cake Addin
#addin nuget:?package=PTI.Microservices.Library.AzureTextAnalytics&version=7.0.0.1

// Install PTI.Microservices.Library.AzureTextAnalytics as a Cake Tool
#tool nuget:?package=PTI.Microservices.Library.AzureTextAnalytics&version=7.0.0.1                

PTI.Microservices.Library.AzureTextAnalytics

This is part of PTI.Microservices.Library set of packages

The purpose of this package is to facilitate the calls to Azure Text Analytics APIs, while maintaining a consistent usage pattern among the different services in the group

Examples:

Get Key Phrases

AzureTextAnalyticsService azureTextAnalyticsService =
    new AzureTextAnalyticsService(null, this.AzureTextAnalyticsConfiguration,
    new Microservices.Library.Interceptors.CustomHttpClient(
        new Microservices.Library.Interceptors.CustomHttpClientHandler(this.Logger_CustomHttpClientHandler)));
GetKeyPhrasesRequest model = new GetKeyPhrasesRequest()
{
    documents = new GetKeyPhrasesRequestDocument[] {
        new GetKeyPhrasesRequestDocument(){ id=Guid.NewGuid().ToString(), language="en", text="This is a sample text" },
        new GetKeyPhrasesRequestDocument(){ id=Guid.NewGuid().ToString(), language="es", text="Lo mejor del libro El Poder del Amor, es que es un libro creado en Costa Rica" },
    }
};
var result = await azureTextAnalyticsService.GetKeyPhrasesAsync(model);

Get Sentiment

AzureTextAnalyticsService azureTextAnalyticsService =
    new AzureTextAnalyticsService(null, this.AzureTextAnalyticsConfiguration,
    new Microservices.Library.Interceptors.CustomHttpClient(
        new Microservices.Library.Interceptors.CustomHttpClientHandler(null)));
GetSentimentRequest model = new GetSentimentRequest()
{
    documents = new GetSentimentRequestDocument[]
    {
        new GetSentimentRequestDocument()
        {
            id=Guid.NewGuid().ToString(), language="en", 
            text="This is a sample text create in order to analyze the sentiment of this paragraph." +
            "This is a second paragraph in order to test multiple sentences opinion mining"
        },
        new GetSentimentRequestDocument()
        {
            id=Guid.NewGuid().ToString(), language="es",text="La vida es bella, tan bella que quisiera vivir para siempre"
        },
        new GetSentimentRequestDocument()
        {
            id=Guid.NewGuid().ToString(), language="en",text="This is a multi-sentence text in order to check how the API splits it." +
            " There are many items that would be too long"
        }
    }
};
var result = await azureTextAnalyticsService.GetSentimentAsync(model);

Detect Language

AzureTextAnalyticsService azureTextAnalyticsService =
                new AzureTextAnalyticsService(null, this.AzureTextAnalyticsConfiguration,
                new Microservices.Library.Interceptors.CustomHttpClient(
                    new Microservices.Library.Interceptors.CustomHttpClientHandler(null)));
var result = 
    await azureTextAnalyticsService.DetectLanguageAsync(
    new Microservices.Library.AzureTextAnalytics.Models.DetectLanguage.DetectLanguageRequest()
    {
        documents = new Microservices.Library.AzureTextAnalytics.Models.DetectLanguage.DetectLanguageRequestDocument[]
        {
            new Microservices.Library.AzureTextAnalytics.Models.DetectLanguage.DetectLanguageRequestDocument()
            {
                countryHint="CR",
                id="1",
                text="Esto es una prueba"
            }
        }
    });
Assert.IsNotNull(result);
var firstItem = result.documents[0];
Assert.IsTrue(firstItem.detectedLanguage.iso6391Name == "es");
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PTI.Microservices.Library.AzureTextAnalytics:

Package Downloads
PTI.Microservices.Library.TwitterDataAnalysis

Cloud Services library designed to be consumed in Microservices

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.0.1 787 11/13/2022
7.0.0 398 11/13/2022
2.0.0.2-preview 1,135 8/26/2021
2.0.0.1-preview 818 7/31/2021
2.0.0-preview 302 7/9/2021