Skip to content

Commit

Permalink
Remove legacy code that uses prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo-ter-Doest committed Mar 1, 2024
1 parent 4e33992 commit 6b69b9d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions examples/classification/try_events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var natural = require('../../lib/natural');
const PorterStemmerEs = require('../../lib/natural/stemmers/porter_stemmer_es');
var classifier = new natural.LogisticRegressionClassifier(PorterStemmerEs);

classifier.addDocument('ranchero golpe', 'Huevos');
classifier.addDocument('bbq', 'Huevos');
classifier.addDocument('salchichas ranchero', 'Tortas');

classifier.on('trainedWithDocument', (v) => console.log(v))
classifier.on('doneTraining', (v) => console.log(v))
classifier.train();

classifier.save('classifier.json', (err) => console.log(err))
1 change: 0 additions & 1 deletion lib/natural/classifiers/classifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ THE SOFTWARE.
'use strict'

const EventEmitter = require('events')

const PorterStemmer = require('../stemmers/porter_stemmer')
const parallelTrainer = require('./classifier_train_parallel')

Expand Down
2 changes: 1 addition & 1 deletion lib/natural/classifiers/logistic_regression_classifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class LogisticRegressionClassifier extends Classifier {
// needs its matricies to have their widths synced, etc.
this.lastAdded = 0
this.classifier = new ApparatusLogisticRegressionClassifier()
Classifier.prototype.train.call(this)
super.train()
}
}

Expand Down

0 comments on commit 6b69b9d

Please sign in to comment.