Skip to content

Commit e7b9ebe

Browse files
authored
Merge pull request #2 from MasuRii/main
feat: Add Complete PDF & Markdown File Format Support with Layout Preservation
2 parents 3ed62ce + 7e6968c commit e7b9ebe

27 files changed

Lines changed: 11596 additions & 47 deletions

.github/workflows/deploy.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# GitHub Actions workflow for deploying React app to GitHub Pages
2+
# Triggers on push to main branch and deploys the build/ folder
3+
# Uses official GitHub Pages actions for secure, reliable deployment
4+
5+
name: Deploy to GitHub Pages
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
# Allow manual trigger from Actions tab
12+
workflow_dispatch:
13+
14+
# Sets permissions for GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# Build job
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: '20'
38+
cache: 'npm'
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
- name: Run tests
44+
run: npm test -- --watchAll=false --passWithNoTests
45+
env:
46+
CI: true
47+
48+
- name: Build application
49+
run: npm run build
50+
env:
51+
CI: true
52+
53+
- name: Setup Pages
54+
uses: actions/configure-pages@v4
55+
56+
- name: Upload artifact
57+
uses: actions/upload-pages-artifact@v3
58+
with:
59+
path: './build'
60+
61+
# Deployment job
62+
deploy:
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
runs-on: ubuntu-latest
67+
needs: build
68+
steps:
69+
- name: Deploy to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1+
# Dependencies
12
node_modules
3+
4+
# Production build output
5+
build
6+
7+
# Environment files
8+
.env
9+
.env.local
10+
.env.development.local
11+
.env.test.local
12+
.env.production.local
13+
14+
# Logs
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
19+
# IDE/Editor
20+
.idea
21+
.vscode
22+
*.swp
23+
*.swo
24+
25+
# OS files
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Test coverage
30+
coverage

README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Live Demo](#live-demo)
1010
- [AI Detection Approach](#ai-detection-approach)
1111
- [Unicode Spacing Technique](#unicode-spacing-technique)
12+
- [PDF Support](#pdf-support)
1213
- [Examples](#examples)
1314
- [Installation and Usage](#installation-and-usage)
1415
- [Contributing](#contributing)
@@ -19,9 +20,11 @@
1920

2021
Zero-ZeroGPT is a demonstration application that showcases how replacing standard spaces with various Unicode space characters can affect the detection of AI-generated text by common AI detection tools like **GPTZero** and **ZeroGPT**. This project looks to explore the limitations of current AI detection methods and promote discussion about more robust processing techniques.
2122

23+
> **Note:** This version is a fork of the original project. It has been enhanced by **MasuRii** to include full **PDF document support**, whereas the original application only supported plain and rich text.
24+
2225
## Live Demo
2326

24-
Experience Zero-ZeroGPT in action: [https://oct4pie.github.io/zero-zerogpt](https://oct4pie.github.io/zero-zerogpt)
27+
Experience Zero-ZeroGPT in action (deployed via GitHub Pages): [https://oct4pie.github.io/zero-zerogpt](https://oct4pie.github.io/zero-zerogpt)
2528

2629
## AI Detection Approach
2730

@@ -39,6 +42,33 @@ AI detection tools generally tokenize text based on standard spaces. By replacin
3942
2. **Statistical Alteration**: The statistical features of the text are changed when spaces are replaced with Unicode spaces, preventing the model from matching the text with its learned patterns.
4043
3. **Pattern Interference**: Unicode spaces can disrupt the detection model's ability to identify typical text patterns.
4144

45+
## PDF Support
46+
47+
Developed by **MasuRii**, this fork introduces robust PDF capabilities to Zero-ZeroGPT. While the original tool was limited to text and rich text inputs, this version allows for full document processing.
48+
49+
Zero-ZeroGPT includes comprehensive PDF processing capabilities, powered by **pdfjs-dist** for extraction and **pdf-lib** for high-fidelity generation.
50+
51+
**Features:**
52+
* **Layout Preservation**: Maintains the original document's structure, including text positioning, columns, and page dimensions.
53+
* **Font Awareness**: Intelligently maps original fonts to standard PDF fonts or compatible fallbacks to preserve the document's visual style.
54+
* **Seamless Transformation**: Apply any Unicode spacing pattern to the text while keeping the document layout intact.
55+
* **Custom Font Embedding**: Includes high-quality Noto Sans embedding for full Unicode support (including special spaces).
56+
* **Column Detection**: Automatically detects and preserves multi-column layouts (2-4 columns) commonly found in research papers and articles.
57+
* **Color Preservation**: Accurately extracts and reproduces text colors from the original document using advanced operator list parsing.
58+
* **Hybrid Generation**:
59+
* **Layout Preserved Mode**: Generates a PDF that mirrors the input (default).
60+
* **Simple Text Mode**: Generates a clean, simple text document (fallback).
61+
62+
**Testing:**
63+
The PDF feature suite is backed by a comprehensive testing strategy with **217 tests** covering all utility functions. To run tests:
64+
```bash
65+
npm test
66+
```
67+
68+
**Limitations:**
69+
* **Text-Based Only**: The feature supports text-based PDFs. Scanned documents or image-only PDFs are not supported (OCR is not implemented).
70+
* **Font Subsetting**: While font families and styles are preserved, exact custom font files are not re-embedded to avoid copyright and size issues; high-quality standard fallbacks are used instead.
71+
4272
## Examples
4373

4474
Here are some visual examples demonstrating the effect of Unicode spacing on AI detection tools:
@@ -79,10 +109,15 @@ Here are some visual examples demonstrating the effect of Unicode spacing on AI
79109

80110
### Usage Instructions
81111

82-
1. Enter your text in the input field.
83-
2. Experiment with different Unicode spaces using the predefined options or create your own combination.
84-
3. Copy the modified text and test it in various AI detection tools.
85-
4. Use the "Clear Text" button to reset the input field.
112+
1. **Select Input Mode**: Choose between "Plain Text", "Rich Text", or "PDF" using the toggle buttons.
113+
2. **Input Content**:
114+
* **Plain/Rich Text**: Enter or paste your text in the input field.
115+
* **PDF**: Click the "PDF" mode button, then drag & drop a file or click to upload.
116+
3. **Apply Spacing**: Experiment with different Unicode spaces using the preview cards or create your own combination.
117+
4. **Export Results**:
118+
* **Copy**: Click the copy icon on any card to copy the modified text.
119+
* **Download (PDF Mode)**: When in PDF mode, click the download icon on any spacing card to generate a new PDF with that specific Unicode spacing applied.
120+
5. Use the "Clear Text" button to reset the application and clear any uploaded files.
86121

87122
## Contributing
88123

0 commit comments

Comments
 (0)