{"id":29215397,"url":"https://github.com/mbejda/nodejs-stanford-classifier","last_synced_at":"2025-08-25T03:39:13.868Z","repository":{"id":54523096,"uuid":"44381551","full_name":"mbejda/Nodejs-Stanford-Classifier","owner":"mbejda","description":"Nodejs wrapper for Stanford Classifier. ","archived":false,"fork":false,"pushed_at":"2021-02-13T03:26:20.000Z","size":13181,"stargazers_count":47,"open_issues_count":3,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-18T15:17:41.893Z","etag":null,"topics":["classifier","nlp","nodejs","stanford-classifier"],"latest_commit_sha":null,"homepage":"http://nlp.stanford.edu/software/classifier.shtml","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbejda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-16T11:47:19.000Z","updated_at":"2024-05-10T10:27:20.000Z","dependencies_parsed_at":"2022-08-13T18:31:22.083Z","dependency_job_id":null,"html_url":"https://github.com/mbejda/Nodejs-Stanford-Classifier","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mbejda/Nodejs-Stanford-Classifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2FNodejs-Stanford-Classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2FNodejs-Stanford-Classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2FNodejs-Stanford-Classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2FNodejs-Stanford-Classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbejda","download_url":"https://codeload.github.com/mbejda/Nodejs-Stanford-Classifier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbejda%2FNodejs-Stanford-Classifier/sbom","scorecard":{"id":630864,"data":{"date":"2025-08-11","repo":{"name":"github.com/mbejda/Nodejs-Stanford-Classifier","commit":"6bfb05a439a7802b2f29fd49efdf291f1af5aafb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":7,"reason":"binaries present in source code","details":["Warn: binary detected: classifier/slf4j-api.jar:1","Warn: binary detected: classifier/slf4j-simple.jar:1","Warn: binary detected: classifier/stanford-classifier.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":3,"reason":"Found 3/10 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T07:52:40.105Z","repository_id":54523096,"created_at":"2025-08-21T07:52:40.105Z","updated_at":"2025-08-21T07:52:40.105Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272004021,"owners_count":24856849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classifier","nlp","nodejs","stanford-classifier"],"created_at":"2025-07-03T00:09:38.056Z","updated_at":"2025-08-25T03:39:13.818Z","avatar_url":"https://github.com/mbejda.png","language":"JavaScript","readme":"# Major Updates :\n## Available Methods :\n```\nstanfordClassifier.train(string)\n\nstanfordClassifier.trainAll(array)\n\nstanfordClassifier.syncClassifier()\n\nstanfordClassifier.getDataArray()\n\nstanfordClassifier.getValuesArray()\n\nstanfordClassifier.getFeatureCounts()\n\nstanfordClassifier.getLabelsArray()\n\nstanfordClassifier.getLabelsArray()\n\nstanfordClassifier.trimData()\n\nstanfordClassifier.trimLabels()\n\nstanfordClassifier.trimToSize(int)\n\nstanfordClassifier.numClass()\n\nstanfordClassifier.numDatumsPerLabel()\n\nstanfordClassifier.numFeatures()\n\nstanfordClassifier.numFeatureTokens()\n\nstanfordClassifier.numFeatureTypes()\n\nstanfordClassifier.printSparseFeatureMatrix()\n\nstanfordClassifier.printSVMLightFormat()\n\nstanfordClassifier.randomize(int)\n\nstanfordClassifier.size()\n\nstanfordClassifier.summaryStatistics()\n\n```\n\n\n## Getting Started\nInstall the `stanford-classifier` Node.js module from the npm repository. The `stanford-classifier` Node.js module uses **Stanford Classifier v3.5.2** internally and has `node-java` as a dependency. Your environment should have Java properly configured to work with `node-java`. You can learn more about `node-java` configurations [here](https://github.com/joeferner/node-java). To install the `stanford-classifier` run the following in the terminal:\n```\nnpm install stanford-classifier --save\n```\nThe module will appear in the projects root node_modules directory. The Node.js module can be viewed in the npm repository https://www.npmjs.com/package/stanford-classifier.\n\n## Dataset\nThe classifier needs to be trained with pre-trained data. Without trained data, the classifier will not work as expected and will not be accurate. Regardless of which classification algorithm is being used, the classifier needs a robust dataset to yield accurate classifications. I built a small dataset that contains organization and band Twitter descriptions. The dataset can be used to train the `stanford-classifier`. It can be downloaded [here](https://gist.github.com/mbejda/e57d29c887cbda0b5a8f#file-band-or-organization).\n\n## Training And Classifying The Classifier\nThe `train()` method is used to train the `stanford-classifier` with a pre-trained dataset. Here is an example of how to use the `train()` method to train the `stanford-classifier`.\n\n*Example :*\n```js\n/// Dependencies\nvar stanfordClassifier = require('stanford-classifier');\nvar byline = require('byline');\nvar fs = require('fs');\n\n/// Initialize the Stanford Classifier\nvar sc = new stanfordClassifier();\n\n\nvar mem = [];\n\n/// Create a stream to read the dataset\nvar stream = byline(fs.createReadStream('dataset.txt', {\n    encoding: 'utf8'\n}));\n\n/// Push each line into memory\nstream.on('data', function(line) {\n    mem.push(line);\n});\n\n/// Use the training dataset in memory to train the classifier dataset\nstream.on('end', function() {\n    for (var i = 0; i \u003c mem.length; i++) {\n        var line = mem[i];\n        sc.train(line);\n    }\n\n/// Sync the classifier with the classifiers dataset\n    sc.syncClassifier();\n  \n/// Use the classifier\n  console.log(sc.classify('Our Twitter run by the band and crew to give you an inside look into our lives on the road'));\n/// BAND\n});\n```\nAfter the classifier has been trained use the `syncClassifier()` method to sync the trained dataset with the classifier.\n\n\n## Customizing The Classifier\nOptions can be sent directly to the classifier when initializing the `stanford-classifier` instance. \n```\nvar sc = new stanfordClassifier(options);\n```\nThe options can either be a path to a property file or an object. The default options are the following :\n```\n#\n# Features\n#\nuseClassFeature=true\n1.useNGrams=true\n1.usePrefixSuffixNGrams=true\n1.maxNGramLeng=4\n1.minNGramLeng=1\n1.binnedLengths=10,20,30\n#\n# Printing\n#\n# printClassifier=HighWeight\nprintClassifierParam=200\n#\n# Mapping\n#\ngoldAnswerColumn=0\ndisplayedColumn=1\n#\n# Optimization\n#\nintern=true\nsigma=3\nuseQN=true\nQNsize=15\ntolerance=1e-4\n\n```\n\nother options that can be used are [here](http://nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/classify/ColumnDataClassifier.html \"stanford classifer\").\n\n\n## Resources\n**NPM Repository :**\u003cbr\u003e\n[https://www.npmjs.com/package/stanford-classifier](https://www.npmjs.com/package/stanford-classifier)\n\u003cbr\u003e\n**Github Repository:**\u003cbr\u003e\n[https://github.com/mbejda/Nodejs-Stanford-Classifier](https://github.com/mbejda/Nodejs-Stanford-Classifier)\u003cbr\u003e\n**Dataset:**\u003cbr\u003e\n[https://gist.github.com/mbejda/e57d29c887cbda0b5a8f#file-band-or-organization](https://gist.github.com/mbejda/e57d29c887cbda0b5a8f#file-band-or-organization)\u003cbr\u003e\n\n**Blog:**\u003cbr\u003e\n[http://www.mbejda.com/using-the-stanford-classifier-with-node/](http://www.mbejda.com/using-the-stanford-classifier-with-node/)\n\n\nIf you need any help, send me a tweet on twitter\n[@notmilobejda](https://twitter.com/notmilobejda).\n\n[![NPM](https://nodei.co/npm/stanford-classifier.png)](https://www.npmjs.com/package/stanford-classifier)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbejda%2Fnodejs-stanford-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbejda%2Fnodejs-stanford-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbejda%2Fnodejs-stanford-classifier/lists"}