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
| #include <chrono> | |
| #include <cstdlib> | |
| #include <iostream> | |
| #include <random> | |
| #include <thread> | |
| #include <X11/Xlib.h> | |
| #include <X11/Xutil.h> | |
| using namespace std; |
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
| #!/usr/bin/env python3 | |
| import curses | |
| from random import random | |
| from time import sleep | |
| def main(scr): | |
| curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_BLACK) | |
| curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_BLACK) | |
| curses.init_pair(3, curses.COLOR_WHITE, curses.COLOR_WHITE) |
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
| #!/usr/bin/env python3 | |
| import sys | |
| from argparse import ArgumentParser | |
| from collections import defaultdict | |
| def parse_args(): | |
| p = ArgumentParser('Converts word to integer using byte-pair encoding.') | |
| p.add_argument( | |
| '--input', |
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
| import builtins | |
| import random | |
| def word_list(filename): | |
| with open(filename) as fp: | |
| for l in fp: | |
| yield l.split() | |
| def batch(generator, size): | |
| batch = [] |
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
| #!/usr/bin/python3 | |
| import math | |
| import random | |
| import sys | |
| from argparse import ArgumentParser | |
| from collections import defaultdict | |
| from util.functions import trace | |
| def parse_args(): |
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
| # usage (single sentence): | |
| # ref = ['This', 'is', 'a', 'pen', '.'] | |
| # hyp = ['There', 'is', 'a', 'pen', '.'] | |
| # stats = get_bleu_stats(ref, hyp) | |
| # bleu = calculate_bleu(stats) # => 0.668740 | |
| # | |
| # usage (multiple sentences): | |
| # stats = defaultdict(int) | |
| # for ref, hyp in zip(refs, hyps): | |
| # for k, v in get_bleu_stats(ref, hyp).items(): |
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
| import java.io.*; | |
| import java.util.*; | |
| import edu.stanford.nlp.ling.Word; | |
| import edu.stanford.nlp.process.WordTokenFactory; | |
| import edu.stanford.nlp.process.PTBTokenizer; | |
| public class StanfordTokenizerRunner { | |
| private static List<String> tokenize(String text) { | |
| PTBTokenizer<Word> tokenizer = new PTBTokenizer<Word>( |
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
| 27 垓 100,000,000,000,000,000,000 | |
| 22 京 10,000,000,000,000,000 | |
| 18 根 stick-to-itiveness | |
| 18 闇 black-marketeering | |
| 17 兆 1,000,000,000,000 | |
| 17 悦 self-satisfaction | |
| 16 訛 mispronunciation | |
| 16 識 acquaintanceship | |
| 16 矩 perpendicularity | |
| 16 鎌 sickle-and-chain |
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
| #!/usr/bin/python3 | |
| import datetime | |
| import sys | |
| import math | |
| import numpy as np | |
| from argparse import ArgumentParser | |
| from collections import defaultdict | |
| from chainer import FunctionSet, Variable, functions, optimizers |
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
| #!/usr/bin/python3 | |
| # RNNLM trainer | |
| # date: 2015-8-25 | |
| # author: @odashi_t | |
| import datetime | |
| import sys | |
| import math | |
| import numpy as np |