Skip to content

MARC 21 and GLAM Recipes

Felix Lohmeier edited this page Mar 24, 2022 · 3 revisions

User Community Recipes

Feel free to organize this structure that works best for the global GLAM community.

Discussion can be done via the OpenRefine user mailing list for now.

To search this page or others, use the top-left search box next to GitHub logo and then filter choice to "Wiki"

MARC 21 Recipes

2xx

3XX

GLAM Recipes

Convert Roman numerals to Arabic

Given a column that contains Roman numbers, you can convert them using the following Clojure snippet

Column 1 output
vii 7
v 5
xix 19
iv 4
(defn ro2ar [r]
  (->> (reverse (.toUpperCase r))
       (map {\M 1000 \D 500 \C 100 \L 50 \X 10 \V 5 \I 1})
       (partition-by identity)
       (map (partial apply +))
       (reduce #(if (< %1 %2) (+ %1 %2) (- %1 %2)))))
(ro2ar value)

Next Recipe

Clone this wiki locally