reluce / szurubooru-toolkit

Python package and script collection to manage your szurubooru image board.
GNU General Public License v3.0
41 stars 11 forks source link

Suggestion: add implications autotagger #20

Closed noirscape closed 2 years ago

noirscape commented 2 years ago

Basically, add a script that:

Right now, szurubooru doesn't retroactively update implications and it's not a feature that's planned to be added (see https://github.com/rr-/szurubooru/issues/189 ), but it's a rather heavy maintenance burden for creating proper tag implication structures, especially for tags that encompass large amounts of posts.

reluce commented 2 years ago

Sounds like a good idea!

My suggestion would be to add a switch called --update-implications to the tag_posts.py script. With that, we can narrow down the posts which we want to update with a query. If we want to loop through all posts, we just use a wildcard (*) as the query. Another benefit would be that we don't have to loop through all tags in the database (where possible a lot of tags don't belong to a post if we used the create_tags.py script), which might benefit performance.

noirscape commented 2 years ago

I fully agree with that assessment yeah, that sounds like a good optimization.

reluce commented 2 years ago

I added the switch --update-implications as mentioned to the script tag_posts.py in the branch update-implications. You can go ahead and try if it works for you. I'll merge it to main later on.

It's quite slow though (up to a minute, depending on the amount of tags), as I'm using the szuru module which builds a whole object for each tag, but as it's working for now, I'll leave it at that.