nal060/text-detox

Text detoxification tool that filters out harmful or toxic content from text inputs.

0

stars

50

commits

Python

primary language

May 27, 2025

updated

README

Project Overview

Project Title: Text Detox

This project aims to develop a text detoxification tool that filters out harmful or toxic content from text inputs. The goal is to create a user-friendly application that can be integrated into various platforms to improve online communication.

Repository Structure

The structure of this repository is as follows:

COLX_531_TextDetox/
├── README.md
├── TextDetox_final_report.pdf
├── evaluation_script/
│   └── evaluate.py
├── milestone1/
│   ├── data_inspection.md
│   ├── img/
│   │   └── dataset_statistics.png
│   ├── milestone1.md
│   ├── progress_report.pdf
│   ├── proof_of_project_registration.pdf
│   └── teamwork_contract.md
├── milestone2/
│   ├── baseline/
│   │   ├── backtranslation_baseline.py
│   │   ├── Dockerfile
│   │   ├── en_baseline_input.jsonl
│   │   ├── predictions.jsonl
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   └── run.sh
│   ├── llm_model/
│   │   ├── gold_extraction.py
│   │   ├── llm_model.py
│   │   └── wandb_log.py
│   └── progress_report_milestone2.pdf
├── milestone3/
│   └── progress_report_milestone3.pdf
├── milestone4/
│   ├── detoxification_input.jsonl
│   ├── finetuned_baseline.py
│   ├── golden_references.jsonl
│   ├── metrics.jsonl
│   ├── output.jsonl
│   ├── progress_report_milestone4.pdf
│   ├── README.md
│   └── wandb_log.py
├── milestone5/
│   ├── data/
│   │   ├── data_extraction.py
│   │   ├── golden_am.jsonl
│   │   ├── golden_en.jsonl
│   │   ├── golden_ru.jsonl
│   │   ├── input_am.jsonl
│   │   ├── input_en.jsonl
│   │   ├── input_ru.jsonl
│   │   ├── output_am.jsonl
│   │   ├── output_en.jsonl
│   │   └── output_ru.jsonl
│   ├── evaluation/
│   │   ├── evaluate.py
│   │   ├── evaluate_am.txt
│   │   ├── evaluate_en.txt
│   │   └── evaluate_ru.txt
│   ├── new_model.py
│   └── progress_report_milestone5.pdf
├── milestone6/
│   ├── data/
│   │   ├── am/
│   │   │   ├── output_am.txt
│   │   │   ├── test_am.jsonl
│   │   │   └── test_output_am.jsonl
│   │   ├── en/
│   │   │   ├── output_en.txt
│   │   │   ├── test_en.jsonl
│   │   │   └── test_output_en.jsonl
│   │   ├── fr/
│   │   │   ├── output_fr.txt
│   │   │   ├── test_fr.jsonl
│   │   │   └── test_output_fr.jsonl
│   │   ├── hin/
│   │   │   ├── output_hin.txt
│   │   │   └── test_hin.jsonl
│   │   ├── ru/
│   │   │   ├── output_ru.txt
│   │   │   ├── test_ru.jsonl
│   │   │   └── test_output_ru.jsonl
│   │   ├── zh/
│   │   │   ├── output_zh.txt
│   │   │   ├── test_zh.jsonl
│   │   │   └── test_output_zh.jsonl
│   │   └── data_extraction.py
│   ├── src/
│   │   ├── evaluate.py
│   │   ├── model_main.py
│   │   ├── train_classifier.py
│   │   ├── train_detox.py
│   │   └── wandb_log.py
│   └── progress_report_milestone6.pdf
├── src/
│   ├── data_inspection.ipynb
│   └── data_loader.py

Milestone 1 Overview

Milestone 1 focuses on the initial setup of the project, including the following key components:

  • Progress Report: Documents the work completed during this milestone.
  • Proof of Registration: Provides documentation of project registration.
  • Teamwork Contract: Outlines team roles and responsibilities.
  • Milestone Overview: Summarizes the objectives and outcomes for this milestone.

Milestone 1 Contents

Milestone 2 Overview

Milestone 2 focuses on the development of the baseline and LLM models for text detoxification. Key components include:

  • Baseline Model: Implementation of a backtranslation baseline approach.
  • LLM Model: Development of a large language model for better detoxification results.

Milestone 2 Contents

  • Baseline Directory: Contains files related to the baseline model.

  • LLM Model Directory: Contains files related to the LLM model.

    • LLM Model Implementation: llm_model.py - Script for the LLM model implementation.
    • Gold Extraction: gold_extraction.py - Script for extracting gold standard data.
    • WandB Logging: wandb_log.py - Script for logging experiments with Weights & Biases.

Milestone 3 Overview

Milestone 3 focuses on reflections on the previous milestones.

Milestone 3 Contents


Milestone 4 Overview

Milestone 4 focuses on our second model, including model improvements, evaluation outputs, results comparison and error analysis.

