This is an automated email from the ASF dual-hosted git repository.

cmeier pushed a commit to branch clojure-bert-sentence-pair-classification
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit 8e89a9c406e88ffb7c1da433a98a94cdf9a0ca21
Author: gigasquid <cme...@gigasquidsoftware.com>
AuthorDate: Sun Apr 14 08:54:35 2019 -0400

    util to update roster
---
 .../examples/bert-qa/test/bert_qa/roster.clj       | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/contrib/clojure-package/examples/bert-qa/test/bert_qa/roster.clj 
b/contrib/clojure-package/examples/bert-qa/test/bert_qa/roster.clj
new file mode 100644
index 0000000..75843ce
--- /dev/null
+++ b/contrib/clojure-package/examples/bert-qa/test/bert_qa/roster.clj
@@ -0,0 +1,35 @@
+(ns bert-qa.roster
+  (:require  [clojure.test :as t]
+             [clojure.string :as string]))
+
+(require '[clojure.xml :as xml]
+         '[clojure.zip :as zip])
+
+;;convenience function, first seen at nakkaya.com later in clj.zip src
+(defn zip-str [s]
+  (zip/xml-zip 
+      (xml/parse (java.io.ByteArrayInputStream. (.getBytes s)))))
+
+(def x (zip-str (string/replace (slurp "ppmc-roster.txt") #"\<input 
type=\"checkbox\"\>"
+                                "<input type=\"checkbox\"></input>")))
+
+
+;;; format
+(def people (->> (first x)
+                 :content
+      (map :content)
+      (rest)
+      (first)
+      (map :content)
+      (map (fn [x] [(-> (first x) :content first :content first :attrs :href 
(string/split #"\/") last)
+                    (-> (nth x 2) :content first :content first)]))
+      
+      ))
+
+(defn emit-people [persons]
+  (doseq [[username fullname] persons]
+    (xml/emit-element {:tag :tr :content [{:tag :td,:content ["."]}
+                                          {:tag :td,:content [username]}
+                                          {:tag :td,:content [fullname]}]})))
+
+(emit-people people)

Reply via email to