に生の文字列を変換するには、私は生の文字列の代わりに\n
のNLTK:通常の文字列
>>>from nltk.corpus import reuters
>>>retail_article = reuters.raw('training/8173')
>>>print (retail_article)
"FRENCH GDP SHOULD RISE 2.3 PCT IN 1988 - MINISTRY\n French gross domestic
product should grow\n by 2.3 pct in 1988 after two pct growth this year
and 2.1 pct\n in 1986, the Finance Ministry said.\n The latest
forecast,...
として、私はテキストが別の行になりたい、NLTKのロイターコーパスからの記事を持っています。どうすれば同じことができますか?
>>>type(retail_article)
str
decode()
文字列では動作しません、とencode()
は、所望の結果を与えていません。
TIA