Advertisement
Guest User

Untitled

a guest
Nov 28th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. # >>> xapian.version_string()
  2. # '1.2.5'
  3. # $ python
  4. # Python 2.7.2+
  5.  
  6. import xapian
  7. doc = xapian.Document()
  8. stopper = xapian.SimpleStopper()
  9. stopper.add('de')
  10. stopper.add('a')
  11. gen = xapian.TermGenerator()
  12. gen.set_document(doc)
  13. gen.set_stopper(stopper)
  14. gen.index_text('Atirei o pau no gato de 4 a 8 metros de distancia')
  15. for t in doc.termlist():
  16.     print t.term
  17.  
  18. '''Result:
  19.  
  20. 4
  21. 8
  22. a
  23. atirei
  24. de
  25. distancia
  26. gato
  27. metros
  28. no
  29. o
  30. pau
  31. '''
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement