Skip to content

Instantly share code, notes, and snippets.

@tnaka78
Last active February 3, 2019 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnaka78/2731d40b0c19d231737612796ba01a15 to your computer and use it in GitHub Desktop.
Save tnaka78/2731d40b0c19d231737612796ba01a15 to your computer and use it in GitHub Desktop.
StanfordNLP Japanese example
import stanfordnlp
# stanfordnlp.download('ja')
nlp = stanfordnlp.Pipeline(lang='ja')
doc = nlp(u'私は自然言語処理を勉強しています。')
doc.sentences[0].print_dependencies()
@tnaka78
Copy link
Author

tnaka78 commented Feb 3, 2019

The result is as follows:

('私', '7', 'nsubj')
('は', '1', 'case')
('自然', '5', 'amod')
('言語', '5', 'compound')
('処理', '7', 'obj')
('を', '5', 'case')
('勉強', '0', 'root')
('し', '7', 'aux')
('て', '7', 'mark')
('い', '7', 'aux')
('ます', '7', 'aux')
('。', '7', 'punct')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment