Ranking tweets from most relevant to least relevant in a document using Python
<p>I have a document with, say, 15 tweets. Given a query, how can we rank the tweets from most relevant to the query to least relevant?</p>

<p>That is, let D be the document containing 15 tweets:</p>

<pre><code>D = ['Tweet 1', 'Tweet 2' ..... 'Tweet 15']
Q = "some noun phrase"
</code></pre>

<p>Given Q, what method we can use for ranking the tweets from most relevant to least relevant?</p>

<p>All tweets are similar and belong to the same topic.
Can I use <a href="https://en.wikipedia.org/wiki/Tf%E2%80%93idf" rel="nofollow">tf-idf</a> (it's a bad idea, I think), topic modelling?</p>

<p>It can be on the basis of how many words contained in the tweet are contained on the tweet topic. If they are on the same topic or the top topic, ranking should be a good idea.</p>

python python-2.7 tf-idf topic-modeling