{"id":35253620,"url":"https://github.com/starlangsoftware/wordtovec-cpp","last_synced_at":"2026-04-09T04:02:30.851Z","repository":{"id":80489081,"uuid":"171140300","full_name":"StarlangSoftware/WordToVec-CPP","owner":"StarlangSoftware","description":"Word2Vec Library ","archived":false,"fork":false,"pushed_at":"2026-03-15T20:36:59.000Z","size":30568,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-16T08:18:35.997Z","etag":null,"topics":["word2vec","word2vec-algorithm","word2vec-model","wordtovec"],"latest_commit_sha":null,"homepage":"","language":"C++","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/StarlangSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-02-17T15:49:21.000Z","updated_at":"2026-03-15T20:37:03.000Z","dependencies_parsed_at":"2025-01-25T20:32:09.497Z","dependency_job_id":null,"html_url":"https://github.com/StarlangSoftware/WordToVec-CPP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StarlangSoftware/WordToVec-CPP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarlangSoftware%2FWordToVec-CPP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarlangSoftware%2FWordToVec-CPP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarlangSoftware%2FWordToVec-CPP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarlangSoftware%2FWordToVec-CPP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StarlangSoftware","download_url":"https://codeload.github.com/StarlangSoftware/WordToVec-CPP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StarlangSoftware%2FWordToVec-CPP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31584820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"online","status_checked_at":"2026-04-09T02:00:06.848Z","response_time":112,"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":["word2vec","word2vec-algorithm","word2vec-model","wordtovec"],"created_at":"2025-12-30T07:26:46.546Z","updated_at":"2026-04-09T04:02:30.846Z","avatar_url":"https://github.com/StarlangSoftware.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Word Embeddings\n============\n\nDistributed representations (DR) of words (i.e., word embeddings) are used to capture semantic and syntactic regularities of the language by analyzing distributions of word relations within the textual data. Modeling methods generating DRs rely on the assumption that 'words that occur in similar contexts tend to have similar meanings' (distributional hypothesis) which stems from the nature of language itself. Due to their unsupervised nature, these modeling methods do not require any human judgement input to train, which allows researchers to train very large datasets in relatively low costs.\n\nTraditional representations of words (i.e., one-hot vectors) are based on word-word (W x W) co-occurrence sparse matrices where W is the number of distinct words in the corpus. On the other hand, distributed word representations (DRs) (i.e., word embeddings) are word-context (W x C) dense matrices where C \u003c W and C is the number of context dimensions which are determined by underlying model assumptions. Dense representations are arguably better at capturing generalized information and more resistant to overfitting due to context vectors representing shared properties of words. DRs are real valued vectors where each context can be considered as a continuous feature of a word. Due to their ability to represent abstract features of a word, DRs are considered as reusable across higher level tasks in ease, even if they are trained with totally different datasets.\n\nPrediction based DR models gained much attention after Mikolov et al.’s neural network based SkipGram model in 2013. The secret behind the prediction based models is simple: never build a sparse matrix at all. Prediction based models construct dense matrix representations directly instead of reducing sparse ones to dense ones. These models are trained like any other supervised learning task by giving lots of positive and negative samples without adding any human supervision costs. Aim of these models is to maximize the probability of each context c with the same distributional assumptions on word-context co-occurrences, similar to count based models.\n\nSkipGram is a prediction based distributional semantic model (DSM) consisting of a shallow neural network architecture inspired from neural language modeling (LM) intuitions. It is commonly known for its open-source implementation library word2vec. SkipGram acts like a log-linear classifier maximizing the prediction of the surrounding words of a word within a context (center window). Probabilistic word and sentence prediction by local neighbors of a word has been successfully applied on LM tasks under Markov assumption. SkipGram leverages the same idea by considering the words within the window as positive and negative instances and learning weights (for k contexts) which maximizes word predictions. In the training process, each word vector starts as a random vector, and then iteratively shifts to the neighboring vector.\n\nVideo Lectures\n============\n\n[\u003cimg src=https://github.com/StarlangSoftware/WordToVec/blob/master/video1.jpg width=\"50%\"\u003e](https://youtu.be/7zaTW8dH_QMc)[\u003cimg src=https://github.com/StarlangSoftware/WordToVec/blob/master/video2.jpg width=\"50%\"\u003e](https://youtu.be/4YvBJ_p8HRc)[\u003cimg src=https://github.com/StarlangSoftware/WordToVec/blob/master/video3.jpg width=\"50%\"\u003e](https://youtu.be/Hh-MM_rSWeo)\n\nFor Developers\n============\nYou can also see [Java](https://github.com/starlangsoftware/WordToVec), [Python](https://github.com/starlangsoftware/WordToVec-Py), [Cython](https://github.com/starlangsoftware/WordToVec-Cy), [Swift](https://github.com/starlangsoftware/WordToVec-Swift), [C](https://github.com/starlangsoftware/WordToVec-C), \n[Js](https://github.com/starlangsoftware/WordToVec-Js) or [C#](https://github.com/starlangsoftware/WordToVec-CS) repository.\n\n## Requirements\n\n* [C++ Compiler](#cpp)\n* [Git](#git)\n\n\n### CPP\nTo check if you have compatible C++ Compiler installed,\n* Open CLion IDE \n* Preferences \u003eBuild,Execution,Deployment \u003e Toolchain  \n\n### Git\n\nInstall the [latest version of Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).\n\n## Download Code\n\nIn order to work on code, create a fork from GitHub page. \nUse Git for cloning the code to your local or below line for Ubuntu:\n\n\tgit clone \u003cyour-fork-git-link\u003e\n\nA directory called WordToVec-CPP will be created. Or you can use below link for exploring the code:\n\n\tgit clone https://github.com/starlangsoftware/WordToVec-CPP.git\n\n## Open project with CLion IDE\n\nTo import projects from Git with version control:\n\n* Open CLion IDE , select Get From Version Control.\n\n* In the Import window, click URL tab and paste github URL.\n\n* Click open as Project.\n\nResult: The imported project is listed in the Project Explorer view and files are loaded.\n\n\n## Compile\n\n**From IDE**\n\nAfter being done with the downloading and opening project, select **Build Project** option from **Build** menu. After compilation process, user can run TestWordToVec.cpp .\n\nDetailed Description\n============\n\nTo initialize artificial neural network:\n\n\tNeuralNetwork(Corpus corpus, WordToVecParameter parameter)\n\nTo train neural network:\n\n\tVectorizedDictionary train()\n\n# Cite\n\n\t@inproceedings{ercan-yildiz-2018-anlamver,\n    \ttitle = \"{A}nlam{V}er: Semantic Model Evaluation Dataset for {T}urkish - Word Similarity and Relatedness\",\n    \tauthor = {Ercan, G{\\\"o}khan  and\n      \tY{\\i}ld{\\i}z, Olcay Taner},\n    \tbooktitle = \"Proceedings of the 27th International Conference on Computational Linguistics\",\n    \tmonth = aug,\n    \tyear = \"2018\",\n    \taddress = \"Santa Fe, New Mexico, USA\",\n    \tpublisher = \"Association for Computational Linguistics\",\n    \turl = \"https://www.aclweb.org/anthology/C18-1323\",\n    \tpages = \"3819--3836\",\n\t}\n\nFor Contibutors\n============\n\n### Conan Setup\n\n1. First install conan.\n\npip install conan\n\nInstructions are given in the following page:\n\nhttps://docs.conan.io/2/installation.html\n\n2. Add conan remote 'ozyegin' with IP: 104.247.163.162 with the following command:\n\nconan remote add ozyegin http://104.247.163.162:8081/artifactory/api/conan/conan-local --insert\n\n3. Use the comman conan list to check for installed packages. Probably there are no installed packages.\n\nconan list\n\n### conanfile.py file\n\n1. Put the correct dependencies in the requires part\n```\n    requires = [\"math/1.0.0\", \"classification/1.0.0\"]\n```\n\n2. Default settings are:\n```\n    settings = \"os\", \"compiler\", \"build_type\", \"arch\"\n    options = {\"shared\": [True, False], \"fPIC\": [True, False]}\n    default_options = {\"shared\": True, \"fPIC\": True}\n    exports_sources = \"src/*\", \"Test/*\"\n\n    def layout(self):\n        cmake_layout(self, src_folder=\"src\")\n\n    def generate(self):\n        tc = CMakeToolchain(self)\n        tc.generate()\n        deps = CMakeDeps(self)\n        deps.generate()\n\n    def build(self):\n        cmake = CMake(self)\n        cmake.configure()\n        cmake.build()\n\n    def package(self):\n        copy(conanfile=self, keep_path=False, src=join(self.source_folder), dst=join(self.package_folder, \"include\"), pattern=\"*.h\")\n        copy(conanfile=self, keep_path=False, src=self.build_folder, dst=join(self.package_folder, \"lib\"), pattern=\"*.a\")\n        copy(conanfile=self, keep_path=False, src=self.build_folder, dst=join(self.package_folder, \"lib\"), pattern=\"*.so\")\n        copy(conanfile=self, keep_path=False, src=self.build_folder, dst=join(self.package_folder, \"lib\"), pattern=\"*.dylib\")\n        copy(conanfile=self, keep_path=False, src=self.build_folder, dst=join(self.package_folder, \"bin\"), pattern=\"*.dll\")\n\n    def package_info(self):\n        self.cpp_info.libs = [\"ComputationalGraph\"]\n```\n\n### CMakeLists.txt file\n1. Set the C++ standard with compiler flags.\n```\n\tset(CMAKE_CXX_STANDARD 20)\n\tset(CMAKE_CXX_FLAGS \"-O3\")\n```\n2. Dependent packages should be given with find_package.\n```\n\tfind_package(util_c REQUIRED)\n\tfind_package(data_structure_c REQUIRED)\n```\n3. For library part, use add_library and target_link_libraries commands. Use m library for math linker in Linux.\n```\n\tadd_library(Math src/Distribution.cpp src/Distribution.h src/DiscreteDistribution.cpp src/DiscreteDistribution.h src/Vector.cpp src/Vector.h src/Eigenvector.cpp src/Eigenvector.h src/Matrix.cpp src/Matrix.h src/Tensor.cpp src/Tensor.h)\n\ttarget_link_libraries(Math util_c::util_c data_structure_c::data_structure_c m)\n```\n4. For executable tests, use add_executable and target_link_libraries commands. Use m library for math linker in Linux.\n```\n\tadd_executable(DiscreteDistributionTest src/Distribution.cpp src/Distribution.h src/DiscreteDistribution.cpp src/DiscreteDistribution.h src/Vector.cpp src/Vector.h src/Eigenvector.cpp src/Eigenvector.h src/Matrix.cpp src/Matrix.h src/Tensor.cpp src/Tensor.h Test/DiscreteDistributionTest.cpp)\n\ttarget_link_libraries(DiscreteDistributionTest util_c::util_c data_structure_c::data_structure_c m)\n```\n\n### Data files\n1. Add data files to the cmake-build-debug folder.\n\n### C++ files\n\n1. If needed, comparator operators == and \u003c should be implemented for map and set data structures.\n```\n    bool operator==(const Word \u0026anotherWord) const{\n        return (name == anotherWord.name);\n    }\n    bool operator\u003c(const Word \u0026anotherWord) const{\n        return (name \u003c anotherWord.name);\n    }\n```\n2. Do not forget to comment each function.\n```\n\t/**\n \t* A constructor of Word class which gets a String name as an input and assigns to the name variable.\n\t*\n\t* @param _name String input.\n \t*/\n\tWord::Word(const string \u0026_name) {\n```\n3. Function names should follow caml case.\n```\n\tint Word::charCount() const\n```\n4. Write getter and setter methods.\n```\n\tstring Word::getName() const\n\tvoid Word::setName(const string \u0026_name)\n```\n5. Use catch.hpp for testing purposes. Add\n```\n#define CATCH_CONFIG_MAIN  // This tells Catch to provide a main() - only do this in one cpp file\n```\nline in only one of the test files. Add\n```\n#include \"catch.hpp\"\n```\nline in all test files. Example test file is given below:\n```\nTEST_CASE(\"DictionaryTest\") {\n    TxtDictionary lowerCaseDictionary = TxtDictionary(\"lowercase.txt\", \"turkish_misspellings.txt\");\n    TxtDictionary mixedCaseDictionary = TxtDictionary(\"mixedcase.txt\", \"turkish_misspellings.txt\");\n    TxtDictionary dictionary = TxtDictionary();\n    SECTION(\"testSize\"){\n        REQUIRE(29 == lowerCaseDictionary.size());\n        REQUIRE(58 == mixedCaseDictionary.size());\n        REQUIRE(62113 == dictionary.size());\n    }\n    SECTION(\"testGetWord\"){\n        for (int i = 0; i \u003c dictionary.size(); i++){\n            REQUIRE_FALSE(nullptr == dictionary.getWord(i));\n        }\n    }\n    SECTION(\"testLongestWordSize\"){\n        REQUIRE(1 == lowerCaseDictionary.longestWordSize());\n        REQUIRE(1 == mixedCaseDictionary.longestWordSize());\n        REQUIRE(21 == dictionary.longestWordSize());\n    }\n```\n6. Enumerated types should be declared with enum class.\n```\n\tenum class Pos {\n\t\tADJECTIVE,\n\t\tNOUN,\n\t\tVERB,\n\t\tADVERB,\n```\n7. Every header file should start with\n```\n\t#ifndef MATH_DISTRIBUTION_H\n\t#define MATH_DISTRIBUTION_H\n```\nand end with\n```\n\t#endif //MATH_DISTRIBUTION_H\n```\n8. Do not forget to use const expression for parameters, if they will not be changed in the function.\n```\n\tvoid Word::setName(const string \u0026_name);\n```\n9. Do not forget to use const expression for methods, which do not modify any class attribute. Also use [[dodiscard]]\n```\n\t[[nodiscard]] bool isPunctuation() const;\n```\n10. Use xmlparser package for parsing xml files.\n```\n    auto* doc = new XmlDocument(\"test.xml\");\n    doc-\u003eparse();\n    XmlElement* root = doc-\u003egetFirstChild();\n    XmlElement* firstChild = root-\u003egetFirstChild();\n```\n11. Data structures: Use map for hash map, unordered_map for linked hash map, vector for array list, unordered_set for hash set\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstarlangsoftware%2Fwordtovec-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstarlangsoftware%2Fwordtovec-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstarlangsoftware%2Fwordtovec-cpp/lists"}