Can we extract the features from this preprocessed news headlines?

时间:2019-06-01 13:59:15

标签: python machine-learning scikit-learn

[['ad', 'sale', 'boost', 'time', 'warner', 'profit'], ['dollar', 'gain', 'greenspan', 'speech'], ['yuko', 'unit', 'buyer', 'face', 'loan', 'claim'], ['high', 'fuel', 'price', 'hit', 'ba', 'profit'], ['pernod', 'takeov', 'talk', 'lift', 'domecq']]

I want to extract features from this list of preprocessed data. Can we extract features from this or am I doing this in a wrong way? I tried keeping all the items in a single list and then extracting features but then I would end up with different shape data then the y dataset.

1 个答案:

答案 0 :(得分:0)

list = [['ad', 'sale', 'boost', 'time', 'warner', 'profit'], ['dollar', 'gain', 
'greenspan', 'speech'], ['yuko', 'unit', 'buyer', 'face', 'loan', 'claim'], ['high', 
'fuel', 'price', 'hit', 'ba', 'profit'], ['pernod', 'takeov', 'talk', 'lift', 
'domecq']]

list[0] = ['ad', 'sale', 'boost', 'time', 'warner', 'profit']
list[0][1] = 'sale'
list[-1][2] = 'talk'