@zcatalyst/zia
Version:
ZOHO CATALYST SDK for JavaScript zia for Node.js and Browser.
136 lines (135 loc) • 6.4 kB
TypeScript
import { Handler } from '@zcatalyst/transport';
import { Component } from '@zcatalyst/utils';
import fs from 'fs';
import { ICatalsytZiaKeywordExtraction, ICatalystZiaAutoML, ICatalystZiaBarcode, ICatalystZiaFace, ICatalystZiaFaceComparison, ICatalystZiaModeration, ICatalystZiaNERPrediction, ICatalystZiaObject, ICatalystZiaOCR, ICatalystZiaSentimentAnalysis, ICatalystZiaTextAnalytics } from './utils/interfaces';
export declare class Zia implements Component {
requester: Handler;
constructor(app?: unknown);
/**
* Get the name of the Zia component.
* @returns The name of the component.
*/
getComponentName(): string;
/**
* Detect objects in an image.
* @param file Read stream of the image file.
* @returns The detected objects in the image.
*/
detectObject(file: fs.ReadStream): Promise<ICatalystZiaObject>;
/**
* Extract text from an image using Optical Character Recognition (OCR).
* @param file Read stream of the image file.
* @param opts Optional parameters for language and model type.
* @returns Extracted text from the image.
*/
extractOpticalCharacters(file: fs.ReadStream, opts?: {
language?: string;
modelType?: string;
}): Promise<ICatalystZiaOCR>;
/**
* Extract Aadhaar card details using OCR.
* @param frontImg Read stream of the Aadhaar front image.
* @param backImg Read stream of the Aadhaar back image.
* @param language Language for text extraction.
* @returns Extracted Aadhaar card details.
*/
extractAadhaarCharacters(frontImg: fs.ReadStream, backImg: fs.ReadStream, language: string): Promise<ICatalystZiaOCR>;
/**
* Scan a barcode from an image.
* @param image Read stream of the barcode image.
* @param opts Optional parameters such as format.
* @returns Scanned barcode details.
*/
scanBarcode(image: fs.ReadStream, opts?: {
format?: string;
}): Promise<ICatalystZiaBarcode>;
/**
* Moderates an image by analyzing its content for potentially inappropriate or unsafe elements.
*
* @param image - A readable stream of the image file to be moderated.
* @param opts - Optional parameters for image moderation.
* @param opts.mode - The moderation mode (e.g., strict, moderate, or relaxed).
* @returns An object containing the moderation analysis results.
*
* @throws {CatalystZiaError} If the provided image is not valid.
*/
moderateImage(image: fs.ReadStream, opts?: {
mode?: string;
}): Promise<ICatalystZiaModeration>;
/**
* Analyzes a face in an image and extracts attributes such as emotions, age, and gender.
*
* @param image - A readable stream of the image file containing the face to be analyzed.
* @param opts - Optional parameters for face analysis.
* @param opts.mode - The mode of face analysis (e.g., basic or advanced).
* @param opts.emotion - Whether to analyze emotions in the face.
* @param opts.age - Whether to estimate the age of the person in the image.
* @param opts.gender - Whether to determine the gender of the person in the image.
* @returns An object containing the analyzed face attributes.
*
* @throws {CatalystZiaError} If the provided image is not valid.
*/
analyseFace(image: fs.ReadStream, opts?: {
mode?: string;
emotion?: boolean;
age?: boolean;
gender?: boolean;
}): Promise<ICatalystZiaFace>;
/**
* Compare two faces to check for a match.
* @param sourceImage Read stream of the source image.
* @param queryImage Read stream of the image to be compared.
* @returns Object containing match status and confidence value.
*/
compareFace(sourceImage: fs.ReadStream, queryImage: fs.ReadStream): Promise<ICatalystZiaFaceComparison>;
/**
* Perform an inference request on a deployed AutoML model.
*
* @param modelId - The ID of the AutoML model to be used for inference.
* @param data - The input data to be passed to the model for prediction.
* @returns The prediction result from the AutoML model.
*
* @throws {CatalystZiaError} If the model ID is invalid or the data is not an object.
*/
automl(modelId: string, data?: {
[x: string]: unknown;
}): Promise<ICatalystZiaAutoML>;
/**
* Get the sentiment analytics for the list of documents.
* @param listOfDocuments Array of strings whose sentiment is to be analysed.
* @param keywords Entity-level sentiment key
* @returns `ICatalystZiaSentimentAnalysis`
* @link https://www.zoho.com/catalyst/sdk/nodeJS-sdk/zia_compinst.html
*/
getSentimentAnalysis(listOfDocuments: Array<string>, keywords?: Array<string>): Promise<ICatalystZiaSentimentAnalysis>;
/**
* Extracts the keywords from the list of documents provided.
* @param listOfDocuments Array of strings, which has to processed for keyword extraction
* @returns `ICatalsytZiaKeywordExtraction`
* @link https://www.zoho.com/catalyst/sdk/nodeJS-sdk/zia_compinst.html
*/
getKeywordExtraction(listOfDocuments: Array<string>): Promise<ICatalsytZiaKeywordExtraction>;
/**
* Performs NER (Named Entity Recognition) on the given list of documents.
* @param listOfDocuments Array of strings to be processed for NER.
* @returns `ICatalystZiaNERPrediction`
* @link https://www.zoho.com/catalyst/sdk/nodeJS-sdk/zia_compinst.html
*/
getNERPrediction(listOfDocuments: Array<string>): Promise<ICatalystZiaNERPrediction>;
/**
* Performs all the three available text analytics on the list of documents provided.
*
* Available text anaytics features:
* * `Sentiment Analysis`
* * `Keyword Extraction`
* * `NER Prediction`
*
* Note: These text analytics features are also available as seperate functions. Please check other functions under `textAnalysis`.
*
* @param listOfDocuments Array of strings to be processed for text anaytics.
* @param keywords Entity-level sentiment key
* @returns `ICatalystZiaTextAnalytics`
* @link https://www.zoho.com/catalyst/sdk/nodeJS-sdk/zia_compinst.html
*/
getTextAnalytics(listOfDocuments: Array<string>, keywords?: Array<string>): Promise<ICatalystZiaTextAnalytics>;
}