Skip to content
Snippets Groups Projects
Commit d71de0fa authored by zqwerty's avatar zqwerty
Browse files

fix bug in bertnlu nlu.py: spacy tokenizer

parent 12a1da7a
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,6 @@ class BERTNLU(NLU): ...@@ -61,7 +61,6 @@ class BERTNLU(NLU):
self.model = model self.model = model
self.use_context = config['model']['context'] self.use_context = config['model']['context']
self.dataloader = dataloader self.dataloader = dataloader
self.nlp = spacy.load('en_core_web_sm')
try: try:
self.nlp = spacy.load("en_core_web_sm") self.nlp = spacy.load("en_core_web_sm")
except Exception: except Exception:
...@@ -121,7 +120,7 @@ class BERTNLU(NLU): ...@@ -121,7 +120,7 @@ class BERTNLU(NLU):
if __name__ == '__main__': if __name__ == '__main__':
text = "How about rosa's bed and breakfast ? Their postcode is cb22ha." text = "How about rosa's bed and breakfast ? Their postcode is cb22ha."
nlu = BERTNLU(mode='sys', config_file='multiwoz_sys_context.json', nlu = BERTNLU(mode='all', config_file='multiwoz_all_context.json',
model_file='https://convlab.blob.core.windows.net/convlab-2/bert_multiwoz_all_context.zip') model_file='https://convlab.blob.core.windows.net/convlab-2/bert_multiwoz_all_context.zip')
print(nlu.predict(text)) print(nlu.predict(text))
# text = "I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant." # text = "I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant.I don't care about the Price of the restaurant."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment