summaryrefslogtreecommitdiff
path: root/src/Db.hs
diff options
context:
space:
mode:
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