Skip to content
Snippets Groups Projects
Unverified Commit f7fe7b49 authored by zhuqi's avatar zhuqi Committed by GitHub
Browse files

Merge pull request #58 from ConvLab/nlu

fix bug in bertnlu nlu.py: spacy tokenizer
parents 8b1c3fd5 d71de0fa
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