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

SDP2CONLL #21

Closed
moonstarsky opened this issue Mar 17, 2020 · 2 comments
Closed

SDP2CONLL #21

moonstarsky opened this issue Mar 17, 2020 · 2 comments

Comments

@moonstarsky
Copy link

How can I use this to convert SDP format to CONLL format?
Thank you

@danielhers
Copy link
Member

$ python semstr/convert.py test_files/20001001.sdp -f conll
Converting: 100%|████████████| 1/1 [00:00<00:00, 87.65file/s, file=20001001.sdp]
$ cat 20001001.conll 
# format = sdp
# sent_id = 20001001
1	Pierre	Pierre	NNP	NNP	_	0	ROOT	_	_
2	Vinken	_generic_proper_ne_	NNP	NNP	_	1	compound_	_
2	Vinken	_generic_proper_ne_	NNP	NNP	_	6	ARG1	__
2	Vinken	_generic_proper_ne_	NNP	NNP	_	9	ARG1	__
3	,	_	,	,	_	0	ROOT	_	_
4	61	_generic_card_ne_	CD	CD	_	0	ROOT	__
5	years	year	NNS	NNS	_	4	ARG1	_	_
6	old	old	JJ	JJ	_	5	measure	_	_
7	,	_	,	,	_	0	ROOT	_	_
8	will	will	MD	MD	_	0	ROOT	_	_
9	join	join	VB	VB	_	12	ARG1	_	_
9	join	join	VB	VB	_	17	loc	_	_
10	the	the	DT	DT	_	0	ROOT	_	_
11	board	board	NN	NN	_	9	ARG2	_	_
11	board	board	NN	NN	_	10	BV	_	_
12	as	as	IN	IN	_	0	ROOT	_	_
13	a	a	DT	DT	_	0	ROOT	_	_
14	nonexecutive	_generic_jj_	JJ	JJ	_	0	ROOT	__
15	director	director	NN	NN	_	12	ARG2	__
15	director	director	NN	NN	_	13	BV	__
15	director	director	NN	NN	_	14	ARG1	__
16	Nov.	Nov.	NNP	NNP	_	0	ROOT	_	_
17	29	_generic_dom_card_ne_	CD	CD	_	16	of	__
18	.	_	.	.	_	0	ROOT	_	_

@danielhers
Copy link
Member

Note that the CoNLL format does not allow multiple heads, so these are discarded in the example above.
If, however, you want CoNLL-U format, just say so:

$ python semstr/convert.py test_files/20001001.sdp -f conllu
Converting: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 76.49file/s, file=20001001.sdp]
$ cat 20001001.conllu
# format = sdp
# sent_id = 20001001
# text = Pierre Vinken , 61 years old , will join the board as a nonexecutive director Nov. 29 .
1	Pierre	Pierre	NNP	NNP	_	0	root	0:root	_
2	Vinken	_generic_proper_ne_	NNP	NNP	_	1	compound	1:compound|6:ARG1|9:ARG1	_
3	,	_	,	,	_	1	orphan	1:orphan	_
4	61	_generic_card_ne_	CD	CD	_	1	orphan	1:orphan	_
5	years	year	NNS	NNS	_	4	ARG1	4:ARG1	_
6	old	old	JJ	JJ	_	5	measure	5:measure	_
7	,	_	,	,	_	1	orphan	1:orphan	_
8	will	will	MD	MD	_	1	orphan	1:orphan	_
9	join	join	VB	VB	_	1	orphan	1:orphan	_
10	the	the	DT	DT	_	1	orphan	1:orphan	_
11	board	board	NN	NN	_	9	ARG2	9:ARG2|10:BV	_
12	as	as	IN	IN	_	1	orphan	1:orphan	_
13	a	a	DT	DT	_	1	orphan	1:orphan	_
14	nonexecutive	_generic_jj_	JJ	JJ	_	1	orphan	1:orphan	_
15	director	director	NN	NN	_	12	ARG2	12:ARG2|13:BV|14:ARG1	_
16	Nov.	Nov.	NNP	NNP	_	1	orphan	1:orphan	_
17	29	_generic_dom_card_ne_	CD	CD	_	16	of	16:of	_
18	.	_	.	.	_	1	orphan	1:orphan	_

This way you get all heads in the last column (the deps column).

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

2 participants