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 |
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
Batch
data BatchID
Batch identifier (you get it after submitting documents)
data BatchState
States of batch processing
FINISHED | Batch is ready for retrieving |
IN_PROGRESS | Batch is being processed |
Eq BatchState | |
Read BatchState | |
Show BatchState | |
ToJSON BatchState | |
FromJSON BatchState |
Status returned by API
data BatchStatus
Status of batch
Eq BatchStatus | |
Show BatchStatus | |
Generic BatchStatus | |
ToJSON BatchStatus | |
FromJSON BatchStatus | |
type Rep BatchStatus |
:: BatchStatus | Status as returned by API |
-> BatchID |
Get batch identifier BatchID
from status returned by API
:: BatchStatus | Request call result |
-> BatchState |
Get batch status from request call result
Content
Annotated document
data AnnotatedDocument
Eq AnnotatedDocument | |
Show AnnotatedDocument | |
Generic AnnotatedDocument | |
ToJSON AnnotatedDocument | |
FromJSON AnnotatedDocument | |
type Rep AnnotatedDocument |
Document state
data DocumentState
States of document processing
Entity categories
data Category
Entity category
Entity
Search results
data SearchResult
Eq SearchResult | |
Show SearchResult | |
Generic SearchResult | |
ToJSON SearchResult | |
FromJSON SearchResult | |
type Rep SearchResult |