betoesquivel

Python Example: How to create a text index

Sep 7th, 2013
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. class index:
  2.     def create(D) :
  3.         for d in D:
  4.             for w in d:
  5.                 i = index.lookup(w) //regresa -1 si no lo encontró
  6.                 if i<0:
  7.                     j = index.add(w)
  8.                     index.append(j,d.id);//.id hace referencia solamente a la url del documento
  9.                 else:
  10.                     index.append(i,d.id);
Advertisement
Add Comment
Please, Sign In to add comment