added function treeProbability in the Haskell binding

This commit is contained in:
Krasimir Angelov
2017-09-01 08:46:52 +02:00
parent 1182a9b63d
commit 5a37660811
5 changed files with 42 additions and 2 deletions

View File

@@ -39,6 +39,8 @@ module PGF2 (-- * PGF
mkFloat,unFloat,
mkMeta,unMeta,
mkCId,
treeProbability,
-- ** Types
Type, Hypo, BindType(..), startCat,
readType, showType,
@@ -314,6 +316,13 @@ compute (PGF p _) (Expr c_expr touch1) =
gu_pool_free exprPl
throwIO (PGFError msg)
treeProbability :: PGF -> Expr -> Float
treeProbability (PGF p _) (Expr c_expr touch1) =
unsafePerformIO $ do
res <- pgf_compute_tree_probability p c_expr
touch1
return (realToFrac res)
-----------------------------------------------------------------------------
-- Graphviz