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
/** | |
* Tiny tokenizer - https://gist.github.com/borgar/451393 | |
* @param {String} string - string to be tokenized | |
* @param {Object} parsers - { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ } | |
* @param {String} deftok - type to label tokens that are not classified with the above parsers | |
* @return {Array} - array of objects => [{ token:"this", type:"word" },{ token:" ", type:"whitespace" }, Object { token:"is", type:"word" }, ... ] | |
**/ | |
export const classifyTokens = (string, parsers, deftok) => { | |
string = (!string) ? '' : string; // if string is undefined, make it an empty string | |
if (typeof string !== 'string') { |
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
let XRegExp = require('xregexp'); | |
let nonUnicodeLetter = XRegExp('[^\\pL\\pM]+?'); | |
var sentence = "This is a sentence-with some punctuation, and it will be split-up." | |
console.log("sentence: ", sentence) | |
var tokens = sentence.split(nonUnicodeLetter) | |
console.log("tokens: ", tokens) | |
_sentence = sentence |
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
var assignments = { | |
"Hindi-ULB" : { | |
"Matthew": { | |
"Milestone 1": { | |
"assigned": [1,2,3,4,5,6,7,8,9,10,11,12,13], | |
"completed": [1,2,3,4,5] | |
}, | |
"Milestone 2": { | |
"assigned": [1,2,3,4,5], | |
"completed": [1,2] |
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
// | |
// SKMultilineLabel.swift | |
// | |
// Created by Craig on 10/04/2015 | |
// Modified by Christopher Klapp on 11/21/2015 for line breaks \n for paragraphs | |
// Copyright (c) 2015 Interactive Coconut. All rights reserved. | |
// | |
/* USE: | |
(most component parameters have defaults) |
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
Privacy Policy | |
Last updated: November 08, 2015 | |
Church Muse ("us", "we", or "our") operates the Follow That Star iOS Application (the "Service"). | |
This page informs you of our policies regarding the collection, use and disclosure of Personal Information when you use our Service. | |
We will not use or share your information with anyone except as described in this Privacy Policy. |
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
samples = 100000.times.with_object([]){|i,a|a.push ["heads","tails"].sample} | |
#always choose heads | |
samples.map{|coin|coin=="heads"}.group_by{|o|o}.map.with_object({}){|h,o|o[h[0]]=h[1].count}[true].to_f/1000 | |
#alternate every other call | |
samples.map.with_index{|coin,i|coin==(i.even? ? "heads" : "tails")}.group_by{|o|o}.map.with_object({}){|h,o|o[h[0]]=h[1].count}[true].to_f/1000 | |
#randomly choose | |
samples.map{|coin|coin==["heads","tails"].sample}.group_by{|o|o}.map.with_object({}){|h,o|o[h[0]]=h[1].count}[true].to_f/1000 |