Skip to content
Snippets Groups Projects
Unverified Commit 2236ae82 authored by aaa123git's avatar aaa123git Committed by GitHub
Browse files

fix bug. replace 'id' with 'ID' (#198)

parent a067adb8
No related branches found
No related tags found
Loading
import os
import re
import zipfile
import json
import torch
......@@ -66,6 +67,8 @@ class BERTNLU(NLU):
print("BERTNLU loaded")
def predict(self, utterance, context=list()):
# Note: spacy cannot tokenize 'id' or 'Id' correctly.
utterance = re.sub(r'\b(id|Id)\b', 'ID', utterance)
# tokenization first, very important!
ori_word_seq = [token.text for token in self.nlp(unidecode(utterance)) if token.text.strip()]
# print(ori_word_seq)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment