{"id":16909438,"url":"https://github.com/yjdoc2/plagiarism-detector","last_synced_at":"2026-05-18T11:39:49.678Z","repository":{"id":100667035,"uuid":"298601791","full_name":"YJDoc2/Plagiarism-Detector","owner":"YJDoc2","description":"A simple Plagiarism detector for code, made in C and Rust.","archived":false,"fork":false,"pushed_at":"2020-09-25T14:52:00.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T16:28:41.842Z","etag":null,"topics":["flex","lexer","plagiarism-detector","rust"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YJDoc2.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-25T14:50:42.000Z","updated_at":"2020-12-02T06:40:28.000Z","dependencies_parsed_at":"2023-05-16T16:00:09.927Z","dependency_job_id":null,"html_url":"https://github.com/YJDoc2/Plagiarism-Detector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FPlagiarism-Detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FPlagiarism-Detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FPlagiarism-Detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YJDoc2%2FPlagiarism-Detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YJDoc2","download_url":"https://codeload.github.com/YJDoc2/Plagiarism-Detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244666127,"owners_count":20490281,"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","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":["flex","lexer","plagiarism-detector","rust"],"created_at":"2024-10-13T18:55:48.764Z","updated_at":"2026-05-18T11:39:39.660Z","avatar_url":"https://github.com/YJDoc2.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plagiarism Detector\n\n### Version Alpha\n\nThis is a plagiarism detector for code, which works by first training on sample code, making an index of it in form of trie, and then matching the code to be tested by the values in index\n\n### File Structure :\n```\n.\n├── lexer\n        ├── lexer.l :           flex file for generating lexer\n        └── lexer.c :           lexer generated by flex        \n\n├── src\n        ├── build.rs :          build file for linking the library made by C\n        ├── ffi.rs :            contains the safe wrapper for unsafe FFI  with C\n        ├── main.rs :           main function, train function and eval funtion\n        ├── reference.rs :      contains the struct used to store references\n        └── trie.rs :           contains trie like stuct which is used as index\n\n├── Cargo.toml :                TOML file of cargo config\n├── Cargo.lock :                lockfile generated by Cargo\n├── sample-syntax :             syntax for sample file\n├── makefile :                  used to build C library, build rust library. If changes are made in lexer folder, this should be run\n├── sample_test.txt :           sample data for testing\n├── sample_train.txt :          sample data for training\n├── LICENCE :                   GNU GPL V3 copy\n└── README.md :                 Readme file\n```\n\n### Requirements\nC compiler for compiling generated Lexer. (gcc/clang preferred)\nCargo and Rust for compiling and running Rust\nGNU Make for using makefile\nGNU flex if you want to change the lexer.Then after editing lexer.l file, make must be run.\n\n### Building\nThe compiling of Rust file is taken care of by Cargo. For compiling the C use makefile.\nIn case you don't have flex, remove the first part of statement, and use.\nThe C library must be compiled before running cargo build/run.\n\n### Usage\nIf you are not running with cargo (after generating production binary) replace 'cargo run' by binary name.\n\n* cargo run train input_file_path : trains on the file at input_file_path, and saves the index as index.json in executing folder.\n* cargo run update index_file_path input_file_path : updates the index in file index_file_path by training on file at input_file_path and re-writes the index file.\n* cargo run test index_file_path input_file_path : loads index from index_file_path and tests for matches in file input_file_path\n\n### Working :\n##### Indexing : \nThis parses input token by token, as defined by the lexer in lexer folder, and makes a Trie-like structure, which is of type :\nTrie{\n    token_number -\u003e {\n        set of values encountered for the token,\n        Trie of tokens encountered after this\n        }\n}\n\n##### Testing :\nFor each token, it searches in the index. If found, the next index for searching is set to the Trie of that token, if not, then it just skips tokens until and EOL token is encountered.\nfor each matched token it adds token_score to total, and if the value of token is in the value set of that token in the index, it adds the max score to total as well. The final score is (total score / number of tokens from last EOL to current EOL )* 100 %\n\nAfter scanning all file, it filters the matched tokens , with condition that the score \u003e cutoff score, and the remaining matches are reported, along with % score and the source, in which the line was matched.\n\n\n### Test data file :\nThe file should follow following :\nEach sample should start with :\n-----\u003e START SAMPLE ref : (reference name, website, etc, without space)\ncode\n\n[next sample]\n\na simple sample can be seen in sample_train.txt (for training) and sample_test(for testing).\n\n### TODOs:\nCurrently there is only one lexer for C files, and this has not been tested on real data.\nFine tuning is needed for lexer (Should all keywords be a single type of token, with different values, or each should have a different token) ; metric function used to match the values ; values used for token score and max score etc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjdoc2%2Fplagiarism-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjdoc2%2Fplagiarism-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjdoc2%2Fplagiarism-detector/lists"}