(def lines (if (:nolimit config)
(line-seq f)
(->> f
line-seq
(drop (:textunit-offset config))
(take (:textunit-limit config)))))
This file contains hidden or 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/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 |
This file contains hidden or 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/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 |
This file contains hidden or 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
| 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"); |
This file contains hidden or 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
| int | |
| tr(char c) | |
| { | |
| switch (c) | |
| { | |
| case '0' ... '9': return 1; | |
| case 'A': return 2; | |
| default: return 3; | |
| } | |
| } |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| (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] |
This file contains hidden or 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
| (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. |
This file contains hidden or 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
| set deps '{:deps {cider/cider-nrepl {:mvn/version ""0.22.0-beta6""}}}' | |
| clj -Sdeps $deps -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" |