<commit_before>(ns babel.workbook
  (:refer-clojure :exclude [get-in merge resolve find parents])
  (:require
   [babel.engine :refer [generate]]
   [babel.english.grammar :as en]
   [babel.espanol.writer :as es]
   [babel.francais.grammar :as fr]
   [babel.italiano.grammar :as it]
   [babel.over :refer [over]]
   [babel.html :as html]
   [babel.parse :as parse]
   [babel.pos :as pos]
   [babel.test.fr :as frtest]
   [clojail.core :refer [sandbox]]
   [clojail.testers :refer :all]
   [clojure.core :exclude [get-in]]
   [clojure.core :as core] ;; This allows us to use core's get-in by doing "(core/get-in ..)"
   [clojure.set :as set]
   [clojure.string :as string]
   [clojure.tools.logging :as log]
   [compojure.core :as compojure :refer [GET PUT POST DELETE ANY]]
   [dag-unify.core :refer [get-in remove-false strip-refs]]
   [hiccup.core :refer [html]]
))

;; TODO: add other languages
(defn parse [string]
  (concat
   (fr/parse string)
   (it/parse string)))

;; this does some sample runtime behavior (generates sentences)
;; which allow certain things to get initialized so that remote (i.e. HTTP
;; requests to the same things will not fail with cryptic 'undefined'
;; stack traces.
;(def avoid-init-errors (nounphrase))
(def avoid-init-errors true)

;; TODO: add user convenience functions: functions that might be useful for workbook users.

;; Sandbox specification derived from:
;;    https://github.com/flatland/clojail/blob/4d3f58f69c2d22f0df9f0b843c7dea0c6a0a5cd1/src/clojail/testers.clj#L76
;;    http://docs.oracle.com/javase/6/docs/api/overview-summary.html
;;    http://richhickey.github.com/clojure/api-index.html
(def workbook-sandbox
  (sandbox
   (conj
    clojail.testers/secure-tester-without-def
    (blacklist-nses '[
                      clojure.main
                      java
                      javax
                      org.omg
                      org.w3c
                      org.xml
                      ])
    (blacklist-objects [
                        clojure.lang.Compiler
                        clojure.lang.Ref
                        clojure.lang.Reflector<commit_msg>working on retrieving expressions from db and displaying<commit_after>(ns babel.workbook
  (:refer-clojure :exclude [get-in merge resolve find parents])
  (:require
   [babel.engine :refer [generate]]
   [babel.english.grammar :as en]
   [babel.espanol.writer :as es]
   [babel.francais.grammar :as fr]
   [babel.italiano.grammar :as it]
   [babel.over :refer [over]]
   [babel.html :as html]
   [babel.korma :as korma]
   [babel.parse :as parse]
   [babel.pos :as pos]
   [babel.reader :as reader]
   [babel.test.fr :as frtest]
   [clojail.core :refer [sandbox]]
   [clojail.testers :refer :all]
   [clojure.core :exclude [get-in]]
   [clojure.core :as core] ;; This allows us to use core's get-in by doing "(core/get-in ..)"
   [clojure.set :as set]
   [clojure.string :as string]
   [clojure.tools.logging :as log]
   [compojure.core :as compojure :refer [GET PUT POST DELETE ANY]]
   [dag-unify.core :refer [get-in remove-false strip-refs]]
   [hiccup.core :refer [html]]
))

;; TODO: add other languages (English and Spanish)
(defn parse [string]
  (concat
   (fr/parse string)
   (it/parse string)))

(defn expr [id]
  (reader/id2expression [id]))

;; this does some sample runtime behavior (generates sentences)
;; which allow certain things to get initialized so that remote (i.e. HTTP
;; requests to the same things will not fail with cryptic 'undefined'
;; stack traces.
;(def avoid-init-errors (nounphrase))
(def avoid-init-errors true)

;; TODO: add user convenience functions: functions that might be useful for workbook users.

;; Sandbox specification derived from:
;;    https://github.com/flatland/clojail/blob/4d3f58f69c2d22f0df9f0b843c7dea0c6a0a5cd1/src/clojail/testers.clj#L76
;;    http://docs.oracle.com/javase/6/docs/api/overview-summary.html
;;    http://richhickey.github.com/clojure/api-index.html
(def workbook-sandbox
  (sandbox
   (conj
    clojail.testers/secure-tester-without-def
    (blacklist-nses '[
                      clojure.main
                      java
                      javax
                      org.omg
                      org.w3c
                      org.xml
                      ])
    (blacklist-objects [
                        clojure.lang.Compiler
                        clojure.lang.Ref
                        clojure.lang.Reflector
{'fraction_non_alphanumeric': 0.11904224079512085, 'fraction_numerical': 0.011520216851140727, 'mean_word_length': 2.5031645569620253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, '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': '1422689', 'n_tokens_mistral': 1549, 'n_tokens_neox': 1480, 'n_words': 370}