Open CircuitSacul opened 2 years ago
This seems useful to me. I'd like to integrate a fuzzy search algorithm for this (and for peps). I think thats the place to finally oxidize mcoding bot :trollface:
I think thats the place to finally oxidize mcoding bot :trollface:
I was thinking the same thing. rust-fuzzysearch
time?
LETS FUCKING GO Fyi there are fuzzy search dependencies in c but I want to oxidize cause it's fun. Should be done in a way you don't need rustc to contribute though. Also parsing rst isn't a bad place to use rust imo.
Also parsing rst isn't a bad place to use rust imo.
Where are we parsing rst?
I thought we needed to to get doc information. (If we make a RTFM command in this issue)
Sphinx parses the docstrings and creates an objects.inv file. That's what I need to parse. I suppose it could be written in rust, but I'm going to figure it out in python first and then we can RIR if we want.
Fyi there are fuzzy search dependencies in c but I want to oxidize cause it's fun.
Sounds good to me, as long as mCodingBot can use the library without doing anything with rustc.
assign this to me :ball:
unassign this to me not ball
Author of sphobjinv
here. Glad you found the explainer on the objects.inv
syntax useful!
Depending on exactly what you need to do, sphobjinv
includes fuzzy-search capabilities that might be enough for you. In the current v2.3.1 it uses a vendored copy of [fuzzywuzzy
].
Check out the Inventory.suggest()
method -- it won't be nearly as fast as it would be in Rust (though I hopefully will have time to explore increasing performance before too long...), but it's already implemented.
@bskinn we already have a utility for fuzzy searching that uses RapidFuzz. I think it's good enough, but I don't know how it compares to what you're suggesting.
Edit: code is here: https://github.com/mcb-dev/mCodingBot/blob/main/mcodingbot/utils/search.py
That's probably already better than what sphobjinv
would offer, then. :+1: At this point I would only recommend sphobjinv
as a quick path from nothing to something.
I have a grand plan to implement a plugin system for sphobjinv
someday (https://github.com/bskinn/sphobjinv/issues/207), which would allow wiring in custom scorers for suggest
. That's likely a long way off, though... and would be overkill if the default fuzz scoring works fine for you.
It would be cool to have a slash command for searching sphinx documentation. All sphinx docs generate an
object.inv
file, which can be downloaded, parsed, and cached.For example, the python docs: https://docs.python.org/3/ The objects.inv file is: https://docs.python.org/3/objects.inv
I found some great documentation on how to parse this https://sphobjinv.readthedocs.io/en/latest/syntax.html. Once parsed, it can be cached, and then we can probably use some sort of fuzzy search. The cached version of documentation can be set to expire after 24 hours.
For the slash command, I was thinking something like this:
The docs-url can have autocomplete (and we can list more common projects), but will let you specify any valid sphinx url. If the url hasn't been used yet, it'll download/parse/cache it first.