Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add requirements.txt for installation #23

Merged
merged 1 commit into from
Mar 1, 2017

Conversation

david30907d
Copy link
Contributor

你好,這是一個非常有趣的專案,我想加個requirement讓他更方便安裝
另外,我想請問一下 利用以 PTT Gossiping 作為知識庫, 透過文本相似度的比對取出與使用者輸入最相似的文章標題,再從推文集內挑選出最為可靠的回覆
我該從 QuestionAnswering/qaBase.py裏面修改嘛?

@zake7749 zake7749 merged commit abb7a7f into zake7749:master Mar 1, 2017
@zake7749
Copy link
Owner

zake7749 commented Mar 1, 2017

@david30907d 您好,相當感謝您的協助 👍

關於您的問題,如果是發現實驗沒有效果的話,
主要是因為有些原因,目前蠻多資料不能傳到 Github 上,這點比較不好意思。
我明後兩天會先將一部分處理好 PTT 問答配對上傳,屆時您可以再測試看看。
如果您想自己取得資料,可以參考 PTT-Chat-Generator 的實驗簡述。

如果是說想要調整比對方式的話,這會分成兩種情形,

  1. 從標題集 T 中找尋與使用者輸入 I 最為相似的 t
  2. t 的推文集 R 裡找出合適的推文 r 來回覆給 I

這兩種情形都包覆在 qaBase.py 中的 getGeneralQA 裡:

    def getGeneralQA(self,query,threshold=0):

        title,index = self.matcher.match(query)
        sim = self.matcher.getSimilarity()
        if sim < threshold:
            return None,0
        else:
            res = json.load(open(os.path.join(self.path+"/data/processed/reply/",str(int(index/1000))+'.json'),
                            'r',encoding='utf-8'))
            targetId = index % 1000
            candiates = self.evaluator.getBestResponse(res[targetId],topk=3)
            reply = self.randomPick(candiates)
    return reply,sim

第一點是由 self.matcher 做的,實例來自 match.pygetMatcher,預設採用 BM25,而第二點是由 self.evaluator 做的,可以參考 responsesEvaluate.py

@david30907d
Copy link
Contributor Author

@zake7749 太感謝您了
我會再試試看
所以ChatBot讀取的問答集的路徑:
json.load(open(os.path.join(self.path+"/data/processed/reply/",str(int(index/1000))+'.json'), 'r',encoding='utf-8'))
PTT-Chat-Generator 底下data/processed那邊產出的json嘛?

@zake7749
Copy link
Owner

zake7749 commented Mar 3, 2017

是的,是以數字開頭的 json 檔,比如 1.json

我於 README 中追加了測試用問答集的壓縮檔以及配置路徑,可供您參考。

@david30907d
Copy link
Contributor Author

太感謝您了~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants