![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@azure/ai-text-analytics
Advanced tools
An isomorphic client library for the Azure Text Analytics service.
Azure TextAnalytics is a cloud-based service that provides advanced natural language processing over raw text, and includes six main functions:
Use the client library to:
Source code | Package (NPM) | API reference documentation | Product documentation | Samples
If you use the Azure CLI, replace <your-resource-group-name>
and <your-resource-name>
with your own unique names:
az cognitiveservices account create --kind TextAnalytics --resource-group <your-resource-group-name> --name <your-resource-name>
@azure/ai-text-analytics
packagenpm install @azure/ai-text-analytics
TextAnalyticsClient
TextAnalytics uses both AAD and subscription keys for authentication.
Use the Azure CLI snippet below to get the subscription key from the Text Analytics resource.
az cognitiveservices account keys list --resource-group <your-resource-group-name> --name <your-resource-name>
Alternatively, you can get the endpoint and subscription key from the resource information in the Azure Portal.
Once you have a subscription key, you can use it as follows:
const { TextAnalyticsClient, CognitiveServicesCredential } = require("@azure/ai-text-analytics");
const client = new TextAnalyticsClient(
"<endpoint>",
new CognitiveServicesCredential("<subscription key>")
);
Client subscription key authentication is used in most of the examples, but you can also authenticate with Azure Active Directory using the Azure Identity library. To use the DefaultAzureCredential provider shown below,
or other credential providers provided with the Azure SDK, please install the @azure/identity
package:
npm install @azure/identity
You will also need to register a new AAD application and grant access to Text Analytics by assigning the "Cognitive Services User"
role to your service principal.
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID
, AZURE_TENANT_ID
, AZURE_CLIENT_SECRET
.
const { TextAnalyticsClient } = require("@azure/ai-text-analytics");
const { DefaultAzureCredential } = require("@azure/identity");
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
TextAnalyticsClient
is the primary interface for developers using the Text Analytics client library. It provides asynchronous methods to access a specific use of Text Analytics, such as language detection or key phrase extraction.
A text input, sometimes called a document, is a single unit of input to be analyzed by the predictive models in the Text Analytics service. Operations on TextAnalyticsClient
take a collection of inputs to be analyzed as a batch.
An operation result, such as AnalyzeSentimentResult
, is the result of a Text Analytics operation, containing a prediction or predictions about a single text input. An operation's result type also may optionally include information about the input document and how it was processed.
An operation result collection, such as AnalyzeSentimentResultCollection
, is a collection of operation results, where each corresponds to one of the text inputs provided in the input batch. A text input and its result will have the same index in the input and result collections. An operation result collection may optionally include information about the input batch and how it was processed.
For each supported operation, TextAnalyticsClient
provides method overloads to take a batch of text inputs as strings or a batch of DetectLanguageInput
or TextDocumentInput
objects, depending on the operation. Overloads that take an object batches allows callers to give each document a unique ID, or indicate extra metadata such as the langauge the document is written in or the country of origin.
const [result] = await client.detectLanguages(["hello world"]);
console.log(`Primary language detected as ${result.primaryLanguage.name}`);
You can set the following environment variable to get the debug logs when using this library.
export DEBUG=azure*
Please take a look at the samples directory for detailed examples on how to use this library.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code.
FAQs
An isomorphic client library for the Azure Text Analytics service.
The npm package @azure/ai-text-analytics receives a total of 1,734 weekly downloads. As such, @azure/ai-text-analytics popularity was classified as popular.
We found that @azure/ai-text-analytics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.