0
저는 현재 Brown Corpus와 협력 중이며 약간의 문제가 있습니다. 토큰 화 기능을 적용하려면 먼저 Brown Corpus를 문장으로 작성해야합니다.단어를 문장 문자열로 변환하는 방법 - 텍스트 분류
[('pos', 'The Fulton County Grand Jury said Friday an investigation of Atlanta's recent primary election ....'), ('pos', The jury further said in term-end presentments that the City...)]
:
이
[('pos',
['The',
'Fulton',
'County',
'Grand',
'Jury',
'said',
'Friday',
'an',
'investigation',
'of',
"Atlanta's",
'recent',
'primary',
'election',
'produced',
'``',
'no',
'evidence',
"''",
'that',
'any',
'irregularities',
'took',
'place',
'.']),
('pos',
['The',
'jury',
'further',
'said',
'in',
'term-end',
'presentments',
'that',
'the',
'City',
'Executive',
'Committee',
',',
'which',
'had',
'over-all',
'charge',
'of',
'the',
'election',
',',
'``',
'deserves',
'the',
'praise',
'and',
'thanks',
'of',
'the',
'City',
'of',
'Atlanta',
"''",
'for',
'the',
'manner',
'in',
'which',
'the',
'election',
'was',
'conducted',
'.'])
내가 필요로하는처럼 보이는 무언가이다 :
from nltk.corpus import brown
import nltk
target_text = [s for s in brown.fileids()
if s.startswith('ca01') or s.startswith('ca02')]
data = []
total_text = [s for s in brown.fileids()
if s.startswith('ca01') or s.startswith('ca02') or s.startswith('cp01') or s.startswith('cp02')]
for text in total_text:
if text in target_text:
tag = "pos"
else:
tag = "neg"
words=list(brown.sents(total_text))
data.extend([(tag, word) for word in words])
data
나는이 작업을 수행 할 때, 나는 다음과 같다 데이터를 얻을 : 이것은 내가 지금까지 무엇을 가지고
이 문제를 해결할 방법이 있습니까? 이 프로젝트는 예상보다 오래 걸립니다.