Skip to content

Commit

Permalink
reduce word list length and commit ./db
Browse files Browse the repository at this point in the history
  • Loading branch information
nkamc committed Jul 15, 2014
1 parent 64d4616 commit 9ac0ffa
Show file tree
Hide file tree
Showing 9 changed files with 235,898 additions and 5 deletions.
Binary file added db/000005.ldb
Binary file not shown.
1 change: 1 addition & 0 deletions db/CURRENT
@@ -0,0 +1 @@
MANIFEST-000004
Empty file added db/LOCK
Empty file.
5 changes: 5 additions & 0 deletions db/LOG
@@ -0,0 +1,5 @@
2014/07/15-12:35:52.163580 103a08000 Recovering log #3
2014/07/15-12:35:52.335117 103a08000 Level-0 table #5: started
2014/07/15-12:35:52.448477 103a08000 Level-0 table #5: 2763638 bytes OK
2014/07/15-12:35:52.452563 103a08000 Delete type=0 #3
2014/07/15-12:35:52.452980 103a08000 Delete type=3 #2
1 change: 1 addition & 0 deletions db/LOG.old
@@ -0,0 +1 @@
2014/07/15-12:35:46.040864 103a0a000 Delete type=3 #1
Binary file added db/MANIFEST-000004
Binary file not shown.
6 changes: 3 additions & 3 deletions index.js
@@ -1,7 +1,7 @@
var ac = {};
var fs = require('fs');
var level = require('level');
var db = level(__dirname + '/autocomplete');
var db = level(__dirname + '/db');

ac.auto = function() {
return 'autoc...';
Expand All @@ -10,7 +10,7 @@ ac.auto = function() {
// Import the list of words from words.txt into LevelDB
ac.import = function(callback) {
// read file and split into an array of lines
var lines = fs.readFileSync(__dirname + '/words.txt', 'utf8')
var lines = fs.readFileSync(__dirname + '/words2.txt', 'utf8')
.split('\n');

// uses batch chained: https://github.com/rvagg/node-levelup#batch_chained
Expand All @@ -32,7 +32,7 @@ ac.count = function (callback) {
count++;
})
.on('end', function(){
console.log(' - - - -',count);
// console.log(' - - - -',count);
callback(null, count);
}); // no error handling is *deliberate*
};
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Expand Up @@ -12,8 +12,8 @@ describe('Word List DB Import', function() {

ac.import(function(err, words){
ac.count(function(err,count){
count.should.equal(354983); // 354983
console.log(' - - - -',count);
count.should.equal(235886); // 354983
console.log(' ---> WordCount:',count);
done();
});
});
Expand Down

0 comments on commit 9ac0ffa

Please sign in to comment.