[Numpy-tickets] [NumPy] #734: [PATCH] interactive docstring search (lookfor)

NumPy numpy-tickets@scipy....
Thu Apr 10 15:47:45 CDT 2008

#734: [PATCH] interactive docstring search (lookfor)
 Reporter:  pv           |       Owner:  somebody          
     Type:  enhancement  |      Status:  new               
 Priority:  normal       |   Milestone:  1.0.5             
Component:  Other        |     Version:  none              
 Severity:  normal       |    Keywords:  lookfor doc search
 It'd be nice to have a docstring search that could be used interactively:
 >>> import numpy as np
 >>> np.lookfor("eigenvalue hermitean")
 Search results for 'eigenvalue hermitean'
     Compute the eigenvalues of a Hermitean or real symmetric matrix.
     Compute eigenvalues for a Hermitian or real symmetric matrix.
     Compute the eigenvalues of a general matrix.
 >>> np.lookfor("spline interpolat", module="scipy")
 Search results for 'spline interpolat'
     Interpolate a curve (xk,yk) at points xnew using a spline fit.
     Bivariate spline approximation over a rectangular mesh.
     Interpolated univariate spline approximation. Identical to
     Shift an array.
     Zoom an array.
     Find the B-spline representation of 1-D curve.
 ... long result, shown in a pager ...

 This patch implements a simple-minded docstring search:
   - _lookfor_generate_cache walks the contents of the module to search,
 collecting docstrings
   - lookfor splits the search string and searchs for entries that contain
 all parts. No stemming etc. is done.
   - lookfor sorts the results by a Harrison-Stetson relevancy metric (ie.
 I just wrote up some heuristics to distinguish "more relevant" results
 from "less relevant"). It appears to work ok, but probably could be
   - lookfor either prints or calls a pager (via pydoc, for long listings)
 to show the results

 No automated tests at this time, sorry, I only did manual testing now.

Ticket URL: <http://scipy.org/scipy/numpy/ticket/734>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list