Popularity
2.1
Declining
Activity
0.0
Stable
4
1
0

Monthly Downloads: 10
Programming language: Haskell
License: Apache License 2.0

textocat-api alternatives and similar packages

Based on the "API" category.
Alternatively, view textocat-api alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of textocat-api or a related project?

Add another 'API' Package

README

Textocat API -- Haskell

Unofficial Haskell binding for Textocat API http://textocat.com

Installation

You can download this package from [http://hackage.haskell.org/package/textocat-api](hackage)

cabal install textocat-api

Documentation

API itself is documented at http://docs.textocat.com

This binding is documented at http://hackage.haskell.org/package/textocat-api

Usage

{-# LANGUAGE OverloadedStrings #-}

import Data.Textocat
import Network.Textocat

import Control.Monad (when)
import System.Exit (exitFailure)

cfg = mkConfig "API-KEY"

documents = [ mkDocument "Привет, мир!"
            , setTag "haskell" $ mkDocument "Язык Haskell признан лучшим языком для выдающихся хакеров на ICFPC 2014"
            ]

main = do
  status <- serviceStatus cfg
  when (status /= ServiceOK) exitFailure

  putStrLn "Queue documents"
  Right bs <- entityQueue cfg documents

  putStrLn "Request status"
  entityRequest cfg $ getBatchID bs

  putStrLn "Wait until finished"
  waitForFinished cfg $ getBatchID bs

  putStrLn "Retrieve documents"
  -- we retrieve both bs1 and bs2 to test whether API works correctly
  -- with several documents
  Right res <- entityRetrieve cfg $ [getBatchID bs]
  let entities = concatMap getEntities $ getDocuments res

  mapM_ print entities

  putStrLn "Search documents"
  Right found <- entitySearch cfg "Haskell"

  mapM_ print $ getFoundDocuments found

License

Copyright 2014-2015 Mansur Ziatdinov

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


*Note that all licence references and agreements mentioned in the textocat-api README section above are relevant to that project's source code only.