This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((lambda (interpret) | |
;; code | |
(interpret '((lambda (interpret) | |
;; code | |
(interpret '((lambda (a b) ((lambda (c d) (cons c d)) a b)) 1 2)) | |
) | |
((lambda (primitive-environment new-env lookup assign) | |
((lambda (exec) | |
(lambda (exp) | |
(exec exp primitive-environment))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-modules (ice-9 peg)) | |
(define-peg-string-patterns | |
"True <-- 'true' | |
False <-- 'false' | |
Null <-- 'null' | |
WS < (' ' / '\n' / '\r' / '\t')* | |
Number <-- Minus? IntegralPart FractionalPart? ExponentPart? | |
Minus <- '-' | |
IntegralPart <- '0' / [1-9] [0-9]* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; generate-table | |
(require 's) | |
(require 'seq) | |
(require 'subr-x) | |
(defun gentbl-get-table-header (table-list) | |
(car table-list)) | |
(defun gentbl-swap (tl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun re-seq (r s) | |
(let ((l) | |
(n 1) | |
(break nil)) | |
(save-match-data | |
(string-match r s) | |
(while (null break) | |
(if-let ((m (match-string n s))) | |
(progn | |
(push m l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gengo05 | |
(:require [clojure.java.io :as io] | |
[incanter.core :as i-core] | |
[incanter.charts :as i-charts] | |
[dorothy.core :as dot] | |
[dorothy.jvm :refer (render save! show!)])) | |
;; https://nlp100.github.io/ja/ch05.html | |
;; $ cat neko.txt | cabocha -f1 > neko.txt.cabocha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gengo04 | |
(:require [clojure.java.io :as io] | |
[incanter.core :as incanter-core] | |
[incanter.charts :as incanter-charts] | |
)) | |
;; https://nlp100.github.io/ja/ch04.html | |
;; $ mecab neko.txt -o neko.txt.mecab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gengo03 | |
(:require [cheshire.core :as cheshire] | |
[clojure.java.io :as io])) | |
;; https://nlp100.github.io/ja/ch03.html | |
;; 20 | |
(def r (io/reader (io/resource "jawiki-country.json"))) | |
(def jsons (doall | |
(map (fn [line] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://nlp100.github.io/ja/ch02.html | |
# 10 | |
cat popular-names.txt | bb -io "(count *input*)" | |
# 11 | |
cat popular-names.txt | bb -i '(doseq [line *input*] (println (str/replace line #"\t" " ")))' > popular-names-spaces.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; https://nlp100.github.io/ja/ch01.html | |
;; helper | |
(defn get-words [s] | |
(->> (clojure.string/split s #"[\., ]") | |
(filter #(not (empty? %))))) | |
(defn make-ngram [n coll] | |
(if (> n (count coll)) | |
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns hoge.core | |
(:require [qbits.spandex :as s])) | |
;; 参考: https://dev.classmethod.jp/server-side/elasticsearch-getting-started-07/ | |
(def conn (s/client {:hosts ["http://localhost:9200"]})) | |
;; clusterの状態確認 | |
(s/request conn {:url "/_cat/health?v"}) |
NewerOlder