forked from zake7749/Chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete elemental structure of QAbase.
- Loading branch information
Showing
3 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
from . import match | ||
from . import responsesEvaluate | ||
import json | ||
|
||
from .match import * | ||
from .responsesEvaluate import Evaluator | ||
|
||
class QABase(object): | ||
pass | ||
|
||
def __init__(self, data_path): | ||
|
||
""" | ||
Args: | ||
data_path: 指出 data 資料夾位在哪個位置 | ||
""" | ||
self.general_questions = [] | ||
self.data_path = data_path | ||
|
||
self.matcher = getMatcher(matcherType="Fuzzy") | ||
self.evaluator = Evaluator() | ||
|
||
def getResponse(self, sentence, api_key=None): | ||
|
||
if api_key is not None: | ||
response = self.getCustomQA(sentence,api_key) | ||
else: | ||
response = self._getGeneralQA(sentence) | ||
return response | ||
|
||
def getGeneralQA(self, sentence): | ||
|
||
pass | ||
|
||
def getCustomQA(self, sentence, api_key): | ||
|
||
#TODO GET USER'S QA BY api_key | ||
#customqa_list = json.loads(getUserQA(api_key)) | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.