packages feed

lojban 0.2 → 0.3

raw patch · 5 files changed

+24/−9 lines, 5 filesdep +mtldep ~base

Dependencies added: mtl

Dependency ranges changed: base

Files

Language/Lojban/Jbovlaste.hs view
@@ -24,6 +24,7 @@     ,valsiType      -- * Showing valsi     ,showValsi+    ,showType     )     where @@ -49,13 +50,17 @@ valsi :: JboDB -> String -> [JboValsi] valsi db s = sortBy (comparing valsiType) $ filterValsi db match where     match e = valsiWord e == s || any (==s) (valsiGloss e)-              || (valsiType e == GismuType && any (==s) (valsiRafsis e))+              || (valsiType e == GismuType && +                  (any (==s) (valsiRafsis e) +                   || (length s == 4 && s `isPrefixOf` valsiWord e)))  -- | Find valsi(s) by definition substring. defSub :: JboDB -> String -> [JboValsi] defSub db s = filterValsi db match where-    match = any ((==lower s) . lower) . splitBy (not . isLetter) . valsiDef---    match = isInfixOf s . valsiDef+    match | any (not . isLetter) s = match1+          | otherwise              = match2+    match1 = isInfixOf (lower s) . lower . valsiDef+    match2 = any ((isPrefixOf $ lower s) . lower) . splitBy (not . isLetter) . valsiDef  -- | Find valsi(s) by definition wild card string. defWildCard :: JboDB -> String -> [JboValsi]
Language/Lojban/Lujvo.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE PostfixOperators #-}+ module Language.Lojban.Lujvo (rafsis,fixClusters) where  import Control.Monad
Language/Lojban/Mlismu.hs view
@@ -22,15 +22,14 @@   is <- doesFileExist path   if is      then do db <- openFile path AppendMode-             hSetBuffering db LineBuffering              return $ Right $ Mlismu path db      else return $ Left $ "\"" ++ path ++ "\" does not exist"  -- | Is a fatci valid? isValidFatci :: String -> IO Bool isValidFatci text = do-  validLojban <- isValidLojban text-  if validLojban+--  validLojban <- isValidLojban text+  if True -- validLojban      then isJust `fmap` mlismuBridi (Right text) Nothing 1      else return False @@ -38,7 +37,7 @@ mlismuBridi path selbri lines' = do   out <- run ("mlismu -n " ++ show lines' ++  " -f " ++ path' ++ selbri') input   case out of-    Right (_,good@(_:_)) +    Right ("",good@(_:_))          | Just good' /= selbri -> return $ Just $ lines $ good          where good' = list "" (head . lines) good     _                         -> return Nothing@@ -64,6 +63,7 @@   is <- isValidFatci fatci   if is      then do hPutStrLn (mliDB mli) fatci+             hFlush (mliDB mli)              return True      else return False 
Language/Lojban/Util.hs view
@@ -8,6 +8,7 @@     ,findCmavo     ,findSelrafsi     ,filterSelma'o+    ,valsiByGloss      -- * External programs     ,grammar     ,translate@@ -23,6 +24,13 @@ import Data.Char import Data.List import Text.Regex+import Data.Ord++-- | Find valsi(s) by gloss, more detailed.+valsiByGloss :: JboDB -> String -> [JboValsi]+valsiByGloss db s = sortBy (comparing valsiType) $ filterValsi db match where+    match e = any (isInfixWord s) (valsiGloss e)+    isInfixWord s = any (==s) . words  -- | Return the selrafsis of a lujvo (string). lujvoSelrafsis :: JboDB -> String -> Maybe [JboValsi]
lojban.cabal view
@@ -1,5 +1,5 @@ name:                lojban-version:             0.2+version:             0.3 synopsis:            Useful utilities for the Lojban language description:         Some utilities such as querying Jbovlaste XML                       exports for gismu, gloss, rafsi, etc. and @@ -14,7 +14,7 @@ build-type:          Simple  library-  build-depends: base,xml,strict,parsec,process,regex-compat,containers,tagsoup,HTTP,curl,random,directory,markov-chain+  build-depends: base==3.*,xml,strict,parsec,process,regex-compat,containers,tagsoup,HTTP,curl,random,directory,markov-chain,mtl   exposed-modules: Language.Lojban.Jbovlaste,Language.Lojban.Lujvo,Language.Lojban.Util,Language.Lojban.CLL,Language.Lojban.Jbobau,Language.Lojban.Mlismu,Language.Lojban.Camxes.Parse   other-modules: WildCard, Utils   ghc-options: -O2