Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Articles plagiarism check implementation #451

Merged
merged 22 commits into from
Oct 11, 2024

Conversation

kol3x
Copy link
Contributor

@kol3x kol3x commented Jun 6, 2024

Closes #424

Hi, I am starting this as draft request for now, because I still need to test the GitHub workflow script properly. I've never worked with one before, so it's ruff. The one I have now is work in progress.

However, the plagiarism-checker service is ready and working. Since Evgeny gave me a hint that this problem has a better solution than just using a paid third-party API, I started researching on how I might implement it otherwise. One old open-source library drew my attention, as it was using google search API to check text for plagiarism in the open web. I found that method better for given problem, but I didn't want to use a library that hasn't been updated for 10+ years, so I developed a little service that uses the same technic.

Additional costs with this method should be 0, since Google lets you make up to 100 queries a day for free. My service is implemented in a way, that it checks every sentence for a 100% match on the internet, while Crypto Attack Wiki article has less than 30 sentences on the average (Rough estimate). And since new articles are released not that often, we can have 2-3 free checks for a new article in a single day.

@kol3x
Copy link
Contributor Author

kol3x commented Jun 11, 2024

I finished and tested the whole thing. These are the end results for different text inputs:
image
image

A little more on the implementation:

  • GitHub Actions workflow finds the first .md file in the PR and sends it to a Cloudflare worker. Then it formats the result to a proper markdown for a GitHub PR comment. Lastly, it posts the results comment. There is one little hack I used here - for line breaks I literally pressed "Enter" in the .yml file, because neither \n or < b r > did the job. (\n didn't do anything at all, and < b r > was creating a new line visually, but was still treating the whole comment as a single line, so for example if I had triple hash for my first line, everything in the comment got treated like a header)

  • Cloudflare worker checks the text one sentence at a time (Anything more than 10 characters and ending with a dot is considered a sentence) Now, this is not a super advanced way for checking plagiarism, but since Evgeny pointed out that we are looking for the simple copy-pasting of text from the open web - it does the job.

I am gonna work on a README later with instructions on setting up the service and adding all necessary secrets

Looking forward to hear some feedback on my implementation!

@kol3x kol3x marked this pull request as ready for review June 11, 2024 13:17
@kol3x
Copy link
Contributor Author

kol3x commented Jun 11, 2024

@Lavriz review this please, whenever you are available

@Lavriz Lavriz self-requested a review June 12, 2024 07:25
Lavriz
Lavriz previously requested changes Jun 12, 2024
tools/plagiarism-checker/src/index.ts Outdated Show resolved Hide resolved
tools/plagiarism-checker/src/index.ts Outdated Show resolved Hide resolved
tools/plagiarism-checker/src/index.ts Outdated Show resolved Hide resolved
@kol3x kol3x requested a review from Lavriz June 12, 2024 11:21
@kol3x
Copy link
Contributor Author

kol3x commented Jun 20, 2024

Hi, @Lavriz

I resolved all the requested changes and added instructions on how to integrate the service and set up corresponding secrets.

Hope to hear back from you soon

@kol3x kol3x marked this pull request as draft July 29, 2024 13:29
@kol3x
Copy link
Contributor Author

kol3x commented Aug 29, 2024

  • Moved formatting logic to javascript, fixed some formatting bugs along the way. The plagiarism result comments are much prettier and consistent now.
  • The service is called by /plagiarismcheck command
  • Added permission check, so only users in WIKI_REVIEWERS secret can call the command

@kol3x kol3x marked this pull request as ready for review August 29, 2024 11:57
@evgenydmitriev evgenydmitriev merged commit e691468 into 1712n:main Oct 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build plagiarism detection bot
3 participants