| Copyright | (c) Mansur Ziatdinov, 2014--2015 |
|---|---|
| License | Apache-2.0 |
| Maintainer | mz+textocat-api@fosslabs.ru |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
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
- data Config
- mkConfig :: ByteString -> Config
- type ErrorMsg = String
- data Document
- mkDocument :: Text -> Document
- mkTaggedDocument :: Text -> Text -> Document
- setTag :: Text -> Document -> Document
- delTag :: Document -> Document
- data BatchID
- data BatchState
- data BatchStatus
- getBatchID :: BatchStatus -> BatchID
- getBatchState :: BatchStatus -> BatchState
- data Batch
- getBatchIds :: Batch -> [BatchID]
- getDocuments :: Batch -> [AnnotatedDocument]
- data AnnotatedDocument
- getDocumentState :: AnnotatedDocument -> DocumentState
- getDocumentTag :: AnnotatedDocument -> Maybe Text
- getEntities :: AnnotatedDocument -> [Entity]
- data DocumentState
- data Category
- data Entity
- getSpan :: Entity -> Text
- getOffsets :: Entity -> (Int, Int)
- getCategory :: Entity -> Category
- data SearchResult
- getSearchQuery :: SearchResult -> Text
- getFoundDocuments :: SearchResult -> [AnnotatedDocument]
- data ServiceStatus
API configuration
Error handling
type ErrorMsg = String
Error message
Documents
data Document
Document sent for analysis
Arguments
| :: Text | Text |
| -> Text | Tag |
| -> Document |
Create a tagged Document from text and tag
Batch
data BatchID
Batch identifier (you get it after submitting documents)
data BatchState
States of batch processing
Constructors
| FINISHED | Batch is ready for retrieving |
| IN_PROGRESS | Batch is being processed |
Instances
| Eq BatchState | |
| Read BatchState | |
| Show BatchState | |
| ToJSON BatchState | |
| FromJSON BatchState |
Status returned by API
data BatchStatus
Status of batch
Instances
| Eq BatchStatus | |
| Show BatchStatus | |
| Generic BatchStatus | |
| ToJSON BatchStatus | |
| FromJSON BatchStatus | |
| type Rep BatchStatus |
Arguments
| :: BatchStatus | Status as returned by API |
| -> BatchID |
Get batch identifier BatchID from status returned by API
Arguments
| :: BatchStatus | Request call result |
| -> BatchState |
Get batch status from request call result
Content
Arguments
| :: Batch | Batch |
| -> [AnnotatedDocument] |
Get annotated documents from retrieve call result
Annotated document
data AnnotatedDocument
Instances
| Eq AnnotatedDocument | |
| Show AnnotatedDocument | |
| Generic AnnotatedDocument | |
| ToJSON AnnotatedDocument | |
| FromJSON AnnotatedDocument | |
| type Rep AnnotatedDocument |
Document state
data DocumentState
States of document processing
Constructors
| SUCCESS | |
| INPUT_ERROR | |
| SERVICE_ERROR |
Instances
Entity categories
data Category
Entity category
Entity
data Entity
Search results
data SearchResult
Instances
| Eq SearchResult | |
| Show SearchResult | |
| Generic SearchResult | |
| ToJSON SearchResult | |
| FromJSON SearchResult | |
| type Rep SearchResult |
Arguments
| :: SearchResult | Search call result |
| -> [AnnotatedDocument] |
Get found documents
Service status
data ServiceStatus
Constructors
| ServiceOK | |
| ServiceUnavailable |
Instances
| Eq ServiceStatus | |
| Show ServiceStatus |