Skip to content

Commit

Permalink
store: academic style author simiplification
Browse files Browse the repository at this point in the history
  • Loading branch information
irq0 committed Feb 26, 2024
1 parent 8e9eadf commit 6f7a074
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/llar/db/modify.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
:descriptions :item_data_type/description
:thumbs :item_data_type/thumbnail})

(defn- simplify-author [authors]
(cond
(empty? authors) ""
(> (count authors) 3) (str (first authors) " et al.")
:else (string/join "; " authors)))

(defn store-item-without-data!
"store-item! persists item to the database, without data attachment like
contents and descriptions. Return {:id .. :hash .. } or nil if the item
Expand All @@ -36,7 +42,7 @@
:hash (:hash item)
:ts (or (:ts summary) (time/zoned-date-time))
:title (:title summary)
:author (string/join "," (:authors entry))
:author (simplify-author (:authors entry))
:type (keyword "item_type" (name (:type item)))
:tags (into [] (map name (or (:tags meta) [])))
:nlp-nwords (or (:nwords nlp) -1)
Expand Down

0 comments on commit 6f7a074

Please sign in to comment.