Filtering for the handlebars rank vs occurence#2373
Filtering for the handlebars rank vs occurence#2373SHIRO-Suit wants to merge 4 commits intoyomidevs:masterfrom
Conversation
Makes both average rank and harmonic rank use only rank frequencies. And average occurence and harmonic occurence use only occurence frequencies.
Kuuuube
left a comment
There was a problem hiding this comment.
This is not how handlebars changes work. You cannot change an existing upgrade file. You must create a new one, bump the overall yomitan settings version, and run a handlebars apply within that.
Also not all freq dicts have a frequencyMode in them. Can't break handling of them.
|
Ok, I agree this PR is quite extreme completely removing them if a single dictionary has this field. Is it what you meant by breaking their handling ? is it preferable to have the legacy dictionaries being counted in the calculations of both rank and occurence then? |
|
I made changes, I reverted the v24, and set up a new v75 properly I think. Had to run test:unit:write to regenerate the expected json for dictionary-data.js because one test would fail since there are new fields in the class and it generates the object from them to do the assertion. I don't know if it's the right thing to do, let me know. |
Signed-off-by: Searaw <43580252+SHIRO-Suit@users.noreply.github.com>
types/ext/dictionary.d.ts
Outdated
| /** | ||
| * How the frequency should be interpreted. | ||
| */ | ||
| frequencyMode?: 'occurrence-based' | 'rank-based' | null; |
types/ext/translator.d.ts
Outdated
| /** How the frequency should be interpreted. */ | ||
| frequencyMode?: 'occurrence-based' | 'rank-based'; |
There was a problem hiding this comment.
You can import the type with import type * as DictionaryData from './dictionary-data'; and use DictionaryData.FrequencyMode.
- replaced the hard coded frequencymode types in both d.ts files and JSDoc - Added missing end of file newline for the new handlebars template. - Removed the method that was extracted because there was duplicate usage for wrongheadwordindex, and it's no longer there. - made the frequencymode for kanjifrequency required instead since at this point it shouldn't be undefined anymore.

Fix for #2322
Makes both average rank and harmonic rank use only rank frequencies. And average occurence and harmonic occurence use only occurence frequencies.
This prevents having a 10,000 rank frequency word but appears only once in the book and being averaged at 5,000 because of that. completely thowing off anki sort feature.