
124
6 章 潜在意味解析を使った Wikipedia の理解
val docScores = US.multiply(termRowVec)
❶
val allDocWeights = docScores.rows.map(_.toArray(0)).
zipWithUniqueId()
❷
allDocWeights.top(10)
}
def printRelevantDocs(term: String) {
val id = idTerms(term)
printIdWeights(topDocsForTerm(normalizedUS, svd.V, id, docIds)
}
❶
すべての文書に対するスコアの計算
❷
最もスコアの高い文書を見つける
printRelevantDocs("fir")
(Silver tree,0.006292909647173194),
(See the forest for the trees,0.004785047583508223),
(Eucalyptus tree,0.004592837783089319),
(Sequoia tree,0.004497446632469554),
(Willow tree,0.004442871594515006),
(Coniferous tree,0.004429936059594164),
(Tulip Tree,0.004420469113273123),
(National tree,0.004381572286629475), ...