Skip to main content

Dupecheck

Analyze your generated text for plagiarizing your dataset

Use this to prevent "Thomas Riker" situations, when generating text with machine learning systems.

At Eclectic Beams, when generating stories from finetuned GPT-2 models, I kept finding nice stories, but whole segments of them were just copied verbatim from the dataset text. I started battling this by using my editor's "find" feature on each line of generated text, or random subsequences against the dataset. It was time-consuming, and caused much eye pain and frustration, each time I'd read a story I liked, only to find out it had large sections copied verbatim.

Time to automate the tedious away.

Dupecheck will search for substrings of given length in a larger text dataset for you. Use this to validate uniqueness before saving generated text, and you'll save yourself a huge headache.

It compares word series without punctuation.

pip install dupecheck
from dupecheck import chunks, sliding_window, sliding_window2

Chunking method

Find word series at least 5 words long in dataset. (Prone to mid-pattern window-splitting false negatives, since the window doesn't slide. Your pattern might get cut and split between two chunks, then not found even if it should match)

duplicates = chunks.dupecheck(
              min=5,
              max=10, 
              text=my_gen_text, 
              dataset=my_dataset, 
              verbose=False
            )

Sliding window find, try 1

  • find word series at least 5 words long of your text string in dataset string
duplicates = sliding_window.dupecheck(
              min=5, 
              max=10, 
              text=my_gen_text, 
              dataset=my_dataset,
            )

Sliding window find try 2

  • find word series at least 5 words long of your text string in dataset string.
  • cleans text and dataset for you if you don't provide cleaned and specify cleaned=True.
  • Cleaning is currently VERY slow.
duplicates = sliding_window2.dupecheck(
              min=5, 
              max=10, 
              text=my_gen_text, 
              dataset=my_dataset,
              cleaned=False,
              verbose=False
            )

Preprocessing helpers

from dupecheck.preprocess import pre_process_text

dataset = pre_process_text(dataset)
text = pre_process_text(text)

Metadata

Release files for dupecheck 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dupecheck 0.7.1
File Size Uploaded Provenance Actions
dupecheck-0.7.1.tar.gz 9.2 kB Without provenance Details for dupecheck-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dupecheck 0.7.1
File Interpreter ABI Platform Actions
dupecheck-0.7.1-py3-none-any.whl Python 3 none any Details for dupecheck-0.7.1-py3-none-any.whl

Total release size: 19.3 kB

Release files / dupecheck-0.7.1.tar.gz

Download URL dupecheck-0.7.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
07cf90005b87d76dd1d827f306d9d6e40df4131026f1dca1237d738e58dfb448
BLAKE2b-256 checksum
How to use checksums
f78db647b97b4c7ffae731e53535ed1802a154d4cb13ba7aeb320732dd3111c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Release files / dupecheck-0.7.1-py3-none-any.whl

Download URL dupecheck-0.7.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96a196de60c343e998426645858efe29f97612ec9329255241f6eb091a585162
BLAKE2b-256 checksum
How to use checksums
568c5af92a372c0ab11706ccb3015ccd4adb3edafcd6678b66344ee73780d1a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Security for dupecheck 0.7.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page