big new feature: ability to inspect any paper to see the raw tfidf tokens and their weights that summarize the paper, and which powers the SVM recommendation engine. basically a bit of a debugging / insight feature, but a really good sanity check that papers are being properly represented

This commit is contained in:
Andrej Karpathy
2021-11-21 20:51:01 -08:00
parent e5798ddb2f
commit cf1bef6f53
6 changed files with 161 additions and 13 deletions
+43
View File
@@ -0,0 +1,43 @@
'use strict';
const PaperLite = props => {
const p = props.paper;
return (
<div class='rel_paper'>
<div class='rel_title'><a href={'http://arxiv.org/abs/' + p.id}>{p.title}</a></div>
<div class='rel_authors'>{p.authors}</div>
<div class="rel_time">{p.time}</div>
<div class='rel_tags'>{p.tags}</div>
<div class='rel_abs'>{p.summary}</div>
</div>
)
}
const Word = props => {
const p = props.word;
// word, weight, idf
return (
<div class='rel_word'>
<div class='rel_word_weight'>{p.weight.toFixed(2)}</div>
{/* <div class='rel_word_idf'>{p.idf.toFixed(2)}</div> */}
<div class="rel_word_txt">{p.word}</div>
</div>
)
}
const WordList = props => {
const lst = props.words;
const wlst = lst.map((jword, ix) => <Word key={ix} word={jword} />);
return (
<div>
<div>The following are the tokens and their (tfidf) weight in the paper vector. This is the actual summary that feeds into the SVM to power recommendations, so hopefully it is good and representative!</div>
<div id="wordList" class="rel_words">
{wlst}
</div>
</div>
)
}
ReactDOM.render(<PaperLite paper={paper} />, document.getElementById('wrap'))
ReactDOM.render(<WordList words={words} />, document.getElementById('wordwrap'))