Use BERT for intent recognition
Contents
- What is BERT?
2. Model architecture
3. Data Preparation
- Import modules
- Declare data folder path
- Read csv files
- Concat train and valid dataframe
- Get the unique intent and it’s count
4. Visualization
4.1 Plot intents
- Countplot
- Barplot
5. Load BERT model
- Declare bert configuration files
6. Tokenize vocabulary
- Load vocab.txt file
- Tokenize vocab with FullTokenizer
7. Preprocess data
- Create class
- Add input parameters to the constructor
- Sort train and test data by length of text
- Preprocess train and test data
- Add padding to the sequence
- Full class code
8. Create custom model
- Create a function
- Read bert configuration file
- Create bert model layer from bert configuration parameters
- Create Keras model and add input and output layers in that