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
/** | |
* Computes the measure of an English word as defined for the Porter algorithm. | |
* The definition of the measure can be found here: | |
* http://snowball.tartarus.org/algorithms/porter/stemmer.html | |
* | |
* ...but it's overtly complicated. Here's my definition: | |
* | |
* The *measure* of a word is the number of vowels followed by a consonant. | |
* | |
* Examples: |
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
///////////////////////// | |
// stemmer.hh // | |
///////////////////////// | |
#pragma once | |
#include <iostream> | |
#include <string> | |
/** |
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
/* | |
phdp@dell-xps:~$ vim main.cc | |
phdp@dell-xps:~$ clang++ -std=c++11 main.cc -o main | |
phdp@dell-xps:~$ time ./main | |
The seed is 1375464851 | |
3.14157 | |
real 0m27.375s | |
user 0m27.308s | |
sys 0m0.004s |
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
double sum_d(const double *x, size_t length) { | |
double sum = 0.0; | |
for (size_t i = 0; i < length; ++i) { | |
sum += x[i]; | |
} | |
return sum; | |
} | |
double srtsum_d(const double *x, size_t length) { | |
// Copy the array & sort it with quicksort. |
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
namespace Utils | |
{ | |
class Well | |
{ | |
private uint seed; | |
private uint state_n; | |
private uint[] state; | |
private uint mat3pos(int t, uint v) | |
{ |
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
{ | |
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme", | |
"font_face": "Ubuntu Mono", | |
"font_size": 16, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true | |
} |
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
;;;;;;;;;;;;; | |
; Chapter 2 ; | |
;;;;;;;;;;;;; | |
(defun en-sentence () | |
"An English sentence." | |
(append (en-noun-phrase) (en-verb-phrase))) | |
(defun en-noun-phrase () | |
"An English noun-phrase." |
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
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "Scriptoria object", | |
"description": "Meta-data about a publication registered in scriptoria", | |
"type": "object", | |
"properties": { | |
"source": { | |
"description": "URL of the original repository", | |
"type": "string" | |
}, |
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
{ | |
"Title": "Flags", | |
"URL": "http://orange.biolab.si/datasets.psp", | |
"Variables": ["Landmass", "Zone", "Area", "Population", "Language", "Religion", "Bars", "Stripes", "Colors", "Red", "Green", "Blue", "Gold", "White", "Black", "Orange", "MainHue", "Circles", "Crosses", "Saltires", "Quarters", "Sunstars", "Crescent", "Triangle", "Icon", "Animate", "Text", "TopLeft", "BotRight"], | |
"Records name": ["Afghanistan", "Albania", "Algeria", "American-Samoa", "Andorra", "Angola", "Anguilla", "Antigua-Barbuda", "Argentina", "Argentine", "Australia", "Austria", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Botswana", "Brazil", "British-Virgin-Isles", "Brunei", "Bulgaria", "Burkina", "Burma", "Burundi", "Cameroon", "Canada", "Cape-Verde-Islands", "Cayman-Islands", "Central-African-Republic", "Chad", "Chile", "China", "Colombia", "Comorro-Islands", "Congo", "Cook-Islands", "Costa-Rica", "Cuba", "Cyprus", "Czechoslovakia", "Denmark", "Djibouti", "Dominic |
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
{ | |
"Title": "Flags", | |
"URL": "http://orange.biolab.si/datasets.psp", | |
"Variables": ["Landmass", "Zone", "Area", "Population", "Language", "Religion"], | |
"Records name": ["Afghanistan", "Albania", "Algeria", "American-Samoa", "Andorra"], | |
"Data": [ | |
[5,1, 648,16,10,2], | |
[3,1, 29, 3, 6,6], | |
[4,1,2388,20, 8,2], | |
[6,3, 0, 0, 1,1], |