Skip to content

unhammer/fastText-haskell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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