Milestone 4 Contents

  • Milestone Overview: README.md - Summary of the final milestone objectives and outcomes.
  • Progress Report: progress_report_milestone4.pdf - A detailed report on the development system, model description, results and error analysis.
  • Fine-Tuned Model: finetuned_baseline.py - Implementation of the fine-tuned baseline model.
  • Evaluation Metrics: metrics.jsonl - JSON file containing evaluation results and performance metrics.
  • Detoxification Input: detoxification_input.jsonl - Input data used for the detoxification model.
  • Golden References: golden_references.jsonl - Reference outputs for evaluating model performance.
  • Model Outputs: output.jsonl - Outputs generated by the fine-tuned model.
  • Logging and Tracking: wandb_log.py - Logging script for tracking experiments and results using Weights & Biases.

Milestone 5 Overview

Milestone 5 centers on the development and evaluation of our third model, incorporating multilingual capabilities and refined detoxification logic. This milestone includes the implementation of a new model, testing across English, Russian, and Amharic datasets, and a comprehensive analysis of results.

Milestone 5 Contents

  • Progress Report: progress_report_milestone5.pdf - A detailed report covering the development process, model description, results, error analysis, and reflections on planning improvements.
  • New Model Implementation: new_model.py - The script implementing the new detoxification model designed for this milestone.
  • Data Directory:
  • Evaluation Directory:
    • Evaluation Script: evaluate.py - Script for evaluating model performance across datasets.
    • Evaluation Results:
      • evaluate_en.txt - Evaluation metrics and analysis for the English dataset.
      • evaluate_ru.txt - Evaluation metrics and analysis for the Russian dataset.
      • evaluate_am.txt - Evaluation metrics and analysis for the Amharic dataset.

Milestone 6 Overview

Milestone 6 focuses on finalizing the detoxification pipeline with multilingual support and model evaluation across six languages: English, Amharic, Russian, Hindi, French, and Chinese. This milestone includes refined data processing, model evaluation, and comparison of outputs across languages.

Milestone 6 Contents


Milestone 7 Overview

Milestone 7 focuses on working with the final report and the presentation slides. This milestone works on generating final report for this entire project and includes the entire process of the model evolution and final result.

Milestone 7 Contents


Code Location

The required code for this project can be found in the following directories:

  • src: Contains the source code files related to data inspection.
  • evaluation_script: Directory for evaluation scripts (currently empty, official evaluation method to be announced).

Contributors

lushaw14

30 commits

ylmmgit

16 commits

nal060

4 commits

nal060/text-detox

Text detoxification tool that filters out harmful or toxic content from text inputs.

0

stars

50

commits

Python

primary language

May 27, 2025

updated

README

Project Overview

Project Title: Text Detox

This project aims to develop a text detoxification tool that filters out harmful or toxic content from text inputs. The goal is to create a user-friendly application that can be integrated into various platforms to improve online communication.

Repository Structure

The structure of this repository is as follows:

COLX_531_TextDetox/
├── README.md
├── TextDetox_final_report.pdf
├── evaluation_script/
│   └── evaluate.py
├── milestone1/
│   ├── data_inspection.md
│   ├── img/
│   │   └── dataset_statistics.png
│   ├── milestone1.md
│   ├── progress_report.pdf
│   ├── proof_of_project_registration.pdf
│   └── teamwork_contract.md
├── milestone2/
│   ├── baseline/
│   │   ├── backtranslation_baseline.py
│   │   ├── Dockerfile
│   │   ├── en_baseline_input.jsonl
│   │   ├── predictions.jsonl
│   │   ├── README.md
│   │   ├── requirements.txt
│   │   └── run.sh
│   ├── llm_model/
│   │   ├── gold_extraction.py
│   │   ├── llm_model.py
│   │   └── wandb_log.py
│   └── progress_report_milestone2.pdf
├── milestone3/
│   └── progress_report_milestone3.pdf
├── milestone4/
│   ├── detoxification_input.jsonl
│   ├── finetuned_baseline.py
│   ├── golden_references.jsonl
│   ├── metrics.jsonl
│   ├── output.jsonl
│   ├── progress_report_milestone4.pdf
│   ├── README.md
│   └── wandb_log.py
├── milestone5/
│   ├── data/
│   │   ├── data_extraction.py
│   │   ├── golden_am.jsonl
│   │   ├── golden_en.jsonl
│   │   ├── golden_ru.jsonl
│   │   ├── input_am.jsonl
│   │   ├── input_en.jsonl
│   │   ├── input_ru.jsonl
│   │   ├── output_am.jsonl
│   │   ├── output_en.jsonl
│   │   └── output_ru.jsonl
│   ├── evaluation/
│   │   ├── evaluate.py
│   │   ├── evaluate_am.txt
│   │   ├── evaluate_en.txt
│   │   └── evaluate_ru.txt
│   ├── new_model.py
│   └── progress_report_milestone5.pdf
├── milestone6/
│   ├── data/
│   │   ├── am/
│   │   │   ├── output_am.txt
│   │   │   ├── test_am.jsonl
│   │   │   └── test_output_am.jsonl
│   │   ├── en/
│   │   │   ├── output_en.txt
│   │   │   ├── test_en.jsonl
│   │   │   └── test_output_en.jsonl
│   │   ├── fr/
│   │   │   ├── output_fr.txt
│   │   │   ├── test_fr.jsonl
│   │   │   └── test_output_fr.jsonl
│   │   ├── hin/
│   │   │   ├── output_hin.txt
│   │   │   └── test_hin.jsonl
│   │   ├── ru/
│   │   │   ├── output_ru.txt
│   │   │   ├── test_ru.jsonl
│   │   │   └── test_output_ru.jsonl
│   │   ├── zh/
│   │   │   ├── output_zh.txt
│   │   │   ├── test_zh.jsonl
│   │   │   └── test_output_zh.jsonl
│   │   └── data_extraction.py
│   ├── src/
│   │   ├── evaluate.py
│   │   ├── model_main.py
│   │   ├── train_classifier.py
│   │   ├── train_detox.py
│   │   └── wandb_log.py
│   └── progress_report_milestone6.pdf
├── src/
│   ├── data_inspection.ipynb
│   └── data_loader.py

Milestone 1 Overview

Milestone 1 focuses on the initial setup of the project, including the following key components:

  • Progress Report: Documents the work completed during this milestone.
  • Proof of Registration: Provides documentation of project registration.
  • Teamwork Contract: Outlines team roles and responsibilities.
  • Milestone Overview: Summarizes the objectives and outcomes for this milestone.

Milestone 1 Contents

Milestone 2 Overview

Milestone 2 focuses on the development of the baseline and LLM models for text detoxification. Key components include:

  • Baseline Model: Implementation of a backtranslation baseline approach.
  • LLM Model: Development of a large language model for better detoxification results.

Milestone 2 Contents

  • Baseline Directory: Contains files related to the baseline model.

  • LLM Model Directory: Contains files related to the LLM model.

    • LLM Model Implementation: llm_model.py - Script for the LLM model implementation.
    • Gold Extraction: gold_extraction.py - Script for extracting gold standard data.
    • WandB Logging: wandb_log.py - Script for logging experiments with Weights & Biases.

Milestone 3 Overview

Milestone 3 focuses on reflections on the previous milestones.

Milestone 3 Contents


Milestone 4 Overview

Milestone 4 focuses on our second model, including model improvements, evaluation outputs, results comparison and error analysis.

Milestone 4 Contents

  • Milestone Overview: README.md - Summary of the final milestone objectives and outcomes.
  • Progress Report: progress_report_milestone4.pdf - A detailed report on the development system, model description, results and error analysis.
  • Fine-Tuned Model: finetuned_baseline.py - Implementation of the fine-tuned baseline model.
  • Evaluation Metrics: metrics.jsonl - JSON file containing evaluation results and performance metrics.
  • Detoxification Input: detoxification_input.jsonl - Input data used for the detoxification model.
  • Golden References: golden_references.jsonl - Reference outputs for evaluating model performance.
  • Model Outputs: output.jsonl - Outputs generated by the fine-tuned model.
  • Logging and Tracking: wandb_log.py - Logging script for tracking experiments and results using Weights & Biases.

Milestone 5 Overview

Milestone 5 centers on the development and evaluation of our third model, incorporating multilingual capabilities and refined detoxification logic. This milestone includes the implementation of a new model, testing across English, Russian, and Amharic datasets, and a comprehensive analysis of results.

Milestone 5 Contents

  • Progress Report: progress_report_milestone5.pdf - A detailed report covering the development process, model description, results, error analysis, and reflections on planning improvements.
  • New Model Implementation: new_model.py - The script implementing the new detoxification model designed for this milestone.
  • Data Directory:
  • Evaluation Directory:
    • Evaluation Script: evaluate.py - Script for evaluating model performance across datasets.
    • Evaluation Results:
      • evaluate_en.txt - Evaluation metrics and analysis for the English dataset.
      • evaluate_ru.txt - Evaluation metrics and analysis for the Russian dataset.
      • evaluate_am.txt - Evaluation metrics and analysis for the Amharic dataset.

Milestone 6 Overview

Milestone 6 focuses on finalizing the detoxification pipeline with multilingual support and model evaluation across six languages: English, Amharic, Russian, Hindi, French, and Chinese. This milestone includes refined data processing, model evaluation, and comparison of outputs across languages.

Milestone 6 Contents


Milestone 7 Overview

Milestone 7 focuses on working with the final report and the presentation slides. This milestone works on generating final report for this entire project and includes the entire process of the model evolution and final result.

Milestone 7 Contents


Code Location

The required code for this project can be found in the following directories:

  • src: Contains the source code files related to data inspection.
  • evaluation_script: Directory for evaluation scripts (currently empty, official evaluation method to be announced).

Contributors

lushaw14

30 commits

ylmmgit

16 commits

nal060

4 commits

Languages

Python

63.4%

Jupyter Notebook

35.4%