<commit_before>(ns ais.mapping.common
  (:require [ais.types :as ais-types])
  (:gen-class))

(defn const [c & _] c)

(def lon (partial ais-types/I (/ 1.0 600000) 4))

(def lat (partial ais-types/I (/ 1.0 600000) 4))

(def slon (partial ais-types/I (/ 1.0 6000000) 3))

(def slat (partial ais-types/I (/ 1.0 6000000) 3))

(def speed (partial ais-types/U (/ 1.0 10) 1))

(defn parse-binary [fields acc collector bits]
  "Takes a sequence of bits and constructs an output data structure via
  the collector function.  Bitfields are processed via field type handlers
  and accummulated via the collector function.  The initial accumulator is<commit_msg>Added more lat/lon handlers<commit_after>(ns ais.mapping.common
  (:require [ais.types :as ais-types])
  (:gen-class))

(defn const [c & _] c)

(def x-scale  600000000) ;; 1/10
(def l-scale   60000000) ;; 1/100
(def m-scale    6000000) ;; 1/1000
(def s-scale     600000) ;; 1/10000

(def lon (partial ais-types/I (/ 1.0 s-scale) 4))
(def lat (partial ais-types/I (/ 1.0 s-scale) 4))

(def mlon (partial ais-types/I (/ 1.0 m-scale) 3))
(def mlat (partial ais-types/I (/ 1.0 m-scale) 3))

(def xlon (partial ais-types/I (/ 1.0 x-scale) 1))
(def xlat (partial ais-types/I (/ 1.0 x-scale) 1))

(def speed (partial ais-types/U (/ 1.0 10) 1))

(defn parse-binary [fields acc collector bits]
  "Takes a sequence of bits and constructs an output data structure via
  the collector function.  Bitfields are processed via field type handlers
  and accummulated via the collector function.  The initial accumulator is
{'fraction_non_alphanumeric': 0.13688946015424164, 'fraction_numerical': 0.07326478149100257, 'mean_word_length': 3.4870317002881843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7558625', 'n_tokens_mistral': 675, 'n_tokens_neox': 557, 'n_words': 200}