-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
如何抽取問答配對? #1
Comments
您好, 原始檔案我要再找找,如果急用的話,我剛剛稍微從 chat.py改了一下,雖然還沒有實際跑過,不過流程應該是對的 def dumpQAPairs(self, path):
with open("data/Titles.txt",'r',encoding='utf-8') as data:
titles = [line.strip('\n') for line in data]
with open(path, 'w', encoding='utf-8') as dump:
index = 0
for title in titles:
q = title
res = json.load(open(os.path.join("data/processed/reply/",str(int(index/1000))+'.json'),'r',encoding='utf-8'))
targetId = index % 1000
try:
candiates = self.evaluator.getBestResponse(res[targetId])
a = self.randomPick(candiates)
dump.write(q + "\t" + a + "\n")
except:
print("[Err] : ", index + 1)
index += 1
if index % 1000 == 0:
print("Dumped %d QA Pairs" % (index)) 理論上 |
多謝幫忙!這樣就可以了。 另外有一個相關問題,在此project中的Titles.txt中只有178006行。但在另一個project中,抓出來的QA pairs: Gossiping-Chinese-Corpus/data/Gossiping-QA-Dataset.txt卻有418202行。 因為418202比較接近Gossiping版的總篇數。所以這是因為過濾條件不一樣嗎?若是,你大概是怎麼設定條件的?是幾乎沒過濾,而且把包含"Re:", "Fw:"等的也抓進來了嗎? 謝謝幫忙! |
Gossiping-Chinese-Corpus 是抽取自 2015 年末至 2017 年 6 月底的八卦版文章, |
了解。 不過,我自己試著重新用PTT-Crawler,抽取自 2005年第一篇至目前的八卦版文章,原本抓到466686個Title,但用filter.py過濾後,只剩下234706個Title。 所以目前還是有點搞不清楚差異在哪裡! 謝謝幫忙! |
您指的是清理後應該要有 418202 行而非 234706 行嗎 ? 如果是現在用 PTT-Crawler 從 2015 年開始爬的話,這個結果是正常的, |
你好: 不好意思,上篇講錯年份的了。我是從2005年第一篇開始抓。抓到466686個Title,用filter.py過濾後,剩下234706個Title。 而你說Gossiping-Chinese-Corpus 是抽取自 2015 年末至 2017 年 6 月底的文章,過濾後剩418202行。 基本上,我想盡量增加對答數,所以正在試著盡量多扒一些文章與各抓前幾名回應出來用。但一開始扒到的數量就比較少了。我知道有些文章會被系統清除,但我用PTT-Crawler抓到的文章數,跟你們抓到的文章數的差距有點太大。所以不知到,我是在哪邊弄錯? 謝謝幫忙! |
我剛剛用 index 算了一下,八卦版至 8 月 19 號差不多有 24700 頁,每頁有 20 筆標題, 因為不是有些文章會被刪除,而是幾乎所有的文章都會被刪除, |
原來如此,總算搞清楚了。 另外問一下,2017年2月前的原始資料,還有可能拿得到嗎?尤其是,是否有其他來源可以獲取? 謝謝幫忙! |
原站點的資料被刪掉後應該就找不回來了, |
多謝幫忙! |
PTT 中文語料中有你做好的Gossiping-QA-Dataset.txt。請問這個檔案是如何產生的?
用match.py嗎?用chat.py?還是用別的方法?
謝謝幫忙!
The text was updated successfully, but these errors were encountered: