我正在使用Scikit进行功能选择,但我希望得到文本中所有unigrams的得分值。我得到了分数,但我如何将这些分数映射到实际的特征名称。
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_selection import SelectKBest, chi2
Texts=["should schools have uniform","schools discipline","legalize marriage","marriage culture"]
labels=["3","3","7","7"]
vectorizer = CountVectorizer()
term_doc=vectorizer.fit_transform(Texts)
ch2 = SelectKBest(chi2, "all")
X_train = ch2.fit_transform(term_doc, labels)
print ch2.scores_
这会给出结果,但我如何知道哪些功能名称映射到哪些分数?