{"id":20114689,"url":"https://github.com/gatenlp/weka-wrapper","last_synced_at":"2026-05-31T21:31:52.123Z","repository":{"id":141229786,"uuid":"59678691","full_name":"GateNLP/weka-wrapper","owner":"GateNLP","description":"A very lightweight wrapper around Weka","archived":false,"fork":false,"pushed_at":"2017-06-23T11:48:51.000Z","size":115,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-09T19:52:07.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GateNLP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-25T16:17:06.000Z","updated_at":"2018-11-20T09:32:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a286029-e38a-4278-9241-ee4b3f29fdbd","html_url":"https://github.com/GateNLP/weka-wrapper","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/GateNLP/weka-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2Fweka-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2Fweka-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2Fweka-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2Fweka-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GateNLP","download_url":"https://codeload.github.com/GateNLP/weka-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2Fweka-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33750474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"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":[],"created_at":"2024-11-13T18:31:22.014Z","updated_at":"2026-05-31T21:31:52.107Z","avatar_url":"https://github.com/GateNLP.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# weka-wrapper\n\nA minimal wrapper around Weka for easy invocation of Weka by other Java processes.\n\nThe primary purpose of this is to be able to run a process from the command line which will accept\nunclassified instances from a different process, apply a classifier, and send back the\nprediction. For efficiency, ObjectInput/Output streams are used for the communcation.\n\nThis makes it possible to invoke Weka and use a separately trained Weka model in the\n[GATE LearningFramework plugin](https://github.com/GateNLP/gateplugin-LearningFramework) (Weka cannot be directly used with this plugin because\nthere is no way to combine the licenses of all dependencies together with Weka.)\n\nFor instructions about how to use weka-wrapper from the GATE LearningFramework plugin, see [Using Weka](https://github.com/GateNLP/gateplugin-LearningFramework/wiki/UsingWeka)\n\n## Installation\n\nThere are two possible ways of how to install weka-wrapper:\n\n* Download one of the release archives and expand, optionally put the bin subdirectory of the unpacked archive on the bin path.\n\nor\n\n* To install by cloning the GitHub repository, first clone the repository, then run the\nfollowing commands:\n````\nmvn clean\nmvn dependency:copy-dependencies\nmvn install\n````\n\n## Applying a model to individual instances\n\nThis is done by starting the weka-wrapper with the command:\n````\n./bin/wekaWrapperApply.sh \u003cmodelFile\u003e \u003carffHeaderFile\u003e\n````\nWhere `modelFile` is the full path of the model saved by Weka and `arffHeaderFile` is an ARFF file that contains the attribute definitions but no data rows.\n\nAfter the program is started that way it expects to communicate with the invoking process using the protocol defined in the [gatelib-interaction](https://github.com/GateNLP/gatelib-interaction) library as defined in the `Process4ObjectStream` class:\n1. Send a \"hello string\"\n2. Read the hello string from the weka wrapper\n3. Send an `SparseDoubleVector` object\n4. Retrieve an `double[]` object (the probabilities for each lable for classifiers, or a single element, the target value for regression models)\n5. Repeate steps 3 and 4 as often as needed\n6. Send the string \"STOP\" to terminate the weka wrapper process\n\n## Training a model from an ARFF file\n\nThis is done by running the folowing command:\n````\n./bin/wekaWrapperTrain.sh \u003carffFile\u003e \u003cmodelFile\u003e \u003cjavaClass\u003e [\u003cparm1\u003e \u003cparm2\u003e ...]\n````\nWhere `arffFile` is the full path to an ARFF file containing the data to train from, the `modelFile` is the full path to the file where the model should be saved, and `javaClass` is the full class of the Weka classifier to use for training. All remaining arguments are interpreted as parameters for the weka algorithm and passed on to it. \n\n## Starting the server\n\nThis is done by running the following command:\n````\n./bin/wekaWrapperServer.sh \u003cmodelFile\u003e \u003carffHeaderFile\u003e \u003cportnumber\u003e \u003cnrThreads\u003e\n````\n\nThis will create a server endpoint at http://127.0.0.1:\u003cportnumber\u003e which accepts \nPOST requests of the following form:\n* content type must be `application/json`\n* accept must be `application/json`\n* body must be a JSON string that represents an array of sparse double vectors in the following way:\n  * element \"indices\" is a vector of integer vectors, where each inner integer vector gives the indices/dimension numbers of the corresponding values\n  * element \"values\" is a vector of double vectors, where each inner double is the value at the corresponding dimension\n  * weights is a vector of double values where each value is the weight of the corresponding instance\n\nThe server will send back a JSON string of the following form\n* element \"preds\" which is a vector of double vectors, each inner vector corresponds to the prediction for each of the instances sent to the server. The inner vector is either of length 1, then it contains the prediction (e.g. for regression) or of length greater than 1, then it contains the probabilities for each class for classification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgatenlp%2Fweka-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgatenlp%2Fweka-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgatenlp%2Fweka-wrapper/lists"}