4
나는 셰익스피어의 NLTK 영장에서 문장 가져하려고
-this 도움말 사이트 다음 -하지만 난 문제 (A word2vec 모델을 학습하기 위해) 문장에 대한 액세스 권한을 얻는 데 :파이썬 NLTK 셰익스피어 전집
from nltk.corpus import shakespeare #XMLCorpusreader
shakespeare.fileids()
['a_and_c.xml', 'dream.xml', 'hamlet.xml', 'j_caesar.xml', ...]
play = shakespeare.xml('dream.xml') #ElementTree object
print(play)
<Element 'PLAY' at ...>
for i in range(9):
print('%s: %s' % (play[i].tag, play[i].text))
을 다음을 반환합니다.
TITLE: A Midsummer Night's Dream
PERSONAE:
SCNDESCR: SCENE Athens, and a wood near it.
PLAYSUBT: A MIDSUMMER NIGHT'S DREAM
ACT: None
ACT: None
ACT: None
ACT: None
ACT: None
왜 모든 행위가 없습니까?
내가 이해하고자하는 셰익스피어의 XMLCorpusReader에 적용 할 때 여기에 정의 된 방법 (http://www.nltk.org/howto/corpus.html#data-access-methods)의
없음 (.sents(), tagged_sents(), chunked_sents(), parsed_sents는()) 제대로 작동하지 :
1/문장 ElementTree 객체