NLTK 附带一些语料库样本:http: //nltk.googlecode.com/svn/trunk/nltk_data/index.xml
我只想有没有编码的文本。我不知道如何提取这些内容。我要提取的是
1) nps_chat:解压后文件名类似于 10-19-20s_706posts.xml。此类文件是 XML 格式,例如:
<Posts>
<Post class="Statement" user="10-19-20sUser7">now im left with this gay name<terminals>
<t pos="RB" word="now"/>
<t pos="PRP" word="im"/>
<t pos="VBD" word="left"/>
<t pos="IN" word="with"/>
<t pos="DT" word="this"/>
<t pos="JJ" word="gay"/>
<t pos="NN" word="name"/>
</terminals>
</Post>
...
...
我只想要那个实际的帖子:
now im left with this gay name
在本地磁盘中剥离编码后,如何在 NLTK 或(无论如何)保存裸帖子?
2) 总机成绩单。此类文件(文件名是解压后的discourse)包含以下格式。我想要的是去除前面的标记:
o A.1 utt1: Okay, /
qy A.1 utt2: have you ever served as a juror? /
ng B.2 utt1: Never. /
sd^e B.2 utt2: I've never been served on the jury, never been called up in a jury, although some of my friends have been jurors. /
b A.3 utt1: Uh-huh. /
sd A.3 utt2: I never have either. /
% B.4 utt1: You haven't, {F huh. } /
...
...
我只想拥有:
Okay, /
have you ever served as a juror? /
Never. /
I've never been served on the jury, never been called up in a jury, although some of my friends have been jurors. /
Uh-huh. /
I never have either. /
You haven't, {F huh. } /
...
...
非常感谢您提前。