daniel-kukiela / nmt-chatbot

NMT Chatbot
GNU General Public License v3.0
386 stars 213 forks source link

How to setup inference to output one answer with the highest score? #82

Closed stas4000 closed 6 years ago

stas4000 commented 6 years ago

Hi, Couldn't find anywhere in issues a question of this kind nor a clear instruction in README. So my question is how do I setup my trained bot to give me a single answer selected by the maximum score.

Also, I would love to know if there is a setting that filters links (I mean always returns a response without a website link)

Thanks in advance.

daniel-kukiela commented 6 years ago

This project is prepared mainly for importing. There is inference script, but mostly for testing purposes. Make own project, place nmt-chatbot inside it, and import (like in README). Then print output - you'll see all responses and index of best scored response.

Currently there's no way to filter all links out. You will have to modify scoring code.

stas4000 commented 6 years ago

Thanks for your response, I already modified the inference.py script so that now I'm getting one response with the highest score that is not a link.

frameworkapi commented 6 years ago

hello, i would like to know how did you remove link outputs. thanks.

daniel-kukiela commented 6 years ago

Best way to remove llinks is to filter them out from a training dataset, otherwise all answers might be a links for a question, so no answer at all.

stas4000 commented 6 years ago

Hi Frameworkapi,

Daniel is correct the best way is indeed to remove all links from dataset, but if you already trained your model and you'd like to filter the links there is a way using regex.

I am attaching my customized inference.py file. It's filtering all links and outputs a single answer with the highest score. Just look below line 307

inference.zip

For clarification I filtered the answers with this regex: "https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+"