MCPcopy Create free account
hub / github.com/numpy/numpy / relevance

Function relevance

numpy/lib/utils.py:828–842  ·  view source on GitHub ↗
(name, docstr, kind, index)

Source from the content-addressed store, hash-verified

826 'module': -1000, 'object': -1000}
827
828 def relevance(name, docstr, kind, index):
829 r = 0
830 # do the keywords occur within the start of the docstring?
831 first_doc = "\n".join(docstr.lower().strip().split("\n")[:3])
832 r += sum([200 for w in whats if w in first_doc])
833 # do the keywords occur in the function name?
834 r += sum([30 for w in whats if w in name])
835 # is the full name long?
836 r += -len(name) * 5
837 # is the object of bad type?
838 r += kind_relevance.get(kind, -1000)
839 # is the object deep in namespace hierarchy?
840 r += -name.count('.') * 10
841 r += max(-index / 100, -100)
842 return r
843
844 def relevance_value(a):
845 return relevance(a, *cache[a])

Callers 1

relevance_valueFunction · 0.85

Calls 8

stripMethod · 0.80
lowerMethod · 0.80
sumFunction · 0.50
maxFunction · 0.50
joinMethod · 0.45
splitMethod · 0.45
getMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected