Skip to content

Instantly share code, notes, and snippets.

View veer66's full-sized avatar

Vee Satayamas veer66

View GitHub Profile
def tokenize_en(text)
# modified https://github.com/luismsgomes/mosestokenizer/blob/master/src/mosestokenizer/tokenizer-v1.1.perl
text = " #{text.chomp} "
text.gsub!(/\s+/, ' ')
text.gsub!(/[\000-\037]/, '')
text.gsub!(/([^\p{Alnum}\s\.\'\`\,\-])/, ' \1 ')
text.gsub!(/\.([\.]+)/, 'DOTMULTI\1')
while text =~ /DOTMULTI\./
text.gsub!(/DOTMULTI\.([^\.])/, 'DOTDOTMULTI \1')
text.gsub!(/DOTMULTI\./, 'DOTDOTMULTI')
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match>
<test name="lang" compare="contains">
<string>th</string>
</test>
<edit mode="prepend" name="family">
<string>Noto Sans Thai</string>
</edit>
year(math, 60).
year(ai, 62).
year(english, 65).
str_rev(S, T) :- string_codes(S, SCODES), reverse(SCODES, TCODES), string_codes(T, TCODES).
can_register(STUDENT_ID, SUBJECT) :- str_rev(STUDENT_ID, REV_STUDENT_ID),
sub_string(REV_STUDENT_ID, 0, 2, _, REV_YEAR_STR),
str_rev(REV_YEAR_STR, YEAR_STR),
number_string(YEAR, YEAR_STR),
year(math, 60).
year(ai, 62).
year(english, 65).
can_register(STUDENT_ID, SUBJECT) :- sub_string(STUDENT_ID, 0, 2, _, YEAR_STR),
number_string(YEAR, YEAR_STR),
year(SUBJECT, REQ_YEAR),
YEAR =< REQ_YEAR.
male(tom).
male(bob).
male(jim).
female(liz).
female(pat).
female(ann).
female(pam).
parent(pam,bob).
parent(tom,bob).
parent(tom,liz).
#!/bin/bash
rm -rf fast_align
git clone https://github.com/clab/fast_align.git
pushd fast_align
cmake .
make -j $(nproc)
popd
@veer66
veer66 / pyproject.toml
Created November 6, 2022 09:22
พยายามใส่ thai2nmt แต่พัง
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "thai2nmt"
version = "0.0.1"
authors = [{name = "VISTEC", email = "onarinl_pro@vistec.ac.th"}]
description = "thai2nmt: English-Thai Machine Translation Models"
readme = "README.md"
postgres=# CREATE TABLE citizen (name text);
CREATE TABLE
postgres=# INSERT INTO citizen VALUES ('เเซม');
INSERT 0 1
postgres=# SELECT name FROM citizen WHERE name = 'แซม';
name
------
(0 rows)
postgres=# CREATE OR REPLACE FUNCTION normalize_thai_name(name text) RETURNS text AS $$
@veer66
veer66 / halo.rb
Created September 17, 2022 01:01
require "gtk3"
app = Gtk::Application.new "rocks.veer66.Halo", :flags_none
app.signal_connect :activate do |app|
window = Gtk::ApplicationWindow.new(app)
window.set_title "Halo"
vbox = Gtk::Box.new(Gtk::Orientation::VERTICAL)
t1 = Gtk::TextView.new
#!/usr/bin/wish
grid [text .t1 -width 80 -height 30]
grid [ttk::button .b1 -text "chow BOYD" -command {.t1 insert end [exec "ls"]; .t1 insert end "\n\n"}]
grid [ttk::button .b2 -text "chow Tapemodel"]
grid [ttk::button .b3 -text "chow matrix"]
grid [ttk::button .b4 -text "chow kick"]
grid [ttk::button .b5 -text "Exit" -command {exit 0}]