MCPcopy Index your code
hub / github.com/geekcomputers/Python / search_apps

Function search_apps

JARVIS/apps.py:94–105  ·  view source on GitHub ↗
(query, limit=8)

Source from the content-addressed store, hash-verified

92
93
94def search_apps(query, limit=8):
95 wanted = normalize_text(query)
96 scored = []
97 for app in load_application_index():
98 app_name = normalize_text(app.get("name", ""))
99 if not wanted or wanted in app_name:
100 score = 1.0
101 else:
102 score = SequenceMatcher(None, wanted, app_name).ratio()
103 if score >= 0.45:
104 scored.append((score, app["name"]))
105 return [name for _, name in sorted(scored, reverse=True)[:limit]]

Callers 1

handle_commandFunction · 0.85

Calls 4

normalize_textFunction · 0.85
load_application_indexFunction · 0.85
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected