Analysis and evolution of language under the influence of content generated by artificial intelligence:
Authors:
- Jhonatan Barcos Gambaro (u198728)
- Daniel Alexander Yearwood Agames (u214976)
This project is a pilot study in the field of journalism that analyzes the linguistic "digital footprint" generated by Artificial Intelligence models. Integrating Visual Analytics, Machine Learning (XGBoost), and Explainable AI (SHAP), the application allows users to:
- Detect: Distinguish between human-written and synthetic texts.
- Explain: Understand which stylometric features (variance, vocabulary, readability) reveal the presence of AI.
- Simulate: Project the evolution and potential "Model Collapse" of written language through 2035.
This project requires Python 3.9+. The core dependencies are:
- Streamlit (Web Interface)
- XGBoost (Classification Model)
- SHAP (Explainability)
- Google Generative AI (For the Gemini-powered simulator)
- Plotly / Matplotlib / Altair (Visualization)
- Clone the repository or unzip the project file.
- Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Mac/Linux venv\Scripts\activate # On Windows
- Install dependencies:
pip install -r requirements.txt
Important Note regarding NLTK: The project uses NLTK tokenizers. If running for the first time, you must download the necessary dictionaries. Run the following in a Python terminal:
import nltk
nltk.download('punkt')
nltk.download('stopwords')
nltk.download('averaged_perceptron_tagger')If you wish to replicate the model training or the exploratory analysis:
Navigate to the notebooks/ folder.
Recommended Execution Order:
├── 1_data_filtering.ipynb # Data loading, filtering (pre-2020), and sampling
├── 2_ai_generation.ipynb # Script to generate synthetic text via Gemini API
├── 3_feature_extraction.ipynb # NLP metrics calculation (Lexical diversity, Perplexity)
└── 4_model_training.ipynb # Model training with XGBoost
This is the main deliverable ("Executable Project"). To launch the interactive dashboard:
Navigate to the project root folder.
Run the command:
streamlit run main.py(Note: If your main script is named differently, e.g., app.py, adjust the command accordingly).
The application will automatically open in your web browser (usually at http://localhost:8501).
The repository is organized as follows:
PROYECTO-FINAL-VISUAL-ANALYTICS/
│
├── data/ # Local data storage (NOT synced to GitHub)
│ ├── 01_raw/ # Original dataset (filtered 'All the News 2.0')
│ ├── 02_processed/ # Cleaned data with calculated NLP metrics
│ └── 03_synthetic/ # AI-generated text (Gemini API output)
│
├── notebooks/ # Jupyter Notebooks for experimentation
│ ├── 1_data_filtering.ipynb # Data loading, filtering (pre-2020), and sampling
│ ├── 2_ai_generation.ipynb # Script to generate synthetic text via Gemini API
│ ├── 3_feature_extraction.ipynb # NLP metrics calculation (Lexical diversity, Perplexity)
│ └── 4_model_training.ipynb # XGBoost training & SHAP analysis
│
├── src/ # Reusable source code modules
│ ├── __init__.py
│ └── model_utils.py # Functions to load/save models
│
├── app/ # Streamlit Web Application (Final Deliverable)
│ ├── main.py # App entry point
│ ├── pages/ # Additional dashboard pages
│ └── utils_viz.py # Visualization functions (Altair/Plotly)
│
├── models/ # Serialized trained models
│ ├── xgboost_classifier.pkl
│
├── reports/ # Documentation
│ └── final_report.pdf # Final Project Report
│
├── .gitignore # Git configuration (ignores data and secrets)
├── requirements.txt # Python dependencies
└── README.md # Project documentation