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

请问能告诉下 question_train.txt是怎么来的吗?思路也行 #11

Open
ForgetThatNight opened this issue Mar 6, 2020 · 14 comments

Comments

@ForgetThatNight
Copy link

cur = '/'.join(os.path.abspath(file).split('/')[:-1])
self.train_file = os.path.join(cur, 'question_train.txt')
就是这个文件找不到

@prozyworld
Copy link

cur = '/'.join(os.path.abspath(file).split('/')[:-1])
self.train_file = os.path.join(cur, 'question_train.txt')
就是这个文件找不到

同问

@ForgetThatNight
Copy link
Author

cur = '/'.join(os.path.abspath(file).split('/')[:-1])
self.train_file = os.path.join(cur, 'question_train.txt')
就是这个文件找不到

同问

连长什么样子都不知道

@Maxhyl
Copy link

Maxhyl commented Jun 1, 2020

从数据处理那里就可以看到数据格式啊,很明显就是文本对应标签

@ForgetThatNight
Copy link
Author

从数据处理那里就可以看到数据格式啊,很明显就是文本对应标签

连蒙带猜的已经解决了,从json文件读取数据猜写进去的格式弄好了

@sometimestios
Copy link

从数据处理那里就可以看到数据格式啊,很明显就是文本对应标签

连蒙带猜的已经解决了,从json文件读取数据猜写进去的格式弄好了

@ForgetThatNight 请问您可以分享处理json文件的代码吗?

@rancho628
Copy link

从数据处理那里就可以看到数据格式啊,很明显就是文本对应标签

连蒙带猜的已经解决了,从json文件读取数据猜写进去的格式弄好了

+1,请问是从qa_corpus.json读取吗,求代码好人一生平安

@TTTnlp
Copy link

TTTnlp commented Apr 22, 2022

有数据了吗

@21want28k
Copy link

有数据了吗

兄弟,你拿到那个文件的数据了吗?

@TTTnlp
Copy link

TTTnlp commented Sep 12, 2022 via email

@21want28k
Copy link

没有。。

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年9月12日(星期一) 下午3:46 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [liuhuanyong/CrimeKgAssitant] 请问能告诉下 question_train.txt是怎么来的吗?思路也行 (#11) 有数据了吗 兄弟,你拿到那个文件的数据了吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

这个项目你怎么用的,我看训练的过程里面,缺挺多txt文件的。

@TTTnlp
Copy link

TTTnlp commented Sep 12, 2022 via email

@21want28k
Copy link

我只用了加权打分的那个TXT(之前评论里面作者发出来了),其他要的我都没有抓数据

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年9月12日(星期一) 下午5:16 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [liuhuanyong/CrimeKgAssitant] 请问能告诉下 question_train.txt是怎么来的吗?思路也行 (#11) 没有。。 … ------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年9月12日(星期一) 下午3:46 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [liuhuanyong/CrimeKgAssitant] 请问能告诉下 question_train.txt是怎么来的吗?思路也行 (#11) 有数据了吗 兄弟,你拿到那个文件的数据了吗? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 这个项目你怎么用的,我看训练的过程里面,缺挺多txt文件的。 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

可以加你一个联系吗?我是小白,不是很懂,我感觉少了挺多txt。

@TTTnlp
Copy link

TTTnlp commented Oct 11, 2022 via email

@ForgetThatNight
Copy link
Author

qa_corpus.json

`import numpy as np
from tqdm import tqdm
import pandas as pd

def build_qa_corpus():
source_path = "/home/lc/Python/recommendersystem/rasa_resource/CrimeKgAssitant/data/qa_corpus.json"
json = pd.read_json(source_path, lines=True)
print(json.shape)
print(json.info())
json.head()

label_dict = {
    "婚姻家庭": 0,
    "劳动纠纷": 1,
    "交通事故": 2,
    "债权债务": 3,
    "刑事辩护": 4,
    "合同纠纷": 5,
    "房产纠纷": 6,
    "侵权": 7,
    "公司法": 8,
    "医疗纠纷": 9,
    "拆迁安置": 10,
    "行政诉讼": 11,
    "建设工程": 12
}

content_path = "/home/lc/Python/recommendersystem/rasa_resource/CrimeKgAssitant/data/question_train.txt"
file = open(content_path, "w")

for i in tqdm(range(len(json))):
    question = json.iloc[i]['question']
    category = json.iloc[i]['category']
    file.write(question.strip() + "\t" + str(label_dict[category.strip()]))
    file.write("\n")

file.close()

if name == 'main':
build_qa_corpus()`

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

No branches or pull requests

7 participants