[Userscript] WaniKani Open Framework Search Filters

[ General Script Installation instructions ] :point_left: You’ll need a script host plugin like TamperMonkey
[ Open Framework Installation ]

Download the script here:

Description

This is a collection of filters for use with Self Study Quiz and Item Inspector scripts. The filters will be automatically added to the Filter tab in both software settings dialog.

These filters provide a variety of searches for Wanikani Items. Each filter uses as input a series of search terms separated by commas. If you use an IME Japanese commas are accepted. Matches for each search term will be returned.

The filters are:

  • Global Search: Searches for characters, meanings and readings in all items. A match occurs if the search term is a substring of either characters, meanings or readings
  • Exact Search: Searches for characters, meanings and readings in all items. A match occurs if the search term is identical to characters or readings For meanings a match occurs if the search term is identical to one of the words in the meaning.
  • Kunyomi search: Searches for kanji. A match occurs if the search term is a kunyomi reading.
  • Onyomi search: Searches for kanji. A match occurs if the search term is an onyomi reading.
  • Components Search: Searches for radicals and kanji. If the search term is a kanji, a match occurs for radicals in the kanji. If the search term is a vocabulary, a match occurs for the kanji in the vocabulary. If the search term is both a kanji and a vocabulary, both the corresponding radicals and kanji will match.
  • Used In Search: Searches for kanji and vocabulary. If the search term is a radical, a match occurs for the kanji using this radical. If the search term is a kanji, a match occurs for the vocabulary using this kanji. If the search term is both a radical and a kanji, both the corresponding kanji and vocabulary will match.
  • WK Visually Similar: Matches kanji that are visually similar to the search term according to Wanikani built-in visually similar feature.
  • Allow List Search: Matches items where the search term is a substring of an entry in the allow list. The ‘#’ search term matches matches when the allow list is empty.
  • Block List Search: Matches items where the search term is a substring of an entry in the block list. The ‘#’ search term matches matches when the block list is empty.

These filters are broad by design. They will match all three item types unless some of them are inapplicable. You may particularize the search to a specific item type by using the Item Type filter which is built-in Self-Study Quiz and Item Inspector.

Note to developers

You should use wkof.wait_state('statsFilters', 'ready') .to wait for the completion of the filters initialization.

Version History

Version 1.2.0 - Fixing typos, handling radicals with spaces in them, bug fix.
Version 1.1.1 - Fixing typo, performance improvement, adding placeholders
Version 1.0.0 - Original Release.

1 Like

@Saimin when making this filter set I ended up making the Used In search filter which overlaps with your project. The user interface is ridiculously elementary. You have a lot of room to improve on. If you want to use my code to bootstrap your project you have permission to do so.

@rfindley There is a lot of room to improve on the user interface for some of these filters. For my work this will require the html type setting component to be ready for use.

1 Like

I’ll work on it when I get a bit of free time.

1 Like

There is no rush. Take the time you need. I know you have a lot on your plate.

I understand why having the HTML type save settings would be nice, but can’t you just solve it with event handlers for the time being?

1 Like

Not in a filter. I don’t create the dialog so I don’t have access to the global pre_open callback where the event handlers are setup.

Besides it takes more than event handlers.

  • Filters user interface are one line input controlled by a checkbox in Item Inspector and Self-Study quiz. These inputs are generated by these scripts by iterating over the registry. I can’t alter this code from a filter, so I can’t turn these inputs into multi-elements dialogs without the html type.
  • I would like textarea input in the settings. I don’t know how to make this without the html type.
1 Like

Ah, yes, I didn’t think of the particularities of them being filters

1 Like

Version 1.1.1 is out - Download it at the link in the top post.

Correcting a typo. Performance improvements. Adding placeholders.

Version 1.2.0 is out - Download it at the link in the top post

Fixes more typos. Now properly handles radicals with white spaces in their name. Fixes a bug in exact search that caused it to miss some matches.