Skip to content

Latest commit

 

History

History

android

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Parts Of Speech Android SDK

Parts Of Speech is a simple tool for extracting nouns, verbs, adjectives, adverbs, etc. from text. It returns the extracted words based on the part of speech specified.

License: MIT Platform Java


Installation

Gradle (via JitPack)

Add JitPack repository to your root build.gradle:

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency:

dependencies {
    implementation 'com.github.apiverve:partsofspeech-api:1.1.14'
}

Quick Start

Basic Usage

import com.apiverve.partsofspeech.PartsOfSpeechAPIClient;
import com.apiverve.partsofspeech.APIResponse;
import com.apiverve.partsofspeech.APIException;

// Initialize the client
PartsOfSpeechAPIClient client = new PartsOfSpeechAPIClient("YOUR_API_KEY");

try {
    // Prepare request parameters
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("text", "My friend from college hails from a small countryside village located at the heart of the state. During the last summer vacation, I had an opportunity to visit my friend in his village. I packed up my belongings and boarded the bus bound for the village");
    parameters.put("partofspeech", "verbs");

    // Execute the request
    APIResponse response = client.execute(parameters);

    if (response.isSuccess()) {
        // Handle successful response
        JSONObject data = response.getData();
        System.out.println("Success: " + data.toString());
    } else {
        // Handle API error
        System.err.println("API Error: " + response.getError());
    }
} catch (APIException e) {
    // Handle exception
    e.printStackTrace();
}

Without Parameters

// Some APIs don't require parameters
APIResponse response = client.execute();

Error Handling

The SDK provides detailed error handling:

try {
    APIResponse response = client.execute(parameters);

    if (response.isSuccess()) {
        // Process success
    } else {
        // Handle API-level errors
        System.err.println("Error: " + response.getError());
    }
} catch (APIException e) {
    if (e.isAuthenticationError()) {
        System.err.println("Invalid API key");
    } else if (e.isRateLimitError()) {
        System.err.println("Rate limit exceeded");
    } else if (e.isServerError()) {
        System.err.println("Server error");
    } else {
        System.err.println("Error: " + e.getMessage());
    }
}

Response Object

The APIResponse object provides several methods:

APIResponse response = client.execute(params);

// Check status
boolean success = response.isSuccess();
boolean error = response.isError();

// Get data
String status = response.getStatus();
String errorMsg = response.getError();
JSONObject data = response.getData();
int code = response.getCode();

// Get raw response
JSONObject raw = response.getRawResponse();

API Documentation

For detailed API documentation, visit: https://docs.apiverve.com/ref/partsofspeech


Get Your API Key

Get your API key from https://apiverve.com


Requirements

  • Java 8 or higher
  • Android API level 21 (Lollipop) or higher

Support


License

This SDK is released under the MIT License. See LICENSE for details.


About APIVerve

APIVerve provides production-ready REST APIs for developers. Fast, reliable, and easy to integrate.