This project implements and improves a slot labeling model, a crucial component of task-oriented dialogue systems such as virtual assistants (e.g., Siri, Alexa). The primary focus is to enhance the accuracy of slot labeling by experimenting with different approaches, including logistic regression and BIO tagging.
|-- data/
|-- training_data.json # Training data
|-- validation_data.json # Validation data
|-- test_data.json # Test data
|-- ontology.json # Ontology describing intents and slots
|-- src/
|-- label_slots.py # Main executable script
|-- utils.py # Helper functions for preprocessing and evaluation
|-- README.md # Documentation
- Python 3.x
spacyscikit-learn
conda create -n anlp_hw2 python=3.x
conda activate anlp_hw2
conda install -c conda-forge spacy
conda install scikit-learn
python -m spacy download en_core_web_smRun the baseline model that uses the most frequent tag for each word:
python label_slots.pyRun the logistic regression-based model:
python label_slots.py -m logistic_regressionTo enforce correct tagging structure using BIO constraints:
python label_slots.py -m logistic_regression -p bio_tagsTo run your improved model after implementing additional features:
python label_slots.py -m my_model -p bio_tags- Tags each word based on the most frequent label in the training data.
- Utilizes the BIO tagging scheme.
- Conditions the tag prediction on word embeddings instead of individual words.
- Addresses issues with unseen words by leveraging semantic similarities in embeddings.
- Enforces valid sequences (e.g.,
I-<tag>must followB-<tag>). - Improves consistency of labeled spans.
- Identify common errors by examining mispredicted spans.
- Experiment with linguistic features such as:
- Part-of-speech (POS) tags
- Dependency relations
- Neighboring word embeddings
- Implement improvements in
train_my_modeland rerun tests.
- Precision, Recall, F1-score: Evaluated for each slot type and overall.
- Micro-averaged and macro-averaged F1-scores are reported for performance comparison.