summaryrefslogtreecommitdiff
path: root/src/Db.hs
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2017-11-02 13:46:31 +0100
committerLars-Dominik Braun <lars@6xq.net>2017-11-02 13:47:01 +0100
commit25c120d01c8d133ad8b481941de2ebbadf373f4e (patch)
tree731cdc9030b7dab5568092d91fb64f9a75fe0f4f /src/Db.hs
parent7fb8756787ae8aaeba4fa0d1b2eeb703516d8c23 (diff)
downloadcomatose-25c120d01c8d133ad8b481941de2ebbadf373f4e.tar.gz
comatose-25c120d01c8d133ad8b481941de2ebbadf373f4e.tar.bz2
comatose-25c120d01c8d133ad8b481941de2ebbadf373f4e.zip
Show feature category
Just the feature name is not enough information in some cases.
Diffstat (limited to 'src/Db.hs')
-rw-r--r--src/Db.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Db.hs b/src/Db.hs
index fa38db3..caeaf77 100644
--- a/src/Db.hs
+++ b/src/Db.hs
@@ -96,6 +96,13 @@ getFeaturesByBase db base = M.filterWithKey (\k v -> (base ++ ".") `isPrefixOf`
-- |Get number of algorithms in database
algorithmCount db = M.size $ dalgos db
+split :: (Eq a) => a -> [a] -> [[a]]
+split delim s = let (a, b:bs) = span (/= delim) s in a:split delim bs
+
+-- |Get base of feature
+getFeatureBase :: String -> String
+getFeatureBase feature = head $ split '.' feature
+
minMaxPublicationYears db = (firstyear, lastyear)
where
pubyears = catMaybes $ map (lookup "year" . E.fields) $ dpublications db