Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 1.17 KB

README.md

File metadata and controls

39 lines (26 loc) · 1.17 KB

fasttext bindings for Haskell

This library lets you loadModel and predictProbs from Haskell.

Example usage:

{-# LANGUAGE OverloadedStrings            #-}

module Main where

import Data.FastText

main :: IO ()
main = do
  model <- loadModel "data/lid.176.ftz"
  let input = "Une liste d'infinitifs prolonge l'accident."
  res <- predictProbs model 2 0 input
  print res

Output:

[Prediction {pScore = 0.9801573, pLabel = "__label__fr"},Prediction {pScore = 1.0023363e-2, pLabel = "__label__zh"}]

Related libraries

Vendored stuff

The files in cbits except extern.{cc,h} are from https://github.com/facebookresearch/fastText/commit/3697152e0fd772d9185697fdbd4a1d340ca5571d

Test model in data/lid.176.ftz is CC-SA 3.0 from https://fasttext.cc/docs/en/language-identification.html