packages feed

fullstop 0.1.1 → 0.1.2

raw patch · 4 files changed

+70/−55 lines, 4 filesdep ~QuickCheckdep ~test-framework

Dependency ranges changed: QuickCheck, test-framework

Files

NLP/FullStop.hs view
@@ -20,56 +20,11 @@ -- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. -module NLP.FullStop ( segment, testSuite ) where+module NLP.FullStop ( segment ) where  import Data.Char import Data.List import Data.List.Split--import Test.HUnit-import Test.Framework-import Test.Framework.Providers.HUnit-import Test.Framework.Providers.QuickCheck2---- ------------------------------------------------------------------ --------------------------------------------------------------testSuite :: Test.Framework.Test-testSuite =- testGroup "NLP.FullStop"-  [ testGroup "basic sanity checking"-      [ testProperty "concat (segment s) == id s, modulo whitespace" prop_segment_concat-      ]-  , testGroup "segmentation"-     [ testCaseSegments "simple"  ["Foo.", "Bar."]   "Foo. Bar."-     , testCaseSegments "condense"  ["What?!", "Yeah"]   "What?! Yeah"-     , testCaseSegments "URLs"    ["Check out http://www.example.com.", "OK?"]-                                   "Check out http://www.example.com. OK?"-     , testCaseNoSplit "titles"    "Mr. Doe, Mrs. Durand, St. Orolo and Dr. Singh"-     , testCaseNoSplit "abbreviations"   "e.g., or eg., i.e. or ie. should not be split"-     , testCaseSegments "abbreviations 2"   ["No lie.", "Honestly"] "No lie. Honestly"-     , testCaseNoSplit "initials"  "E. Y. Kow"-     , testCaseNoSplit "initials 2"  "Hello, E. Y. Kow"-     , testCaseSegments "initials counter" [ "E. Y. Kow.", "Hello" ] "E. Y. Kow. Hello"-     , testCaseNoSplit "numbers"   "version 2.3.99.2"-     -- TODO: what's a good way of dealing with ellipsis (...)?-     -- TODO: He said "Foo." Bar (tricky because Foo. "Bar" is legit)-     -- TODO: Very likely to be cases where it's just plain ambiguous-     ]-  ]--testCaseNoSplit d x = testCaseSegments d [x] x-testCaseSegments d xs x = testCase d $ assertEqual "" xs (segment x)---- TODO: perhaps create a newtype that skews the random generation of tests--- towards things that look more like text (but not too much, because we still--- want to make sure we're covering edge-cases)--prop_segment_concat s =-   noWhite s == concatMap noWhite (segment s)- where-   noWhite = filter (not . isSpace)  -- ------------------------------------------------------------ --
Tests.hs view
@@ -2,9 +2,9 @@ import Test.Framework.Providers.HUnit import Test.Framework.Providers.QuickCheck2 -import NLP.FullStop ( testSuite )+import Tests.NLP.FullStop ( suite )  main :: IO () main = defaultMain-  [ NLP.FullStop.testSuite+  [ Tests.NLP.FullStop.suite   ]
+ Tests/NLP/FullStop.hs view
@@ -0,0 +1,50 @@+module Tests.NLP.FullStop ( suite ) where++import Data.Char ( isSpace )++import Test.HUnit+import Test.Framework+import Test.Framework.Providers.HUnit+import Test.Framework.Providers.QuickCheck2++import NLP.FullStop++-- ------------------------------------------------------------+--+-- ------------------------------------------------------------++suite :: Test.Framework.Test+suite =+ testGroup "NLP.FullStop"+  [ testGroup "basic sanity checking"+      [ testProperty "concat (segment s) == id s, modulo whitespace" prop_segment_concat+      ]+  , testGroup "segmentation"+     [ testCaseSegments "simple"  ["Foo.", "Bar."]   "Foo. Bar."+     , testCaseSegments "condense"  ["What?!", "Yeah"]   "What?! Yeah"+     , testCaseSegments "URLs"    ["Check out http://www.example.com.", "OK?"]+                                   "Check out http://www.example.com. OK?"+     , testCaseNoSplit "titles"    "Mr. Doe, Mrs. Durand, St. Orolo and Dr. Singh"+     , testCaseNoSplit "abbreviations"   "e.g., or eg., i.e. or ie. should not be split"+     , testCaseSegments "abbreviations 2"   ["No lie.", "Honestly"] "No lie. Honestly"+     , testCaseNoSplit "initials"  "E. Y. Kow"+     , testCaseNoSplit "initials 2"  "Hello, E. Y. Kow"+     , testCaseSegments "initials counter" [ "E. Y. Kow.", "Hello" ] "E. Y. Kow. Hello"+     , testCaseNoSplit "numbers"   "version 2.3.99.2"+     -- TODO: what's a good way of dealing with ellipsis (...)?+     -- TODO: He said "Foo." Bar (tricky because Foo. "Bar" is legit)+     -- TODO: Very likely to be cases where it's just plain ambiguous+     ]+  ]++testCaseNoSplit d x = testCaseSegments d [x] x+testCaseSegments d xs x = testCase d $ assertEqual "" xs (segment x)++-- TODO: perhaps create a newtype that skews the random generation of tests+-- towards things that look more like text (but not too much, because we still+-- want to make sure we're covering edge-cases)++prop_segment_concat s =+   noWhite s == concatMap noWhite (segment s)+ where+   noWhite = filter (not . isSpace)
fullstop.cabal view
@@ -1,5 +1,5 @@ name:                fullstop-version:             0.1.1+version:             0.1.2 synopsis:            Simple sentence segmenter description:         FullStop splits texts into sentences, using some orthographical                      conventions (used in English and hopefully other languages).@@ -22,20 +22,30 @@ cabal-version:       >= 1.6 build-type:          Custom +flag test+     Description: Build the test suite+     Default: False+ library     exposed-modules:  NLP.FullStop      -- NB: there actualy isn't any particular need for GHC 6.10     build-Depends: base >= 3 && < 4.3-                 , HUnit == 1.2.*-                 , QuickCheck == 2.1.*-                 , test-framework       == 0.2.*-                 , test-framework-hunit == 0.2.*-                 , test-framework-quickcheck2 == 0.2.*                  , split == 0.1.*  executable fullstop     main-is:  fullstop.hs  executable hstest-fullstop-    main-is:  Tests.hs+  main-is:         Tests.hs+  other-modules:   Tests.NLP.FullStop++  if flag(test)+    build-depends:   base >= 3 && < 4.3+                 ,   HUnit == 1.2.*+                 ,   QuickCheck == 2.4.*+                 ,   test-framework       == 0.3.*+                 ,   test-framework-hunit == 0.2.*+                 ,   test-framework-quickcheck2 == 0.2.*+  else+    Buildable: False