Inverted index: Difference between revisions

(→‎{{header|Python}}: Fill in implementation of simple and full inverted index code.)
Line 342:
 
=== Full inverted index ===
TheirThere is a re-write of the <code>termsearch</code> function to work off this type of index, as well as a new <code>phrasesearch</code> function
 
The <code>phrasesearch</code> function will return multiple matches in a text, and goes on to show how this can be used to pick the text with most matches.
 
<small>It is assumed that the following code is added to the end of the code for the simple case above and so shares its file opening and parsing results</small>
<lang python>from collections import Counter
 
Anonymous user