Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix paramaters #66

Merged
merged 2 commits into from

2 participants

@joscha

JS does not have parameter names - they were probably copied over from the node.js FS documentation unintentionally.

joscha added some commits
@joscha joscha Fix passing the classifier on save
fs.writeFile has only on parameter to callback, which is the error callback (see here: http://nodejs.org/api/fs.html#fs_fs_writefile_filename_data_encoding_callback) - so the written classifier never gets passed back to the given callback.
4f2f498
@joscha joscha remove parameter name 1bd02ef
@chrisumbel chrisumbel merged commit 9f58f20 into NaturalNode:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 18, 2012
  1. @joscha

    Fix passing the classifier on save

    joscha authored
    fs.writeFile has only on parameter to callback, which is the error callback (see here: http://nodejs.org/api/fs.html#fs_fs_writefile_filename_data_encoding_callback) - so the written classifier never gets passed back to the given callback.
  2. @joscha

    remove parameter name

    joscha authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/natural/classifiers/classifier.js
View
9 lib/natural/classifiers/classifier.js
@@ -87,13 +87,18 @@ function restore(classifier, stemmer) {
function save(filename, callback) {
var data = JSON.stringify(this);
var fs = require('fs');
- fs.writeFile(filename, data, encoding='utf8', callback);
+ var classifier = this;
+ fs.writeFile(filename, data, 'utf8', function(err) {
+ if(callback) {
+ callback(err, err ? null : classifier);
+ }
+ });
}
function load(filename, callback) {
var fs = require('fs');
- fs.readFile(filename, encoding='utf8', function(err, data) {
+ fs.readFile(filename, 'utf8', function(err, data) {
var classifier;
if(!err) {
Something went wrong with that request. Please try again.