title: Python: How can I fetch passages containing given keywords from a text file
body: <p>I am trying to implement a factoid based question answering system. So far I have retrieved candidate text documents which may contain answers.
  But now I am stuck where I have to extract right passages from the documents based on the keywords provided.</p>
  
  <p>I have briefly studied approaches like LCC and InsightSoft, but cannot figure out how to move forward.</p>
  
  <p>Consider that I have a document containing many paragraphs(passages).I want to rank these paragraphs based on certain keywords.</p>
  
  <p><strong>Example:</strong></p>
  
  <p>Keywords- <em>leopard</em>, <em>lion</em></p>
  
  <p>Para 1: "..no sentence about <em>leopard</em> or <em>leopard</em>..""</p>
  
  <p>Para 2:"..few sentences about <em>lion</em>.."</p>
  
  <p>Para 3:"..sentences about both <em>lion</em> and <em>leopard</em>.."</p>
  
  <p><strong>Goal</strong>: To rank(or fetch) Para 2 and Para 3 </p>
  
  <p>How can I implement(program) the same? 
  And is there a way to rank these passages based on the tag provided to the keywords by a POS tagger?  </p>
  
  <p>Any code or implementation of existing algorithms will be appreciated. Please be elaborate while explaining as I'm not an expert in Python.</p>