minimorph 0.1.5.0 → 0.1.6.0
raw patch · 3 files changed
+25/−18 lines, 3 files
Files
- NLP/Minimorph/English.hs +6/−6
- NLP/Minimorph/Util.hs +11/−7
- minimorph.cabal +8/−5
NLP/Minimorph/English.hs view
@@ -51,7 +51,7 @@ 8 -> "eight" 9 -> "nine" 10 -> "ten"- _ -> showT n+ _ -> tshow n -- | > ordinalNotSpelled 1 == "1st" -- > ordinalNotSpelled 2 == "2nd"@@ -64,7 +64,7 @@ | n `rem` 10 == 3 -> k `suf` "rd" | otherwise -> k `suf` "th" where- num `suf` s = showT num <> s+ num `suf` s = tshow num <> s -- | > ordinal 1 == "first" -- > ordinal 2 == "second"@@ -181,7 +181,7 @@ Just (h, _) -> isVowel h `butNot` hasSemivowelPrefix t Nothing -> False x `butNot` y = x && not y- isSep c = isSpace c || c `elem` "-"+ isSep c = isSpace c || c `elem` ("-" :: String) -- | Variant of 'wantsAn' that assumes the input string is pronounced -- one letter at a time.@@ -222,7 +222,7 @@ looksLikeAcronym . firstWord where firstWord = fst . T.break isSep- isSep c = isSpace c || c `elem` "-"+ isSep c = isSpace c || c `elem` ("-" :: String) -- --------------------------------------------------------------------- -- ** Sounds@@ -257,7 +257,7 @@ -- | Is a vowel. isVowel :: Char -> Bool-isVowel = (`elem` "aeiou") . toLower+isVowel = (`elem` ("aeiou" :: String)) . toLower -- | Letters that when pronounced independently in English sound like they -- begin with vowels.@@ -268,7 +268,7 @@ -- (In the above, @'r'@ is pronounced @"are"@, but @'k'@ is pronounced -- @"kay"@.) isLetterWithInitialVowelSound :: Char -> Bool-isLetterWithInitialVowelSound = (`elem` "aeiofhlmnrsx") . toLower+isLetterWithInitialVowelSound = (`elem` ("aeiofhlmnrsx" :: String)) . toLower -- | Is a consonant. isConsonant :: Char -> Bool
NLP/Minimorph/Util.hs view
@@ -7,9 +7,12 @@ -- Portability : portable -- -- Text utility functions.-module NLP.Minimorph.Util where+module NLP.Minimorph.Util+ ( tTakeEnd, tDropEnd, (<>), (<+>), tshow, showT )+ where -import Data.Text ( Text )+import Data.Monoid ((<>))+import Data.Text (Text) import qualified Data.Text as T -- | @tTakeEnd n t@ returns the last @n@ letters of @t@.@@ -20,10 +23,7 @@ tDropEnd :: Int -> Text -> Text tDropEnd n x = T.take (T.length x - n) x --- | Identical to 'T.append'.-(<>) :: Text -> Text -> Text-t1 <> t2 = t1 `T.append` t2-+infixr 6 <+> -- matches Monoid.<> -- | Separated by space unless one of them is empty (in which case just -- the non-empty one). (<+>) :: Text -> Text -> Text@@ -32,5 +32,9 @@ | otherwise = t1 <> " " <> t2 -- | Show a value in Text format.+tshow :: Show a => a -> Text+tshow = T.pack . show+ showT :: Show a => a -> Text-showT = T.pack . show+{-# DEPRECATED showT "The function is renamed to @tshow@." #-}+showT = tshow
minimorph.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: minimorph-version: 0.1.5.0+version: 0.1.6.0 synopsis: English spelling functions with an emphasis on simplicity. description: A set of simplistic functions capturing the more regular parts of English spelling (for generation, not parsing).@@ -13,19 +13,22 @@ better suited). The main goal is to provide something cheap and cheerful with no learning curve, that you can use until your application calls for more robustness.-homepage: http://darcsden.com/kowey/minimorph+ See <https://github.com/Mikolaj/miniutter> for a simple+ use case.+homepage: https://github.com/Mikolaj/minimorph+bug-reports: https://github.com/Mikolaj/minimorph/issues license: BSD3 license-file: LICENSE author: Eric Kow-maintainer: eric.kow@gmail.com+maintainer: Mikolaj Konarski <mikolaj.konarski@funktory.com> -- copyright: category: Natural Language Processing build-type: Simple cabal-version: >=1.8 source-repository head- type: darcs- location: http://hub.darcs.net/kowey/minimorph+ type: git+ location: git://github.com/Mikolaj/minimorph.git library exposed-modules: NLP.Minimorph.English