meaningcloudgo

package module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 6 Imported by: 0

README

MeaningCloud SDK for Go

Build Status GoDoc Go Report Card GitHub release

This is MeaningCloud's unofficial Go client, designed to enable you to use MeaningCloud's services easily from your own applications.

MeaningCloud

MeaningCloud is a cloud-based text analytics service that through APIs allows you extract meaning from all kind of unstructured content: social conversation, articles, documents.

SDK versions

v1.1
Deep Categorization deepcategorization-1.0
Topics Extraction topics-2.0
Text Classification class-2.0
Sentiment Analysis sentiment-2.1
Language Identification lang-4.0
Parser parser-2.0
Corporate Reputation reputation-2.0
Text Clustering clustering-1.1
Summarization summarization-1.0
Document Structure documentstructure-1.0

Getting started

Installation

You can load meaningcloud-go into your project by using:

go get github.com/henomis/meaningcloud-go
Configuration

The only thing you need to start using MeaningCloud's APIs is the developer license key. Copy it and paste it in the corresponding place in the code, select the API you want to use and the parameters you want to use, and that's it.

Usage

Please refer to the examples folder to see how to use the SDK.

Here below a simple usage example:

package main

import (
	"encoding/json"
	"fmt"
	"log"

	meaningcloudgo "github.com/henomis/meaningcloud-go"
	"github.com/henomis/meaningcloud-go/pkg/request"
)

const Key = "YOUR_API_KEY"

func main() {

	meaningCloudClient := meaningcloudgo.New(
		meaningcloudgo.MeaningCloudEndpoint,
		Key,
		10 * time.Second,
	)

	// Text analysis
	request := &request.Sentiment{}
	request.Key = Key
	request.InputLanguage = "en"
	request.Text = "Main dishes were quite good, but desserts were too sweet for me."
	response, err := meaningCloudClient.SentimentAnalysis(request)
	if err != nil {
		log.Fatalf("error while performing analysis: %v", err)
	}

	if !response.Status.IsSuccess() {
		log.Fatalf("error: %s", response.Status.Error())
	}

	bytes, _ := json.MarshalIndent(response, "", "  ")
	fmt.Println(string(bytes))

}

Documentation

Index

Constants

View Source
const (
	MeaningCloudEndpoint = "https://api.meaningcloud.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MeaningCloudClient

type MeaningCloudClient struct {
	// contains filtered or unexported fields
}

func New

func New(endpoint string, key string, timeout time.Duration) *MeaningCloudClient

func (*MeaningCloudClient) CorporateReputation

func (m *MeaningCloudClient) CorporateReputation(
	corporateReputationRequest *request.CorporateReputation,
) (*response.CorporateReputation, error)

func (*MeaningCloudClient) DeepCategorization

func (m *MeaningCloudClient) DeepCategorization(
	deepCategorizationRequest *request.DeepCategorization,
) (*response.DeepCategorization, error)

func (*MeaningCloudClient) DocumentStructure

func (m *MeaningCloudClient) DocumentStructure(
	documentStructureRequest *request.DocumentStructure,
) (*response.DocumentStructure, error)

func (*MeaningCloudClient) LanguageIdentification

func (m *MeaningCloudClient) LanguageIdentification(
	languageIdentificationRequest *request.LanguageIdentification,
) (*response.LanguageIdentification, error)

func (*MeaningCloudClient) Parser

func (m *MeaningCloudClient) Parser(
	parserRequest *request.Parser,
) (*response.Parser, error)

func (*MeaningCloudClient) ParserImage added in v1.1.0

func (m *MeaningCloudClient) ParserImage(
	parserRequest *request.Parser,
) (io.ReadCloser, error)

func (*MeaningCloudClient) SentimentAnalysis

func (m *MeaningCloudClient) SentimentAnalysis(
	sentimentRequest *request.Sentiment,
) (*response.Sentiment, error)

func (*MeaningCloudClient) Summarization

func (m *MeaningCloudClient) Summarization(
	summarizationRequest *request.Summarization,
) (*response.Summarization, error)

func (*MeaningCloudClient) TextClassification

func (m *MeaningCloudClient) TextClassification(
	textClassificationRequest *request.TextClassification,
) (*response.TextClassification, error)

func (*MeaningCloudClient) TextClustering

func (m *MeaningCloudClient) TextClustering(
	textClusteringRequest *request.TextClustering,
) (*response.TextClustering, error)

func (*MeaningCloudClient) TopicsExtraction

func (m *MeaningCloudClient) TopicsExtraction(
	topicsExtractionRequest *request.TopicsExtraction,
) (*response.TopicsExtraction, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL