Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
FILE *fp = NULL; | |
double value, sum = 0; | |
fp = fopen(argv[1], "r"); | |
if (fp = NULL) { | |
fprintf(stderr, "failed to open %s\n", argv[1]); |
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
(require 'gud) | |
(setq gdb-many-windows t) | |
(setq gdb-use-separate-io-buffer t) | |
(add-hook | |
'gdb-mode-hook | |
'(lambda () | |
(gud-tooltip-mode t) | |
(gud-def gud-break-main "break main" nil "Set breakpoint at main.") | |
)) |
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
import collections | |
import math | |
def build(CNF): | |
G = collections.defaultdict(list) | |
for left, right, p in CNF: | |
G[right].append((left, math.log(p))) | |
return G | |
def show_cell(T, i, j): |
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
import collections | |
def build(CNF): | |
G = collections.defaultdict(list) | |
for left, right in CNF: | |
G[right].append(left) | |
return G | |
def cky(G, W): | |
T = [[[] for j in range(len(W)+1)] for i in range(len(W))] |
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
""" | |
Viterbi algorithm on Markov Model. | |
Copyright (c) 2012 by Naoaki Okazaki | |
""" | |
import json | |
import math | |
import operator | |
import sys |
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
""" | |
Maximum Likelihood Estimation (MLE) for Hidden Markov Model (HMM). | |
Copyright (c) 2012 by Naoaki Okazaki | |
""" | |
import collections | |
import json | |
import math | |
import sys |
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
import sys | |
import os | |
import gzip | |
def ngram(T, n): | |
return ['%dgram=%s' % (n, '_'.join(T[i:i+n])) for i in range(len(T)-n+1)] | |
def process(fo, fi, label): | |
F = [] | |
for line in fi: |
NewerOlder