NonSenseGenerator is a Java/Spring Boot web app built for the Software Engineering course (UniPD). It: analyzes the syntactic structure of a sentence, generates “nonsense” sentences based on templates/verb tenses, and evaluates text toxicity via external services.
- Documentation site: https://liamtoaldo.github.io/NonSenseGenerator/
- Screenshot (toxicity analysis example):
- Syntax analysis
- Enter a sentence and get the visual parse tree (Chart.js).
- Error handling when an external service is unavailable.
- “Nonsense” sentence generation
- Extracts terms from input, reuses saved terms, and generates grammatically valid sentences.
- Choose predefined templates or random; select verb tense (Present/Past/Future).
- Toxicity evaluation
- Analyzes the generated sentence and returns per-category scores (Derogatory, Sexual, Violent, etc.).
- History
- Endpoints to retrieve the history of generated sentences.
- REST API
- Public endpoints for generation, dictionary/templates, toxicity, and history (see Manual/API).
- Modern UI
- Bootstrap 5, jQuery 3, Chart.js and plugins for labels/graphs.
- Backend
- Java 17+ (recommended)
- Spring Boot
- Maven (build/test)
- JUnit 5 + Maven Surefire (test report)
- Useful deps: JSON (org.json 20250517), Dotenv 3.0.0
- Frontend
- Bootstrap 5.3.3
- jQuery 3.7.1
- Chart.js 4.5.0
- Plugins: Chart.js Data Labels 2.2.0, Chart.js Chart Graphs 1.0.1
- Documentation
- MkDocs + ReadTheDocs theme
Repository references:
- UI template: nonsense/src/main/resources/templates/index.html
- UI script: nonsense/src/main/resources/static/js/index.js
- Manual (source): docs/mkdocs/NonSenseGenerator/docs/manual.md
- Surefire test report (local copy): docs/mkdocs/NonSenseGenerator/site/surefire-report/surefire-report.html
Run the project locally.
- Java 17+ (JDK)
- Maven 3.9+
- (Optional/Recommended) Credentials/API keys for external NLP/Moderation services
Note: configuration details are in the Manual.
- Clone the repository:
git clone https://github.com/liamtoaldo/NonSenseGenerator.git cd NonSenseGenerator - Configure environment variables (if you use external services):
- Create a
.envfile in the project root and set the keys required by the NLP/Moderation services. - For exact variable names and requirements, see the Manual:
- Online: https://liamtoaldo.github.io/NonSenseGenerator/manual/
- Local: docs/mkdocs/NonSenseGenerator/site/manual/index.html
- Example (placeholder names, adjust to your setup):
NLP_API_KEY=your_key_here MODERATION_API_KEY=your_key_here
- Create a
- Run the application (recommended):
Or build + run the JAR:
mvn spring-boot:run
mvn clean package java -jar target/*.jar - Open your browser at:
http://localhost:8080
- Enter your sentence in “MY SENTENCE”.
- (Optional) Pick a Template or “Random Template”.
- (Optional) Select the Verb Tense.
- Run the analysis to see the parse tree.
- Generate a “nonsense” sentence in “GENERATED SENTENCE”.
- Run toxicity analysis and inspect per-category scores.
Run tests:
mvn testLocal reports:
- Surefire: docs/mkdocs/NonSenseGenerator/site/surefire-report/surefire-report.html
Example tests:TemplateTest,SentenceGeneratorTest,APIClientTest,VerbTest,ModerationCategoryTest. - Unit Test Report: docs/mkdocs/NonSenseGenerator/site/unit_test_report/index.html
Complete documentation (architecture, design, user stories, system tests, test reports):
- Online: https://liamtoaldo.github.io/NonSenseGenerator/
- Local index: docs/mkdocs/NonSenseGenerator/site/index.html
Useful sections:
- Manual: docs/mkdocs/NonSenseGenerator/site/manual/index.html
- Design Document: docs/mkdocs/NonSenseGenerator/site/design_document/index.html
- User Stories: docs/mkdocs/NonSenseGenerator/site/user_stories/index.html
- System Test Document: docs/mkdocs/NonSenseGenerator/site/system_test_document/index.html
- Test Report (Surefire): docs/mkdocs/NonSenseGenerator/site/surefire-report/surefire-report.html
-
Preview with MkDocs:
pip install mkdocs mkdocs serve -f docs/mkdocs/NonSenseGenerator/mkdocs.yml
Then open http://127.0.0.1:8000/
-
Build static site:
mkdocs build -f docs/mkdocs/NonSenseGenerator/mkdocs.yml -d docs/mkdocs/NonSenseGenerator/site
This project is distributed under the MIT License. See LICENSE.txt for details.
