Credits - Observable Markov models
by Will Paul Project | Docs
License Simplified BSD
Copyright (c) 2015, Will Paul
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Content
Most of what I know about Markov processes is from Jurafsky and Martin's NLP textbook:
Daniel Jurafsky and James H. Martin. 2000. Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition (1st ed.). Prentice Hall PTR, Upper Saddle River, NJ, USA.
Libraries
-
D3.js, "D3.js is a JavaScript library for manipulating documents based on data."
- Implements the math/physics for the force layout, but none of the rendering.
- Some convenience methods for manipulating data (e.g. color and linear scales)
- Light abstraction around events (e.g. combining touch and click events)
-
Lodash.js, "A JavaScript utility library delivering consistency, modularity, performance, & extras."
- Used wherever you see the `_` function, fixes problems with JavaScripts collection methods. I primarily use it to make array/object methods chainable and to take a little more functional approach to writing loops.
Borrowed code/ideas
The Point object is modeled after Processing's PVector and Paper's Point.
The arrows at the tips of the quadratic curves used this guy on Stackoverflow's math.
Animating on Bezier curves (quadratic and cubic) uses De Casteljau's algorithm, as proposed by this guy on Stackoverflow. Also Pomax's interactive Bezier intro was very useful at helping me just wrap my mind around how Beziers work.
The efficiently delete all children of a given DOM node code I borrowed from Stackoverflow
This code lets you have variable length argument lists:
vals = 1 <= arguments.length ? slice.call(arguments, 0) : [];
// Somewhere later...
app.some_function.apply(some_scope, vals);
Using `void 0` instead of `undefined` is a safer since it is a statement (that always returns undefined) and thus cannot be overwritten (undefined can). Discussion here
Scope management for your IFFEs:
// IFFE with:
(function() {}).call(this)
// Instead of
(function() {})()