Skip to content

Instantly share code, notes, and snippets.

View veer66's full-sized avatar

Vee Satayamas veer66

View GitHub Profile

สิ่งที่ผมคิด

(def lines (if (:nolimit config)
              (line-seq f)
              (->> f
                line-seq
                (drop (:textunit-offset config))
                (take (:textunit-limit config)))))
#!/bin/sh
apt remove -y docker docker-engine docker.io containerd runc
apt update
apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt install -y docker-ce docker-ce-cli containerd.io
apt install -y rlwrap emacs ruby default-jdk-headless

ลองเทียบความเร็ว map ของ Elixir, Ruby, Crystal

defmodule Toto do                                                                       
  def run do                                                                            
    t1 = System.system_time(:millisecond)                                               
    [a | _] = (0..90000000) |> Enum.map(fn i -> i + 1 end) |> Enum.reverse              
    t2 = System.system_time(:millisecond)                                               
    IO.puts a                                                                           
    IO.puts(t2 - t1)                                                                    
@veer66
veer66 / run.sh
Last active September 7, 2019 04:32
preprocess and train #nematus
#!/bin/sh
devices=0
src=en
trg=th
working_dir=`pwd`
data_dir=/thesis/mt2019/man_clean_sents
corpus=law-man-sents-tok-true
subword_prefix=/path/to/subword-nmt
vocab=$data_dir/vocab
fn segment_en(text: &str) -> Vec<String> {
let (tx, mut rx) = oneshot::channel();
let fut = {
let body = json!({"text": text});
let http_client = Client::new();
let req = Request::builder()
.method("POST")
.uri("http://127.0.0.1:4719/sent-tok")
.body(Body::from(body.to_string()))
.expect("Request building fails");
int
tr(char c)
{
switch (c)
{
case '0' ... '9': return 1;
case 'A': return 2;
default: return 3;
}
}
IO.popen("wordcut -s ' ' -d ../data/thai.txt", 'r+') do |f|
values.each {|v| f.puts(v)}
f.close_write
toks = f.read.split(/\s+/)
end
(require '[clojure.data.xml :as xml]
'[clojure.string :as str]
'[clojure.java.io :as io])
(defn ext-segs [segs]
(->> segs
(mapcat :content)
(str/join " ")))
(defn ext-tuv [tuv]
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
set deps '{:deps {cider/cider-nrepl {:mvn/version ""0.22.0-beta6""}}}'
clj -Sdeps $deps -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"