Skip to content

Instantly share code, notes, and snippets.

@theozaurus
Created May 8, 2013 23:01
Show Gist options
  • Save theozaurus/5544339 to your computer and use it in GitHub Desktop.
Save theozaurus/5544339 to your computer and use it in GitHub Desktop.
var manipulation = (new toHTML()).then(
new Manipulate.HTML.shortenLinks()
).then(
new Manipulate.HTML.toStr()
).end();
Get Text Nodes
Find important Words
Process those Words
// Problems
- Database inaccessible from the Browser when tested
- Configuration options inaccessible from the Browser when tested
var TestDatabase = (function(){
return function(dict){
this.addEntry = function(word,augspell){
dict[word] = augspell;
};
this.getEntry = function(word){
return dict[word];
};
};
}());
var SqlDatabase = (function(){
return function(){
var getConnect = function(){
};
var getFile = function(){
};
this.getEntry = function(word){
getConnect.createStatement('SELECT * ...');
};
};
}());
var database = new TestDatabase(crazyHash);
database.addEntry('foo','f00');
var database = new SqlDatabase();
database.getEntry(word);
// In our specs
var subject;
before(function(){
var database = new TestDatabase();
subject = new WordCutOff({cutoff: 5, database: database})
});
it(function('should only return less common words',function(){
database.addEntry('good', 1);
database.addEntry('bad', 10);
expects(subject.run('good')).toBeNil();
expects(subject.run('bad')).toBeTrue();
});
new WordCutOff({database: new TestDatabase()});
// In our firefox extension
new WordCutOff({database: new SqlDatabase()});
var ok = function(){
var chain = new TextNodes();
var lowerCutoff = document.getElemenyById('db-LowerCutf');
if(lowerCutoff > 0){
chain.nextStep(new WordCutOff({lowercutoff: lowerCutoff}))
}
var wordBased = [''];
var scheme = document.getElementById('scheme');
if(scheme == 'special'){
chain.nextStep(new FunnyFont());
} else {
chain.nextStep(new Phonics());
}
};
var wordDataBase = ....;
var textNodesProcessor = new TextNodes();
var commonWords = new WordCutOff({top: 20000, database: wordDataBase});
textNodesProcessor.nextStep(commonWords)
commonWords.nextStep()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment