SDKs overview

Aylien Text Analysis provides a suite of official SDKs designed to facilitate interaction with its Text Analysis API endpoints. These SDKs abstract the underlying HTTP requests, authentication, and response parsing, allowing developers to focus on integrating text analysis features into their applications. The available SDKs support popular programming languages, streamlining development for tasks such as sentiment analysis, entity extraction, and content summarization. By using an SDK, developers can reduce boilerplate code and potential errors associated with direct API calls, leading to quicker integration cycles.

The SDKs are generally maintained to reflect the latest API versions and features, ensuring compatibility and access to new capabilities as they are released. Each SDK typically includes client classes, data models for API responses, and helper functions for common operations. The design of these libraries aims to align with idiomatic practices of their respective programming languages, offering a more natural development experience. For instance, the Python SDK might leverage Pythonic data structures, while the Java SDK would use Java-specific object-oriented patterns.

Official SDKs by language

Aylien Text Analysis offers official SDKs for several programming languages, providing a structured approach to API integration. These libraries are developed and maintained by Aylien to ensure compatibility with the Text Analysis API and to offer a consistent developer experience across different environments. Each SDK is typically available through the standard package manager for its respective language, simplifying installation and dependency management.

Official Aylien Text Analysis SDKs
Language Package Name Install Command (Example) Maturity
Python aylien_textapi pip install aylien_textapi Stable
Node.js aylien-textapi npm install aylien-textapi Stable
PHP aylien/textapi composer require aylien/textapi Stable
Ruby aylien_text_api gem install aylien_text_api Stable
Java Maven / Gradle dependency (See Aylien Java SDK documentation) Stable

For detailed information on each SDK, including specific class methods and configuration options, consult the official Aylien client libraries documentation. These resources often provide comprehensive API references, example usage scenarios, and troubleshooting tips specific to each language.

Installation

Installing an Aylien Text Analysis SDK typically involves using the package manager native to your chosen programming language. Before installation, ensure you have the correct language runtime and package manager set up in your development environment. For example, Python requires pip, Node.js requires npm or yarn, and PHP uses Composer. Java projects commonly manage dependencies using Maven or Gradle.

Python Installation

To install the Python SDK, open your terminal or command prompt and execute the following command:

pip install aylien_textapi

This command fetches the aylien_textapi package from the Python Package Index (PyPI) and installs it along with its dependencies. It's often recommended to install packages within a virtual environment to manage project-specific dependencies without conflicts with other projects or the global Python installation. You can create a virtual environment using python -m venv myenv and activate it before installing.

Node.js Installation

For Node.js projects, use npm (Node Package Manager) to install the SDK:

npm install aylien-textapi

Alternatively, if you prefer Yarn, you can use:

yarn add aylien-textapi

This command adds aylien-textapi to your project's node_modules directory and updates your package.json file, recording the dependency. The Node.js SDK facilitates asynchronous operations, common in web applications, allowing for non-blocking API calls.

PHP Installation

PHP projects use Composer for dependency management. If you don't have Composer installed, follow the Composer installation guide. Once Composer is set up, install the Aylien Text Analysis SDK by running:

composer require aylien/textapi

This command adds the aylien/textapi package to your composer.json file and installs it into your project's vendor/ directory. After installation, remember to include Composer's autoloader in your PHP scripts: require 'vendor/autoload.php';

Ruby Installation

Ruby developers can install the SDK using RubyGems:

gem install aylien_text_api

This command adds the aylien_text_api gem to your Ruby environment. In your Ruby application, you would then require the gem to use its functionality: require 'aylien_text_api'. RubyGems is the standard package manager for Ruby, similar to PyPI for Python.

Java Installation

For Java projects, the SDK is typically added as a dependency in your build tool's configuration file. For Maven, add the following to your pom.xml:

<dependency>
    <groupId>com.aylien.textapi</groupId>
    <artifactId>textapi</artifactId>
    <version>0.6.0</version> <!-- Check for latest version -->
</dependency>

For Gradle, add to your build.gradle:

implementation 'com.aylien.textapi:textapi:0.6.0' // Check for latest version

Always refer to the Aylien Java SDK documentation for the most current version and specific dependency declarations. After updating your build file, your build tool (Maven or Gradle) will download and include the necessary JAR files.

Quickstart example

This section provides a quickstart example using the Python SDK for sentiment analysis. Before running the code, ensure you have installed the Python SDK as described above and have your Aylien API Application ID and Key ready. These credentials are required for authenticating your requests to the Text Analysis API.

Python Sentiment Analysis Example

The following Python code snippet demonstrates how to initialize the client and perform a sentiment analysis on a sample text string. This example illustrates the basic steps involved: importing the library, setting credentials, and calling an analysis method.

from aylien_textapi.textapi import Client

# Replace with your actual Application ID and Key
APP_ID = "YOUR_APP_ID"
APP_KEY = "YOUR_APP_KEY"

# Initialize the Aylien Text API client
client = Client(APP_ID, APP_KEY)

# Text for sentiment analysis
text_to_analyze = "Aylien Text Analysis provides excellent tools for understanding text data."

try:
    # Perform sentiment analysis
    sentiment = client.Sentiment({
        'text': text_to_analyze
    })

    # Print the results
    print(f"Text: {text_to_analyze}")
    print(f"Sentiment Polarity: {sentiment['polarity']}")
    print(f"Sentiment Polarity Confidence: {sentiment['polarity_confidence']:.2f}")
    print(f"Sentiment Subjectivity: {sentiment['subjectivity']}")
    print(f"Sentiment Subjectivity Confidence: {sentiment['subjectivity_confidence']:.2f}")

except Exception as e:
    print(f"An error occurred: {e}")

This example initializes the client with your API credentials and then calls the Sentiment method, passing the text to be analyzed as a dictionary. The response object contains various sentiment metrics, including polarity (positive, negative, neutral), polarity confidence, subjectivity, and subjectivity confidence. The output helps quantify the emotional tone and factual nature of the input text.

For additional examples covering other features like entity extraction, summarization, or topic detection, refer to the Aylien Python SDK documentation. The documentation typically includes code snippets for various API calls and explains the structure of the returned data.

Community libraries

While Aylien Text Analysis provides a set of official SDKs, the broader developer community may also contribute open-source libraries or wrappers. These community-driven projects can offer alternative interfaces, additional utilities, or integrations with specific frameworks not covered by the official SDKs. Community libraries vary in maturity, maintenance, and feature completeness.

Developers often create community libraries for several reasons: to provide a preferred programming style, to integrate with niche frameworks, or to add convenience functions specific to certain use cases. Before adopting a community library, it is advisable to evaluate its active maintenance, community support, and alignment with the official API documentation. Checking the project's repository for recent commits, issue activity, and clear licensing information is a recommended practice.

Resources such as GitHub, GitLab, or language-specific package repositories (e.g., PyPI, npmjs.com) are common places to discover community-contributed libraries. Searching for "Aylien Text Analysis" or "Aylien API" in conjunction with your preferred language may reveal relevant projects. For example, a search on GitHub might yield results for Python wrappers or Node.js modules not officially supported by Aylien. An example of a platform where developers often share such libraries is the Mozilla Developer Network's API documentation, which frequently links to community resources for various web APIs.

The official Aylien documentation primarily focuses on their own supported SDKs and API reference. Therefore, information regarding community libraries is generally found outside of the official Aylien Text Analysis documentation, on public code hosting platforms and developer forums. Always cross-reference any community library's claims or functionality with the official Aylien Text Analysis API reference to ensure accuracy and compatibility.