textocat-api-0.1.0.0: Unofficial Haskell SDK for Textocat API -- http://textocat.com

Copyright(c) Mansur Ziatdinov, 2014--2015
LicenseApache-2.0
Maintainermz+textocat-api@fosslabs.ru
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Data.Textocat

Contents

Description

Almost all types represent JSON which is returned from API. Config contains API key, ErrorMsg is simple String with error description. ServiceStatus represent service status

This module uses an approach to API design described by Michael Snoyman.

If you really need implementation of all these types, use Data.Textocat.Internal module at your own risk

Synopsis

API configuration

data Config

API configuration. Currently only API key is saved

Instances

Eq Config 
Show Config 

mkConfig

Arguments

:: ByteString

API key

-> Config 

Creates a Config value from API key

Error handling

type ErrorMsg = String

Error message

Documents

data Document

Document sent for analysis

Instances

mkDocument

Arguments

:: Text

Text

-> Document 

Create a Document without tag from text

mkTaggedDocument

Arguments

:: Text

Text

-> Text

Tag

-> Document 

Create a tagged Document from text and tag

setTag

Arguments

:: Text

Tag

-> Document

Document

-> Document 

Replace or set a tag

delTag :: Document -> Document

Delete tag

Batch

data BatchID

Batch identifier (you get it after submitting documents)

Instances

data BatchState

States of batch processing

Constructors

FINISHED

Batch is ready for retrieving

IN_PROGRESS

Batch is being processed

Status returned by API

data BatchStatus

Status of batch

getBatchID

Arguments

:: BatchStatus

Status as returned by API

-> BatchID 

Get batch identifier BatchID from status returned by API

getBatchState

Arguments

:: BatchStatus

Request call result

-> BatchState 

Get batch status from request call result

Content

data Batch

Instances

Eq Batch 
Show Batch 
Generic Batch 
ToJSON Batch 
FromJSON Batch 
type Rep Batch 

getBatchIds

Arguments

:: Batch

Batch

-> [BatchID] 

Get batch ids from retrieve call result

getDocuments

Arguments

:: Batch

Batch

-> [AnnotatedDocument] 

Get annotated documents from retrieve call result

Annotated document

getDocumentState

Arguments

:: AnnotatedDocument

Document

-> DocumentState 

Get annotated document state

getDocumentTag

Arguments

:: AnnotatedDocument

Document

-> Maybe Text 

Get annotated document tag

getEntities

Arguments

:: AnnotatedDocument

Document

-> [Entity] 

Get entities from annotated document

Document state

data DocumentState

States of document processing

Entity categories

data Category

Entity category

Entity

data Entity

Instances

Eq Entity 
Show Entity 
Generic Entity 
ToJSON Entity 
FromJSON Entity 
type Rep Entity 

getSpan

Arguments

:: Entity

Entity

-> Text 

Get entity span

getOffsets

Arguments

:: Entity

Entity

-> (Int, Int) 

Get pair of start and end offsets

getCategory

Arguments

:: Entity

Entity

-> Category 

Get entity category

Search results

getSearchQuery

Arguments

:: SearchResult

Search call result

-> Text 

Get search query

getFoundDocuments

Arguments

:: SearchResult

Search call result

-> [AnnotatedDocument] 

Get found documents

Service status