nlp-scores-scripts (empty) → 0.1.0.0
raw patch · 5 files changed
+98/−0 lines, 5 filesdep +basedep +containersdep +nlp-scoressetup-changed
Dependencies added: base, containers, nlp-scores, split, text
Files
- LICENSE +30/−0
- Setup.hs +2/−0
- ap.hs +22/−0
- mean.hs +17/−0
- nlp-scores-scripts.cabal +27/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2013, Grzegorz Chrupała++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Grzegorz Chrupała nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ ap.hs view
@@ -0,0 +1,22 @@+{-# LANGUAGE OverloadedStrings #-}++import NLP.Scores+import Data.List.Split+import Text.Printf+import qualified Data.Text.Lazy as Text+import qualified Data.Text.Lazy.IO as Text+import qualified Data.Set as Set++main = Text.interact $ Text.unlines . map format + . map (uncurry avgPrecision . parse) + . Text.lines++format :: Double -> Text.Text+format = Text.pack . printf "%.4f"++parse :: Text.Text -> (Set.Set Text.Text, [Text.Text])+parse ln = + let [g,t] = Text.words ln+ in (Set.fromList . Text.splitOn "," $ g, Text.splitOn "," $ t)++
+ mean.hs view
@@ -0,0 +1,17 @@+{-# LANGUAGE OverloadedStrings #-}+import NLP.Scores+import Data.List.Split+import Text.Printf+import qualified Data.Text.Lazy as Text+import qualified Data.Text.Lazy.Read as Text+import qualified Data.Text.Lazy.IO as Text++main = Text.interact $ format . mean . map readDouble . Text.lines++format :: Double -> Text.Text+format = Text.pack . printf "%.4f\n"++readDouble x = + case Text.double x of+ Left err -> error err+ Right (d, "") -> d
+ nlp-scores-scripts.cabal view
@@ -0,0 +1,27 @@+-- Initial nlp-scores-scripts.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/++name: nlp-scores-scripts+version: 0.1.0.0+synopsis: NLP scoring command-line programs+-- description: +homepage: https://bitbucket.org/gchrupala/lingo+license: BSD3+license-file: LICENSE+author: Grzegorz Chrupała+maintainer: pitekus@gmail.com+category: Natural Language Processing+build-type: Simple+cabal-version: >=1.8++executable ap+ main-is: ap.hs ++ build-depends: base ==4.6.*, nlp-scores == 0.5.*, text == 0.11.*, split == 0.2.*,+ containers == 0.5.*++executable mean+ main-is: mean.hs ++ build-depends: base ==4.6.*, nlp-scores == 0.5.*, text == 0.11.*, split == 0.2.*+