トップ 履歴 一覧 Farm ソース 検索 ヘルプ PDF RSS ログイン

rsyntax

*disclaimer
632785

R

rsyntax



https://www.rdocumentation.org/packages/rsyntax/versions/0.1.2

 インストール

install.packages('rsyntax')

 準備

udpipeを使う

library(udpipe)

 

reibun <- udpipe("What kind of sports do you like?", "english")

library(rsyntax)

reibun.token <- as_tokenindex(reibun)

reibun.token

	doc_id	paragraph_id	sentence	start	end	term_id	token_id	token	lemma	upos	xpos	feats	parent	relation	deps	misc	sentence_txt
1	doc1	1	1	1	4	1	1	What	what	DET	WDT	PronType=Int	2	det	NA	NA	What kind of sports do you like?
2	doc1	1	1	6	9	2	2	kind	kind	NOUN	NN	Number=Sing	7	obj	NA	NA	What kind of sports do you like?
3	doc1	1	1	11	12	3	3	of	of	ADP	IN	NA	4	case	NA	NA	What kind of sports do you like?
4	doc1	1	1	14	19	4	4	sports	sport	NOUN	NNS	Number=Plur	2	nmod	NA	NA	What kind of sports do you like?
5	doc1	1	1	21	22	5	5	do	do	AUX	VBP	Mood=Ind|Tense=Pres|VerbForm=Fin	7	aux	NA	NA	What kind of sports do you like?
6	doc1	1	1	24	26	6	6	you	you	PRON	PRP	Case=Nom|Person=2|PronType=Prs	7	nsubj	NA	NA	What kind of sports do you like?
7	doc1	1	1	28	31	7	7	like	like	VERB	VB	VerbForm=Inf	NA	ROOT	NA	SpaceAfter=No	What kind of sports do you like?
8	doc1	1	1	32	32	8	8	?	?	PUNCT	.	NA	7	punct	NA	SpacesAfter=\n	What kind of sports do you like?


構文木を描く

plot_tree(reibun.token, token, lemma, upos)