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
from math import log, exp | |
""" | |
sources: | |
http://windowoffice.tumblr.com/post/33548509/logsum-underflow-trick-re-discovery | |
https://facwiki.cs.byu.edu/nlp/index.php/Log_Domain_Computations | |
""" | |
def log_add(x,y): | |
logx = log(x) | |
logy = log(y) |
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
TerminalQ[x_] := MemberQ[{a, b, c, d}, x]; | |
Rules = {S -> {{{X, Y}, 1}, {{X, X, Y}, 5}}, | |
X -> {{{a}, 1/2}, {{b}, 1/2}}, Y -> {{{c}, 1/3}, {{d}, 2/3}}}; | |
PCFGUnfold[sym_, Rules_, TerminalQ_] := | |
If[TerminalQ[sym], | |
{{{sym}, 1}}, | |
Block[{lookup, rules, probabilities}, | |
(*for some reason,I can't specify the last two in the {} above*) |
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
def p(x) puts x + 'p ' + 34.chr + x + 34.chr end; p "def p(x) puts x + 'p ' + 34.chr + x + 34.chr 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
/* | |
----------------------------------------------------------------- | |
----------------------------------------------------------------- | |
NOTE: this file has been superseded by mmturkey: | |
https://github.com/longouyang/mmturkey | |
----------------------------------------------------------------- | |
----------------------------------------------------------------- | |
*/ | |
var turk = {}; |
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
Hello World! |
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
<html> | |
<head> | |
<script type="text/javascript"> | |
var pID; | |
var i = 0; | |
var startTime, endTime; | |
function start_test() { | |
i = 0; |
NewerOlder