Downloads · 30 days
0
Wilkie/Afrikaans_Next_Word_Prediction_GPT
Afrikaans_Next_Word_Prediction_GPT is a text generation model from Wilkie. Use it when you need the model to write or continue text. It is set up for pytorch. The card lists the license as cc-by-nc-4.0.
Author: Louis Wilkinson (25948873) Project: BDatSci Research Project 2025
Downloads · 30 days
0
Access
Public
Updated Oct 30, 2025
Repo size
43.6 MB
Likes
0
Public
Click a slice to open those files.
.pt43.6 MB · 98%
From the Hugging Face model README
Author: Louis Wilkinson (25948873) Project: BDatSci Research Project 2025
This model is a GPT-based next-word prediction system specifically designed for Afrikaans text. It uses a custom ByteLevel BPE tokeniser with a 12,000 token vocabulary and implements a token-aware prediction strategy for accurate next-word suggestions in Afrikaans language contexts.
The tokeniser handles:
<NAME>: Personal names<URL>: Web addresses<EMAIL>: Email addresses<PHONE>: Phone numbers<NUM>: Numeric values<EMOJI>: Emoji charactersThe model is trained to recognise common Afrikaans contractions:
ek's, jy's, hy's, sy's, dit's, ons's, julle's, hulle'sdaar's, hier's, wat's, dis, 'nAfrikaans-NWP-GPT/
├── model/
│ ├── Afrikaans_NWP_GPT.pt # Trained model checkpoint
│ └── tokeniser.json # ByteLevel BPE tokeniser
├── scripts/
│ ├── text_cleaner.py # Comprehensive Afrikaans text cleaning
│ ├── build_tokeniser.py # Tokeniser construction script
│ └── train_model.py # Model training script
├── demo/
│ ├── demo.py # Interactive GUI demo application
│ ├── run_demo.sh # Shell script to launch demo
│ └── sentence_starters_top100.txt # Common Afrikaans sentence starters
└── tests/
└── evaluate_model.py # Model evaluation script
Install dependencies:
pip install torch tokenisers
The easiest way to try the model is through the interactive demo:
cd demo
bash run_demo.sh
Or directly:
cd demo
python demo.py
The demo provides a tkinter GUI where you can type Afrikaans text and see real-time next-word predictions.
To train the model from scratch:
Clean the text data:
cd scripts
python text_cleaner.py --input raw_text.txt --output cleaned_text.txt
Build the tokeniser:
python build_tokeniser.py --input cleaned_text.txt --output ../model/tokeniser.json
Train the model:
python train_model.py --data cleaned_text.txt --tokeniser ../model/tokeniser.json --output ../model/Afrikaans_NWP_GPT.pt
To evaluate the model on test data:
cd tests
python evaluate_model.py --tokeniser ../model/tokeniser.json --checkpoint ../model/Afrikaans_NWP_GPT.pt
The evaluation script computes three metrics:
The comprehensive text cleaner (scripts/text_cleaner.py) performs:
The model uses a token-aware prediction strategy:
This approach ensures predictions align with natural word boundaries while leveraging the full power of subword tokenisation.
This model is designed for:
This model should not be used for:
As with any language model trained on real-world text data:
This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).
For Academic and Research Use Only
This software and associated model are provided for academic research and educational purposes only. Commercial use is strictly prohibited without prior written permission from the author.
This is original research conducted as part of a BDatSci honours project. If you use this work in your research, you must provide proper attribution:
Citation:
Wilkinson, L.A. (2025). Next word-prediction in Afrikaans: A comparative study of Transformer models and traditional methods.
Bachelor of Data Science (Analytics and Optimisation) Research Project, Stellenbosch University.
Failure to cite this work constitutes academic plagiarism. Any use, modification, or distribution of this work must include this citation and maintain the original authorship attribution.
Louis Anthony Wilkinson (25948873) BDatSci Research Project 2025
For permissions beyond the scope of this license, please contact the author.