Skip to content

feat: Add keyword argument support for train_from_stream #114

@cardmagic

Description

@cardmagic

Summary

The train_from_stream method currently only accepts positional arguments:

classifier.train_from_stream(:spam, File.open("spam_corpus.txt"))

For API consistency with other methods like train and add, it would be nice to also support keyword arguments:

classifier.train_from_stream(spam: File.open("spam_corpus.txt"))

Affected Classes

  • Classifier::Bayes
  • Classifier::LSI
  • Classifier::KNN
  • Classifier::LogisticRegression

Current Behavior

classifier.train_from_stream(spam: File.open("corpus.txt"))
# => ArgumentError: wrong number of arguments (given 0, expected 2)

Expected Behavior

classifier.train_from_stream(spam: File.open("corpus.txt"))
# => Works, trains the :spam category from the stream

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions