THUMLP / TensorGCN

37 stars 7 forks source link

请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 #6

Open lyx-227 opened 2 years ago

lyx-227 commented 2 years ago

我运行了get_syntactic_relationship.py文件,但是运行出来保存的文件里面并不是词对,而是(suj,7)这种形式,请问跟Stanfordcorenlp版本有关吗,我用的3.7.1版本的,希望能得到您的解答

qlin3329 commented 2 years ago

我也是,请问您解决了吗

lyx-227 commented 2 years ago

没有解决  跑出来的结果好像也没有达到他的论文

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: qlin3329 @.> 发送时间: 2021年11月11日 22:09 收件人: THUMLP/TensorGCN @.> 抄送: lyx-227 @.>, Author @.> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6)

我也是,请问您解决了吗

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

qlin3329 commented 2 years ago

没有解决  跑出来的结果好像也没有达到他的论文 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: qlin3329 @.> 发送时间: 2021年11月11日 22:09 收件人: THUMLP/TensorGCN @.> 抄送: lyx-227 @.>, Author @.> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6) 我也是,请问您解决了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

我解决了,用在我们自己的数据集上效果不错,如果需要的话我可以发给你lstm和修改后的词法代码

lyx-227 commented 2 years ago

可以发给我一下吗 非常非常非常非常感谢

------------------ 原始邮件 ------------------ 发件人: "THUMLP/TensorGCN" @.>; 发送时间: 2021年11月15日(星期一) 晚上9:18 @.>; @.**@.>; 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6)

没有解决  跑出来的结果好像也没有达到他的论文 发自我的iPhone … ------------------ 原始邮件 ------------------ 发件人: qlin3329 @.> 发送时间: 2021年11月11日 22:09 收件人: THUMLP/TensorGCN @.> 抄送: lyx-227 @.>, Author @.> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6) 我也是,请问您解决了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

我解决了,用在我们自己的数据集上效果不错,如果需要的话我可以发给你lstm和修改后的词法代码

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

lyx-227 commented 2 years ago

您好,可以把您修改过的代码发给我一下吗非常非常非常感谢,邮箱 @.***

qlin3329 commented 2 years ago

您的邮箱没有哦

wangqingpen commented 2 years ago

您的邮箱没有哦

可以发我一份吗 ? 邮箱 1348640767@qq.com

wangqingpen commented 2 years ago

您的邮箱没有哦

可以你发一份吗?万分感谢 1348640767@qq.com

lyx-227 commented 2 years ago

非常感谢非常感谢 请问您的抽取语义关系的 lstm下游任务是文本分类吗?

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: qlin3329 @.> 发送时间: 2021年11月23日 00:50 收件人: THUMLP/TensorGCN @.> 抄送: lyx-227 @.>, Author @.> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6)

`#!/usr/bin/env python

-- coding:utf-8 --

import os import pickle import string from stanfordcorenlp import StanfordCoreNLP from nltk.corpus import stopwords

nlp = StanfordCoreNLP(r'.\stanford-corenlp-full-2016-10-31', lang='en')

路径设置

os.path.abspath(os.path.dirname(os.path.dirname(file))) os.path.abspath(os.path.dirname(os.getcwd())) os.path.abspath(os.path.join(os.getcwd(), ".."))

dataset: 20ng mr ohsumed R8 R52

dataset ='tweet' input = os.sep.join(['..', 'data_tgcn','mr', 'build_train', dataset]) output = os.sep.join(['..', 'data_tgcn', 'mr', 'stanford'])

读取病例

yic_content_list = [] f = open(input + '.cleanreal.txt', 'r', encoding="utf-8") lines = f.readlines() for line in lines: yic_content_list.append(line.strip()) f.close()

stop_words = set(stopwords.words('english'))

获取句法依存关系对

rela_pair_count_str = {} for doc_id in range(len(yic_content_list)): print(doc_id) words = yic_content_list[doc_id] words = words.split("\n") rela=[] for window in words: if window==' ': continue

构造rela_pair_count

window = window.replace(string.punctuation, ' ') lis = nlp.word_tokenize(window) res = nlp.dependency_parse(window) for tuple in res: rela.append(str(lis[tuple[1]-1]) + ', ' + str(lis[tuple[2]-1])) for pair in rela: pair=pair.split(", ") if pair[0]=='ROOT' or pair[1]=='ROOT': continue if pair[0] == pair[1]: continue if pair[0] in string.punctuation or pair[1] in string.punctuation: continue if pair[0] in stop_words or pair[1] in stop_words: continue word_pair_str = pair[0] + ',' + pair[1] if word_pair_str in rela_pair_count_str: rela_pair_count_str[word_pair_str] += 1 else: rela_pair_count_str[word_pair_str] = 1

two orders

word_pair_str = pair[1] + ',' + pair[0] if word_pair_str in rela_pair_count_str: rela_pair_count_str[word_pair_str] += 1 else: rela_pair_count_str[word_pair_str] = 1

将rela_pair_count_str存成pkl格式

output1=open(output + '/{}_stan.pkl'.format(dataset),'wb') pickle.dump(rela_pair_count_str, output1)`

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

wangqingpen commented 2 years ago

非常感谢非常感谢 请问您的抽取语义关系的 lstm下游任务是文本分类吗? 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: qlin3329 @.> 发送时间: 2021年11月23日 00:50 收件人: THUMLP/TensorGCN @.> 抄送: lyx-227 @.>, Author @.> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6) #!/usr/bin/env python -- coding:utf-8 -- import os import pickle import string from stanfordcorenlp import StanfordCoreNLP from nltk.corpus import stopwords nlp = StanfordCoreNLP(r'.\stanford-corenlp-full-2016-10-31', lang='en') #路径设置 os.path.abspath(os.path.dirname(os.path.dirname(file))) os.path.abspath(os.path.dirname(os.getcwd())) os.path.abspath(os.path.join(os.getcwd(), "..")) #dataset: 20ng mr ohsumed R8 R52 dataset ='tweet' input = os.sep.join(['..', 'data_tgcn','mr', 'build_train', dataset]) output = os.sep.join(['..', 'data_tgcn', 'mr', 'stanford']) #读取病例 yic_content_list = [] f = open(input + '.cleanreal.txt', 'r', encoding="utf-8") lines = f.readlines() for line in lines: yic_content_list.append(line.strip()) f.close() stop_words = set(stopwords.words('english')) #获取句法依存关系对 rela_pair_count_str = {} for doc_id in range(len(yic_content_list)): print(doc_id) words = yic_content_list[doc_id] words = words.split("\n") rela=[] for window in words: if window==' ': continue #构造rela_pair_count window = window.replace(string.punctuation, ' ') lis = nlp.word_tokenize(window) res = nlp.dependency_parse(window) for tuple in res: rela.append(str(lis[tuple[1]-1]) + ', ' + str(lis[tuple[2]-1])) for pair in rela: pair=pair.split(", ") if pair[0]=='ROOT' or pair[1]=='ROOT': continue if pair[0] == pair[1]: continue if pair[0] in string.punctuation or pair[1] in string.punctuation: continue if pair[0] in stop_words or pair[1] in stop_words: continue word_pair_str = pair[0] + ',' + pair[1] if word_pair_str in rela_pair_count_str: rela_pair_count_str[word_pair_str] += 1 else: rela_pair_count_str[word_pair_str] = 1 # two orders word_pair_str = pair[1] + ',' + pair[0] if word_pair_str in rela_pair_count_str: rela_pair_count_str[word_pair_str] += 1 else: rela_pair_count_str[word_pair_str] = 1 #将rela_pair_count_str存成pkl格式 output1=open(output + '/{}_stan.pkl'.format(dataset),'wb') pickle.dump(rela_pair_count_str, output1) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

非常感谢非常感谢 请问您的抽取语义关系的 lstm下游任务是文本分类吗? 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: qlin3329 @.> 发送时间: 2021年11月23日 00:50 收件人: THUMLP/TensorGCN @.> 抄送: lyx-227 @.>, Author @.> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6) #!/usr/bin/env python -- coding:utf-8 -- import os import pickle import string from stanfordcorenlp import StanfordCoreNLP from nltk.corpus import stopwords nlp = StanfordCoreNLP(r'.\stanford-corenlp-full-2016-10-31', lang='en') #路径设置 os.path.abspath(os.path.dirname(os.path.dirname(file))) os.path.abspath(os.path.dirname(os.getcwd())) os.path.abspath(os.path.join(os.getcwd(), "..")) #dataset: 20ng mr ohsumed R8 R52 dataset ='tweet' input = os.sep.join(['..', 'data_tgcn','mr', 'build_train', dataset]) output = os.sep.join(['..', 'data_tgcn', 'mr', 'stanford']) #读取病例 yic_content_list = [] f = open(input + '.cleanreal.txt', 'r', encoding="utf-8") lines = f.readlines() for line in lines: yic_content_list.append(line.strip()) f.close() stop_words = set(stopwords.words('english')) #获取句法依存关系对 rela_pair_count_str = {} for doc_id in range(len(yic_content_list)): print(doc_id) words = yic_content_list[doc_id] words = words.split("\n") rela=[] for window in words: if window==' ': continue #构造rela_pair_count window = window.replace(string.punctuation, ' ') lis = nlp.word_tokenize(window) res = nlp.dependency_parse(window) for tuple in res: rela.append(str(lis[tuple[1]-1]) + ', ' + str(lis[tuple[2]-1])) for pair in rela: pair=pair.split(", ") if pair[0]=='ROOT' or pair[1]=='ROOT': continue if pair[0] == pair[1]: continue if pair[0] in string.punctuation or pair[1] in string.punctuation: continue if pair[0] in stop_words or pair[1] in stop_words: continue word_pair_str = pair[0] + ',' + pair[1] if word_pair_str in rela_pair_count_str: rela_pair_count_str[word_pair_str] += 1 else: rela_pair_count_str[word_pair_str] = 1 # two orders word_pair_str = pair[1] + ',' + pair[0] if word_pair_str in rela_pair_count_str: rela_pair_count_str[word_pair_str] += 1 else: rela_pair_count_str[word_pair_str] = 1 #将rela_pair_count_str存成pkl格式 output1=open(output + '/{}_stan.pkl'.format(dataset),'wb') pickle.dump(rela_pair_count_str, output1) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

想请问一下,你的抽取语义关系lstm是如何写的,可以发到我的邮箱吗?1348640767@qq.com 万分感谢

wangqingpen commented 2 years ago

您的邮箱没有哦

想请问一下,你的抽取语义关系lstm是如何写的,可以发到我的邮箱吗?1348640767@qq.com 万分感谢

cuibenkuan commented 2 years ago

您的邮箱没有哦

请问一下,您的语义抽取LSTM网络是如何实现的,可以发送一份到我的邮箱吗,1479007274@qq.com。十分感谢

shanyongxue commented 2 years ago

您的邮箱没有哦

请问一下,您的语义关系抽取方法怎么写的,可以发到我的邮箱吗。1462966961@qq.com。非常感谢,期待您的回复!

FILAJIONG commented 2 years ago

可以发给我一下吗?谢谢 770379028@qq.com

Rachel-Ti commented 2 years ago

您的邮箱没有哦

您好 想知道您的语义抽取LSTM网络是如何实现的 可以发给我的邮箱吗?jingspan@qq.com 感谢

HHHDestiny commented 2 years ago

能不能发送一份给我呀 1061377446@qq.com 谢谢了

cjy001 commented 2 years ago

您好 想知道您的语义抽取LSTM网络是如何实现的 可以发给我的邮箱吗? 万分感激 15866676515@163.com

cjy001 commented 2 years ago

如果

您好,求一份lstm和修改后的词法代码,万分感谢 15866676515@163.com

luckyonetwo commented 2 years ago

您好 想知道您的语义抽取LSTM网络是如何实现的 可以发给我的邮箱吗? 万分感激 [1780260241@qq.com]

luckyonetwo commented 2 years ago

没有解决跑出来的结果好像也没有达到他的论文 自己的 iPhone ... ------------------ 原始邮件 ------------ ------ 发件人:qlin3329 @ . _> 发送时间 2022 年 1 月 11 日:09 年 1 月 1 日/T : 22 _@_ THUMLPGCN _****> 抄送:lyx-227 @ . **>,作者@。**> 主题代码出来:Re: [THUMLP/Ten] 请您的朋友们或者是因为同样的原因,请您帮我解决这个问题,因为我不是和您的同事一起运行我的文件(第6期)线程。直接回复此邮件,在 GitHub 上查看,或退订。使用适用于 iOS 或 Android 的 GitHub Mobile 随时随地对通知进行分类。

我解决了,用在我们自己的数据集上效果不错,如果需要的话我可以发给你lstm和修改后的词法代码

你好可以发给我一下嘛,邮件1780260241@qq.com 非常感谢

lxy990808 commented 2 years ago

能把程序发给我一份吗,十分感谢。1106974211@qq.com

Feifan759 commented 2 years ago

您好!我想知道您的语义抽取LSTM网络是如何实现的 可以发给我的邮箱吗? 万分感激 [794857387@qq.com]

linqijun-miao commented 2 years ago

那个qlin3329是我的账号,不好意思我最近都没有用那个账号了,所以都没看到,我今晚开源一份,符合这个TensorGCN 格式要求的,基于LSTM或者BERT(两者都可以),的代码出来。

linqijun-miao commented 2 years ago

如果有人还需要的话可以看这个 https://github.com/linqijun-miao/TensorGCN_toolkit_semantic_similarity

linqijun-miao commented 2 years ago

您好!我想知道您的语义抽取LSTM网络是如何实现的 可以发给我的邮箱吗? 万分感激 [794857387@qq.com]

https://github.com/linqijun-miao/TensorGCN_toolkit_semantic_similarity

xinxyou commented 2 years ago

关于“运行了get_syntactic_relationship.py文件,但是运行出来保存的文件里面并不是词对,而是(suj,7)这种形式”这个问题,统一在readme里面加入了"step2"解决办法,具体来说在运行get_syntactic_relationship.py之前,需要修改一行代码,如下: Change one line of code in "dependency_parse" function :

before:return [(dep['dep'], dep['governor'], dep['dependent']) for s in r_dict['sentences'] for dep in s['basicDependencies']]

after:return [(dep['governorGloss'], dep['dependentGloss']) for s in r_dict['sentences'] for dep in s['basicDependencies']]

luckyonetwo commented 2 years ago

没有解决  跑出来的结果好像也没有达到他的论文 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: qlin3329 @.**> 发送时间: 2021年11月11日 22:09 收件人: THUMLP/TensorGCN @.**> 抄送: lyx-227 @.**>, Author @.**> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6) 我也是,请问您解决了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

我解决了,用在我们自己的数据集上效果不错,如果需要的话我可以发给你lstm和修改后的词法代码

请问你是怎么用lstm关系抽取的,方便的话可以发到我邮箱一份吗?万分感谢。1780260241@qq.com

linqijun-miao commented 2 years ago

没有解决  跑出来的结果好像也没有达到他的论文 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: qlin3329 @.**> 发送时间: 2021年11月11日 22:09 收件人: THUMLP/TensorGCN @.**> 抄送: lyx-227 @.**>, Author @.**> 主题: Re: [THUMLP/TensorGCN] 请问语法关系的抽取为什么运行代码出来的跟您给我的文件不一样呢 (Issue #6) 我也是,请问您解决了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

我解决了,用在我们自己的数据集上效果不错,如果需要的话我可以发给你lstm和修改后的词法代码

请问你是怎么用lstm关系抽取的,方便的话可以发到我邮箱一份吗?万分感谢。1780260241@qq.com

https://github.com/linqijun-miao/TensorGCN_toolkit_semantic_similarity