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
<?php | |
function cleanse ($text) | |
{ | |
$text = iconv ('UTF-8', 'ASCII//TRANSLIT//IGNORE', $text); // accented character to 'normal' | |
$text = preg_replace ('/[\r\n\s\t]+/xms', ' ' , $text); // normalise whitespace to one space | |
$text = preg_replace ('/[^\w\s]+/xms' , '' , $text); // remove all punctuation | |
return strtolower (trim ($text)); // lowercase and trimmed | |
} |
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
<?php | |
// for more info see : http://ucrel.lancs.ac.uk/llwizard.html | |
// $n1 = total words in corpus 1 (usually the normative corpus) | |
// $n2 = total words in corpus 2 | |
// $o1 = observed count for the word in corpus 1 (usually the normative corpus) | |
// $o2 = observed count for the word in corpus 2 | |
function logLikelihood ($n1, $o1, $n2, $o2) |
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
/* | |
use the following in your css file | |
.json-key { color: red; } | |
.json-value { color: blue; } | |
.json-string { color: green; } | |
set your output like this: |
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
'use strict' | |
/* | |
first install the following node modules: | |
npm install aws-sdk | |
npm install stream | |
npm install speaker |
NewerOlder