diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-09-26 11:08:16 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-26 11:08:16 -0400 | 
| commit | 9899727d7d53caed4c5b5e68176f7ed7f90a9438 (patch) | |
| tree | 3d764007cf8e86cee23be969a2065a644b27f73d | |
| parent | 88e71f82232781a1bc16701ce4719d770222ec4c (diff) | |
Frequency dictionary sort (#1938)
* Add sortDictionary/sortDictionaryOrder options
* Update options
* Add API.getTermFrequencies
* Add settings
* Implement frequency dictionary sorting
* Update test
* Update test data
* Fix handling of undefined rank-based frequencies
| -rw-r--r-- | ext/css/settings.css | 4 | ||||
| -rw-r--r-- | ext/data/schemas/options-schema.json | 13 | ||||
| -rw-r--r-- | ext/js/background/backend.js | 11 | ||||
| -rw-r--r-- | ext/js/comm/api.js | 4 | ||||
| -rw-r--r-- | ext/js/data/options-util.js | 14 | ||||
| -rw-r--r-- | ext/js/language/translator.js | 112 | ||||
| -rw-r--r-- | ext/js/pages/settings/settings-main.js | 4 | ||||
| -rw-r--r-- | ext/js/pages/settings/sort-frequency-dictionary-controller.js | 169 | ||||
| -rw-r--r-- | ext/settings.html | 68 | ||||
| -rw-r--r-- | test/data/translator-test-inputs.json | 2 | ||||
| -rw-r--r-- | test/data/translator-test-results.json | 204 | ||||
| -rw-r--r-- | test/test-options-util.js | 6 | 
12 files changed, 603 insertions, 8 deletions
| diff --git a/ext/css/settings.css b/ext/css/settings.css index f05ab5e0..cedd9f40 100644 --- a/ext/css/settings.css +++ b/ext/css/settings.css @@ -2259,10 +2259,14 @@ input[type=number].dictionary-priority {  }  .horizontal-flex.horizontal-flex-nowrap {      flex-wrap: nowrap; +    margin-left: 0;  }  .horizontal-flex>* {      margin-left: 0.375em;  } +.horizontal-flex.horizontal-flex-nowrap>*:first-child { +    margin-left: 0; +}  .horizontal-flex-fill {      flex-grow: 1;  } diff --git a/ext/data/schemas/options-schema.json b/ext/data/schemas/options-schema.json index d1fb28ad..2dd3981d 100644 --- a/ext/data/schemas/options-schema.json +++ b/ext/data/schemas/options-schema.json @@ -116,7 +116,9 @@                                      "popupActionBarVisibility",                                      "popupActionBarLocation",                                      "frequencyDisplayMode", -                                    "termDisplayMode" +                                    "termDisplayMode", +                                    "sortFrequencyDictionary", +                                    "sortFrequencyDictionaryOrder"                                  ],                                  "properties": {                                      "enable": { @@ -284,6 +286,15 @@                                          "type": "string",                                          "enum": ["ruby", "ruby-and-reading", "term-and-reading"],                                          "default": "ruby" +                                    }, +                                    "sortFrequencyDictionary": { +                                        "type": ["string", "null"], +                                        "default": null +                                    }, +                                    "sortFrequencyDictionaryOrder": { +                                        "type": "string", +                                        "enum": ["ascending", "descending"], +                                        "default": "descending"                                      }                                  }                              }, diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index b9e1f51b..e76f4cfe 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -125,7 +125,8 @@ class Backend {              ['triggerDatabaseUpdated',       {async: false, contentScript: true,  handler: this._onApiTriggerDatabaseUpdated.bind(this)}],              ['testMecab',                    {async: true,  contentScript: true,  handler: this._onApiTestMecab.bind(this)}],              ['textHasJapaneseCharacters',    {async: false, contentScript: true,  handler: this._onApiTextHasJapaneseCharacters.bind(this)}], -            ['documentStart',                {async: false, contentScript: true,  handler: this._onApiDocumentStart.bind(this)}] +            ['documentStart',                {async: false, contentScript: true,  handler: this._onApiDocumentStart.bind(this)}], +            ['getTermFrequencies',           {async: true,  contentScript: true,  handler: this._onApiGetTermFrequencies.bind(this)}]          ]);          this._messageHandlersWithProgress = new Map([          ]); @@ -748,6 +749,10 @@ class Backend {          this._updateTabAccessibility(url, tab, frameId);      } +    async _onApiGetTermFrequencies({termReadingList, dictionaries}) { +        return await this._translator.getTermFrequencies(termReadingList, dictionaries); +    } +      // Command handlers      async _onCommandOpenSearchPage(params) { @@ -1953,7 +1958,7 @@ class Backend {          const {wildcard} = details;          const enabledDictionaryMap = this._getTranslatorEnabledDictionaryMap(options);          const { -            general: {mainDictionary}, +            general: {mainDictionary, sortFrequencyDictionary, sortFrequencyDictionaryOrder},              scanning: {alphanumeric},              translation: {                  convertHalfWidthCharacters, @@ -1979,6 +1984,8 @@ class Backend {          return {              wildcard,              mainDictionary, +            sortFrequencyDictionary, +            sortFrequencyDictionaryOrder,              removeNonJapaneseCharacters: !alphanumeric,              convertHalfWidthCharacters,              convertNumericCharacters, diff --git a/ext/js/comm/api.js b/ext/js/comm/api.js index 3fa7c92b..cb2fef85 100644 --- a/ext/js/comm/api.js +++ b/ext/js/comm/api.js @@ -168,6 +168,10 @@ class API {          return this._invoke('textHasJapaneseCharacters', {text});      } +    getTermFrequencies(termReadingList, dictionaries) { +        return this._invoke('getTermFrequencies', {termReadingList, dictionaries}); +    } +      // Utilities      _createActionPort(timeout=5000) { diff --git a/ext/js/data/options-util.js b/ext/js/data/options-util.js index 30ffadb1..c8ab2d01 100644 --- a/ext/js/data/options-util.js +++ b/ext/js/data/options-util.js @@ -463,7 +463,8 @@ class OptionsUtil {              {async: false, update: this._updateVersion11.bind(this)},              {async: true,  update: this._updateVersion12.bind(this)},              {async: true,  update: this._updateVersion13.bind(this)}, -            {async: false, update: this._updateVersion14.bind(this)} +            {async: false, update: this._updateVersion14.bind(this)}, +            {async: false, update: this._updateVersion15.bind(this)}          ];          if (typeof targetVersion === 'number' && targetVersion < result.length) {              result.splice(targetVersion); @@ -876,4 +877,15 @@ class OptionsUtil {          }          return options;      } + +    _updateVersion15(options) { +        // Version 15 changes: +        //  Added general.sortFrequencyDictionary. +        //  Added general.sortFrequencyDictionaryOrder. +        for (const profile of options.profiles) { +            profile.options.general.sortFrequencyDictionary = null; +            profile.options.general.sortFrequencyDictionaryOrder = 'descending'; +        } +        return options; +    }  } diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js index 641c9d57..1abf9f4e 100644 --- a/ext/js/language/translator.js +++ b/ext/js/language/translator.js @@ -64,6 +64,8 @@ class Translator {       *   {       *     wildcard: (enum: null, 'prefix', 'suffix'),       *     mainDictionary: (string), +     *     sortFrequencyDictionary: (null or string), +     *     sortFrequencyDictionaryOrder: (enum: 'ascending', 'descending'),       *     removeNonJapaneseCharacters: (boolean),       *     convertHalfWidthCharacters: (enum: 'false', 'true', 'variant'),       *     convertNumericCharacters: (enum: 'false', 'true', 'variant'), @@ -92,7 +94,7 @@ class Translator {       * @returns An object of the structure `{dictionaryEntries, originalTextLength}`.       */      async findTerms(mode, text, options) { -        const {enabledDictionaryMap, excludeDictionaryDefinitions} = options; +        const {enabledDictionaryMap, excludeDictionaryDefinitions, sortFrequencyDictionary, sortFrequencyDictionaryOrder} = options;          let {dictionaryEntries, originalTextLength} = await this._findTermsInternal(text, enabledDictionaryMap, options);          switch (mode) { @@ -115,6 +117,9 @@ class Translator {              await this._expandTermTags(dictionaryEntries);          } +        if (sortFrequencyDictionary !== null) { +            this._updateSortFrequencies(dictionaryEntries, sortFrequencyDictionary, sortFrequencyDictionaryOrder === 'ascending'); +        }          if (dictionaryEntries.length > 1) {              this._sortTermDictionaryEntries(dictionaryEntries);          } @@ -176,6 +181,48 @@ class Translator {          return dictionaryEntries;      } +    /** +     * Gets a list of frequency information for a given list of term-reading pairs +     * and a list of dictionaries. +     * @param termReadingList An array of `{term, reading}` pairs. If reading is null, +     *   the reading won't be compared. +     * @param dictionaries An array of dictionary names. +     * @returns An array of objects with the format +     *   `{term, reading, dictionary, hasReading, frequency}`. +     */ +    async getTermFrequencies(termReadingList, dictionaries) { +        const dictionarySet = new Set(); +        for (const dictionary of dictionaries) { +            dictionarySet.add(dictionary); +        } + +        const termList = termReadingList.map(({term}) => term); +        const metas = await this._database.findTermMetaBulk(termList, dictionarySet); + +        const results = []; +        for (const {mode, data, dictionary, index} of metas) { +            if (mode !== 'freq') { continue; } +            let {term, reading} = termReadingList[index]; +            let frequency = data; +            const hasReading = (data !== null && typeof data === 'object'); +            if (hasReading) { +                if (data.reading !== reading) { +                    if (reading !== null) { continue; } +                    reading = data.reading; +                } +                frequency = data.frequency; +            } +            results.push({ +                term, +                reading, +                dictionary, +                hasReading, +                frequency +            }); +        } +        return results; +    } +      // Find terms internal implementation      async _findTermsInternal(text, enabledDictionaryMap, options) { @@ -1035,7 +1082,20 @@ class Translator {      }      _createTermDefinition(index, headwordIndices, dictionary, dictionaryIndex, dictionaryPriority, id, score, sequences, isPrimary, tags, entries) { -        return {index, headwordIndices, dictionary, dictionaryIndex, dictionaryPriority, id, score, sequences, isPrimary, tags, entries}; +        return { +            index, +            headwordIndices, +            dictionary, +            dictionaryIndex, +            dictionaryPriority, +            id, +            score, +            frequencyOrder: 0, +            sequences, +            isPrimary, +            tags, +            entries +        };      }      _createTermPronunciation(index, headwordIndex, dictionary, dictionaryIndex, dictionaryPriority, pitches) { @@ -1052,6 +1112,7 @@ class Translator {              isPrimary,              inflections,              score, +            frequencyOrder: 0,              dictionaryIndex,              dictionaryPriority,              sourceTermExactMatchCount, @@ -1314,6 +1375,10 @@ class Translator {              i = v2.dictionaryPriority - v1.dictionaryPriority;              if (i !== 0) { return i; } +            // Sort by frequency order +            i = v1.frequencyOrder - v2.frequencyOrder; +            if (i !== 0) { return i; } +              // Sort by term score              i = v2.score - v1.score;              if (i !== 0) { return i; } @@ -1345,6 +1410,10 @@ class Translator {              let i = v2.dictionaryPriority - v1.dictionaryPriority;              if (i !== 0) { return i; } +            // Sort by frequency order +            i = v1.frequencyOrder - v2.frequencyOrder; +            if (i !== 0) { return i; } +              // Sort by term score              i = v2.score - v1.score;              if (i !== 0) { return i; } @@ -1416,4 +1485,43 @@ class Translator {              frequencies.sort(compare);          }      } + +    _updateSortFrequencies(dictionaryEntries, dictionary, ascending) { +        const frequencyMap = new Map(); +        for (const dictionaryEntry of dictionaryEntries) { +            const {definitions, frequencies} = dictionaryEntry; +            let frequencyMin = Number.MAX_SAFE_INTEGER; +            let frequencyMax = Number.MIN_SAFE_INTEGER; +            for (const item of frequencies) { +                if (item.dictionary !== dictionary) { continue; } +                const {headwordIndex, frequency} = item; +                if (typeof frequency !== 'number') { continue; } +                frequencyMap.set(headwordIndex, frequency); +                frequencyMin = Math.min(frequencyMin, frequency); +                frequencyMax = Math.max(frequencyMax, frequency); +            } +            dictionaryEntry.frequencyOrder = ( +                frequencyMin <= frequencyMax ? +                (ascending ? frequencyMin : -frequencyMax) : +                (ascending ? Number.MAX_SAFE_INTEGER : 0) +            ); +            for (const definition of definitions) { +                frequencyMin = Number.MAX_SAFE_INTEGER; +                frequencyMax = Number.MIN_SAFE_INTEGER; +                const {headwordIndices} = definition; +                for (const headwordIndex of headwordIndices) { +                    const frequency = frequencyMap.get(headwordIndex); +                    if (typeof frequency !== 'number') { continue; } +                    frequencyMin = Math.min(frequencyMin, frequency); +                    frequencyMax = Math.max(frequencyMax, frequency); +                } +                definition.frequencyOrder = ( +                    frequencyMin <= frequencyMax ? +                    (ascending ? frequencyMin : -frequencyMax) : +                    (ascending ? Number.MAX_SAFE_INTEGER : 0) +                ); +            } +            frequencyMap.clear(); +        } +    }  } diff --git a/ext/js/pages/settings/settings-main.js b/ext/js/pages/settings/settings-main.js index e8092112..73b5c22c 100644 --- a/ext/js/pages/settings/settings-main.js +++ b/ext/js/pages/settings/settings-main.js @@ -42,6 +42,7 @@   * SentenceTerminationCharactersController   * SettingsController   * SettingsDisplayController + * SortFrequencyDictionaryController   * StatusFooter   * StorageController   * TranslationTextReplacementsController @@ -167,6 +168,9 @@ async function setupGenericSettingsController(genericSettingController) {          const collapsibleDictionaryController = new CollapsibleDictionaryController(settingsController);          collapsibleDictionaryController.prepare(); +        const sortFrequencyDictionaryController = new SortFrequencyDictionaryController(settingsController); +        sortFrequencyDictionaryController.prepare(); +          await Promise.all(preparePromises);          document.documentElement.dataset.loaded = 'true'; diff --git a/ext/js/pages/settings/sort-frequency-dictionary-controller.js b/ext/js/pages/settings/sort-frequency-dictionary-controller.js new file mode 100644 index 00000000..9f167ec1 --- /dev/null +++ b/ext/js/pages/settings/sort-frequency-dictionary-controller.js @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2021  Yomichan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.  If not, see <https://www.gnu.org/licenses/>. + */ + +class SortFrequencyDictionaryController { +    constructor(settingsController) { +        this._settingsController = settingsController; +        this._sortFrequencyDictionarySelect = null; +        this._sortFrequencyDictionaryOrderSelect = null; +        this._sortFrequencyDictionaryOrderAutoButton = null; +        this._sortFrequencyDictionaryOrderContainerNode = null; +        this._getDictionaryInfoToken = null; +    } + +    async prepare() { +        this._sortFrequencyDictionarySelect = document.querySelector('#sort-frequency-dictionary'); +        this._sortFrequencyDictionaryOrderSelect = document.querySelector('#sort-frequency-dictionary-order'); +        this._sortFrequencyDictionaryOrderAutoButton = document.querySelector('#sort-frequency-dictionary-order-auto'); +        this._sortFrequencyDictionaryOrderContainerNode = document.querySelector('#sort-frequency-dictionary-order-container'); + +        await this._onDatabaseUpdated(); + +        yomichan.on('databaseUpdated', this._onDatabaseUpdated.bind(this)); +        this._settingsController.on('optionsChanged', this._onOptionsChanged.bind(this)); +        this._sortFrequencyDictionarySelect.addEventListener('change', this._onSortFrequencyDictionarySelectChange.bind(this)); +        this._sortFrequencyDictionaryOrderSelect.addEventListener('change', this._onSortFrequencyDictionaryOrderSelectChange.bind(this)); +        this._sortFrequencyDictionaryOrderAutoButton.addEventListener('click', this._onSortFrequencyDictionaryOrderAutoButtonClick.bind(this)); +    } + +    // Private + +    async _onDatabaseUpdated() { +        const token = {}; +        this._getDictionaryInfoToken = token; +        const dictionaries = await this._settingsController.getDictionaryInfo(); +        if (this._getDictionaryInfoToken !== token) { return; } +        this._getDictionaryInfoToken = null; + +        this._updateDictionaryOptions(dictionaries); + +        const options = await this._settingsController.getOptions(); +        this._onOptionsChanged({options}); +    } + +    _onOptionsChanged({options}) { +        const {sortFrequencyDictionary, sortFrequencyDictionaryOrder} = options.general; +        this._sortFrequencyDictionarySelect.value = (sortFrequencyDictionary !== null ? sortFrequencyDictionary : ''); +        this._sortFrequencyDictionaryOrderSelect.value = sortFrequencyDictionaryOrder; +        this._sortFrequencyDictionaryOrderContainerNode.hidden = (sortFrequencyDictionary === null); +    } + +    _onSortFrequencyDictionarySelectChange() { +        let {value} = this._sortFrequencyDictionarySelect; +        if (value === '') { value = null; } +        this._setSortFrequencyDictionaryValue(value); +    } + +    _onSortFrequencyDictionaryOrderSelectChange() { +        const {value} = this._sortFrequencyDictionaryOrderSelect; +        this._setSortFrequencyDictionaryOrderValue(value); +    } + +    _onSortFrequencyDictionaryOrderAutoButtonClick() { +        const {value} = this._sortFrequencyDictionarySelect; +        if (value === '') { return; } +        this._autoUpdateOrder(value); +    } + +    _updateDictionaryOptions(dictionaries) { +        const fragment = document.createDocumentFragment(); +        let option = document.createElement('option'); +        option.value = ''; +        option.textContent = 'None'; +        fragment.appendChild(option); +        for (const {title, counts} of dictionaries) { +            if (this._dictionaryHasNoFrequencies(counts)) { continue; } +            option = document.createElement('option'); +            option.value = title; +            option.textContent = title; +            fragment.appendChild(option); +        } +        this._sortFrequencyDictionarySelect.textContent = ''; +        this._sortFrequencyDictionarySelect.appendChild(fragment); +    } + +    async _setSortFrequencyDictionaryValue(value) { +        this._sortFrequencyDictionaryOrderContainerNode.hidden = (value === null); +        await this._settingsController.setProfileSetting('general.sortFrequencyDictionary', value); +        if (value !== null) { +            await this._autoUpdateOrder(value); +        } +    } + +    async _setSortFrequencyDictionaryOrderValue(value) { +        await this._settingsController.setProfileSetting('general.sortFrequencyDictionaryOrder', value); +    } + +    async _autoUpdateOrder(dictionary) { +        const order = await this._getFrequencyOrder(dictionary); +        if (order === 0) { return; } +        const value = (order > 0 ? 'descending' : 'ascending'); +        this._sortFrequencyDictionaryOrderSelect.value = value; +        await this._setSortFrequencyDictionaryOrderValue(value); +    } + +    async _getFrequencyOrder(dictionary) { +        const moreCommonTerms = ['来る', '言う', '出る', '入る', '方', '男', '女', '今', '何', '時']; +        const lessCommonTerms = ['行なう', '論じる', '過す', '行方', '人口', '猫', '犬', '滝', '理', '暁']; +        const terms = [...moreCommonTerms, ...lessCommonTerms]; + +        const frequencies = await yomichan.api.getTermFrequencies( +            terms.map((term) => ({term, reading: null})), +            [dictionary] +        ); + +        const termDetails = new Map(); +        const moreCommonTermDetails = []; +        const lessCommonTermDetails = []; +        for (const term of moreCommonTerms) { +            const details = {hasValue: false, minValue: Number.MAX_SAFE_INTEGER, maxValue: Number.MIN_SAFE_INTEGER}; +            termDetails.set(term, details); +            moreCommonTermDetails.push(details); +        } +        for (const term of lessCommonTerms) { +            const details = {hasValue: false, minValue: Number.MAX_SAFE_INTEGER, maxValue: Number.MIN_SAFE_INTEGER}; +            termDetails.set(term, details); +            lessCommonTermDetails.push(details); +        } + +        for (const {term, frequency} of frequencies) { +            if (typeof frequency !== 'number') { continue; } +            const details = termDetails.get(term); +            if (typeof details === 'undefined') { continue; } +            details.minValue = Math.min(details.minValue, frequency); +            details.maxValue = Math.max(details.maxValue, frequency); +            details.hasValue = true; +        } + +        let result = 0; +        for (const details1 of moreCommonTermDetails) { +            if (!details1.hasValue) { continue; } +            for (const details2 of lessCommonTermDetails) { +                if (!details2.hasValue) { continue; } +                result += Math.sign(details1.maxValue - details2.minValue) + Math.sign(details1.minValue - details2.maxValue); +            } +        } +        return Math.sign(result); +    } + +    _dictionaryHasNoFrequencies(counts) { +        if (typeof counts !== 'object' || counts === null) { return false; } +        const {termMeta} = counts; +        if (typeof termMeta !== 'object' || termMeta === null) { return false; } +        return termMeta.freq <= 0; +    } +} diff --git a/ext/settings.html b/ext/settings.html index 12ea7629..2f9d3fb3 100644 --- a/ext/settings.html +++ b/ext/settings.html @@ -285,6 +285,73 @@                  </div></div>              </div>          </div> +        <div class="settings-item advanced-only"> +            <div class="settings-item-inner settings-item-inner-wrappable"> +                <div class="settings-item-left"> +                    <div class="settings-item-label">Frequency sorting dictionary</div> +                    <div class="settings-item-description"> +                        Sort results using a frequency dictionary. +                        <a tabindex="0" class="more-toggle more-only" data-parent-distance="4">More…</a> +                    </div> +                </div> +                <div class="settings-item-right"> +                    <select id="sort-frequency-dictionary"></select> +                </div> +            </div> +            <div class="settings-item-children more" hidden> +                <p> +                    Enabling this option will sort search results using a specific dictionary. +                    This can be beneficial when using multiple dictionaries which may not have +                    consistent sorting information. +                </p> +                <p> +                    <a tabindex="0" class="more-toggle" data-parent-distance="3">Less…</a> +                </p> +            </div> +            <div class="settings-item-children settings-item-children-group" id="sort-frequency-dictionary-order-container" hidden> +                <div class="settings-item"> +                    <div class="settings-item-inner settings-item-inner-wrappable"> +                        <div class="settings-item-left"> +                            <div class="settings-item-label"> +                                Frequency sorting mode +                                <a tabindex="0" class="more-toggle more-only" data-parent-distance="4">(?)</a> +                            </div> +                        </div> +                        <div class="settings-item-right"> +                            <div class="horizontal-flex horizontal-flex-nowrap"> +                                <button class="low-emphasis" id="sort-frequency-dictionary-order-auto">Auto</button> +                                <select id="sort-frequency-dictionary-order"> +                                    <option value="descending">Occurrence-based</option> +                                    <option value="ascending">Rank-based</option> +                                </select> +                            </div> +                        </div> +                    </div> +                    <div class="settings-item-children more" hidden> +                        <p> +                            Dictionary frequency data can be represented in one of two ways: +                        </p> +                        <ul> +                            <li> +                                <em>Occurrence-based</em>, where the frequency corresponds to a number of occurrences. +                                Large values indicate a more common term. +                            </li> +                            <li> +                                <em>Rank-based</em>, where the frequency value corresponds to a ranking index. +                                Smaller values indicate a more common term. +                            </li> +                        </ul> +                        <p> +                            The correct mode can be determined based on the contents of the dictionary; +                            the <em>Auto</em> button attempts to auto-detect the correct value. +                        </p> +                        <p> +                            <a tabindex="0" class="more-toggle" data-parent-distance="3">Less…</a> +                        </p> +                    </div> +                </div> +            </div> +        </div>          <div class="settings-item advanced-only"><div class="settings-item-inner settings-item-inner-wrappable">              <div class="settings-item-left">                  <div class="settings-item-label">Maximum number of results</div> @@ -3516,6 +3583,7 @@  <script src="/js/pages/settings/sentence-termination-characters-controller.js"></script>  <script src="/js/pages/settings/settings-controller.js"></script>  <script src="/js/pages/settings/settings-display-controller.js"></script> +<script src="/js/pages/settings/sort-frequency-dictionary-controller.js"></script>  <script src="/js/pages/settings/status-footer.js"></script>  <script src="/js/pages/settings/storage-controller.js"></script>  <script src="/js/pages/settings/translation-text-replacements-controller.js"></script> diff --git a/test/data/translator-test-inputs.json b/test/data/translator-test-inputs.json index a044d226..396c476c 100644 --- a/test/data/translator-test-inputs.json +++ b/test/data/translator-test-inputs.json @@ -14,6 +14,8 @@          "default": {              "wildcard": null,              "mainDictionary": "${title}", +            "sortFrequencyDictionary": null, +            "sortFrequencyDictionaryOrder": "descending",              "removeNonJapaneseCharacters": true,              "convertHalfWidthCharacters": false,              "convertNumericCharacters": false, diff --git a/test/data/translator-test-results.json b/test/data/translator-test-results.json index 0ba82690..c3596a85 100644 --- a/test/data/translator-test-results.json +++ b/test/data/translator-test-results.json @@ -249,6 +249,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -297,6 +298,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -349,6 +351,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -397,6 +400,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -468,6 +472,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -529,6 +534,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -581,6 +587,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -642,6 +649,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -694,6 +702,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -755,6 +764,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -807,6 +817,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -868,6 +879,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -920,6 +932,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -968,6 +981,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -1020,6 +1034,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1068,6 +1083,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -1139,6 +1155,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1200,6 +1217,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -1274,6 +1292,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1335,6 +1354,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -1409,6 +1429,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1470,6 +1491,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -1544,6 +1566,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1605,6 +1628,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -1681,6 +1705,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1742,6 +1767,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -1796,6 +1822,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1857,6 +1884,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -1911,6 +1939,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -1972,6 +2001,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -2026,6 +2056,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -2087,6 +2118,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -2139,6 +2171,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -2187,6 +2220,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -2239,6 +2273,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -2287,6 +2322,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -2358,6 +2394,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -2419,6 +2456,7 @@              "dictionaryPriority": 0,              "id": 11,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                5              ], @@ -2467,6 +2505,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -2515,6 +2554,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -2573,6 +2613,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -2621,6 +2662,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -2692,6 +2734,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -2753,6 +2796,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -2805,6 +2849,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -2866,6 +2911,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -2924,6 +2970,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -2985,6 +3032,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -3037,6 +3085,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3098,6 +3147,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -3156,6 +3206,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3217,6 +3268,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -3291,6 +3343,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3352,6 +3405,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -3428,6 +3482,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3489,6 +3544,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -3543,6 +3599,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3604,6 +3661,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -3662,6 +3720,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3723,6 +3782,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -3797,6 +3857,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3858,6 +3919,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -3934,6 +3996,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -3995,6 +4058,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -4049,6 +4113,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -4110,6 +4175,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -4168,6 +4234,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -4229,6 +4296,7 @@              "dictionaryPriority": 0,              "id": 11,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                5              ], @@ -4287,6 +4355,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4321,6 +4390,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -4340,6 +4410,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4374,6 +4445,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -4393,6 +4465,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4427,6 +4500,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -4446,6 +4520,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4480,6 +4555,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -4501,6 +4577,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4535,6 +4612,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -4556,6 +4634,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4590,6 +4669,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -4611,6 +4691,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4645,6 +4726,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -4666,6 +4748,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4700,6 +4783,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -4719,6 +4803,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4753,6 +4838,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -4772,6 +4858,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4806,6 +4893,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -4831,6 +4919,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -4905,6 +4994,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -4939,6 +5029,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -5013,6 +5104,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -5087,6 +5179,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -5121,6 +5214,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -5197,6 +5291,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -5271,6 +5366,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -5305,6 +5401,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -5359,6 +5456,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -5433,6 +5531,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -5467,6 +5566,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -5519,6 +5619,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -5567,6 +5668,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -5619,6 +5721,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -5667,6 +5770,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -5738,6 +5842,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 2, @@ -5869,6 +5974,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -5903,6 +6009,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -5937,6 +6044,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -5971,6 +6079,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -6086,6 +6195,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 2, @@ -6217,6 +6327,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -6251,6 +6362,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -6285,6 +6397,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -6319,6 +6432,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -6389,6 +6503,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -6437,6 +6552,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -6489,6 +6605,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -6537,6 +6654,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -6612,6 +6730,7 @@            "polite past negative"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -6673,6 +6792,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -6751,6 +6871,7 @@            "polite past negative"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -6812,6 +6933,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -6890,6 +7012,7 @@            "polite past negative"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -6951,6 +7074,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -7029,6 +7153,7 @@            "polite past negative"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7090,6 +7215,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -7166,6 +7292,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7227,6 +7354,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -7281,6 +7409,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7342,6 +7471,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -7396,6 +7526,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7457,6 +7588,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -7511,6 +7643,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7572,6 +7705,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -7624,6 +7758,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7672,6 +7807,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -7724,6 +7860,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7772,6 +7909,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -7843,6 +7981,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -7904,6 +8043,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -7978,6 +8118,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8039,6 +8180,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -8113,6 +8255,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8174,6 +8317,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -8248,6 +8392,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8309,6 +8454,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -8385,6 +8531,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8446,6 +8593,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -8500,6 +8648,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8561,6 +8710,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -8615,6 +8765,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8676,6 +8827,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -8730,6 +8882,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8791,6 +8944,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -8843,6 +8997,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8891,6 +9046,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -8943,6 +9099,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -8991,6 +9148,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -9062,6 +9220,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -9123,6 +9282,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -9197,6 +9357,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -9258,6 +9419,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -9332,6 +9494,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -9393,6 +9556,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -9467,6 +9631,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -9528,6 +9693,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -9604,6 +9770,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -9665,6 +9832,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -9719,6 +9887,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -9780,6 +9949,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -9834,6 +10004,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -9895,6 +10066,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -9949,6 +10121,7 @@            "masu stem"          ],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -10010,6 +10183,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -10062,6 +10236,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -10110,6 +10285,7 @@              "dictionaryPriority": 0,              "id": 1,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                1              ], @@ -10162,6 +10338,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -10210,6 +10387,7 @@              "dictionaryPriority": 0,              "id": 2,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                2              ], @@ -10283,6 +10461,7 @@            "masu stem"          ],          "score": 100, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -10344,6 +10523,7 @@              "dictionaryPriority": 0,              "id": 12,              "score": 100, +            "frequencyOrder": 0,              "sequences": [                6              ], @@ -10382,6 +10562,7 @@          "isPrimary": true,          "inflections": [],          "score": 90, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -10443,6 +10624,7 @@              "dictionaryPriority": 0,              "id": 13,              "score": 90, +            "frequencyOrder": 0,              "sequences": [                7              ], @@ -10483,6 +10665,7 @@            "polite past"          ],          "score": 100, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -10544,6 +10727,7 @@              "dictionaryPriority": 0,              "id": 12,              "score": 100, +            "frequencyOrder": 0,              "sequences": [                6              ], @@ -10582,6 +10766,7 @@          "isPrimary": true,          "inflections": [],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -10713,6 +10898,7 @@              "dictionaryPriority": 0,              "id": 7,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -10747,6 +10933,7 @@              "dictionaryPriority": 0,              "id": 9,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -10781,6 +10968,7 @@              "dictionaryPriority": 0,              "id": 8,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -10815,6 +11003,7 @@              "dictionaryPriority": 0,              "id": 10,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                4              ], @@ -10930,6 +11119,7 @@            "masu stem"          ],          "score": 10, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 0, @@ -11061,6 +11251,7 @@              "dictionaryPriority": 0,              "id": 3,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -11095,6 +11286,7 @@              "dictionaryPriority": 0,              "id": 5,              "score": 10, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -11129,6 +11321,7 @@              "dictionaryPriority": 0,              "id": 4,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -11163,6 +11356,7 @@              "dictionaryPriority": 0,              "id": 6,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                3              ], @@ -11239,6 +11433,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -11273,6 +11468,7 @@              "dictionaryPriority": 0,              "id": 15,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                9              ], @@ -11381,6 +11577,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -11415,6 +11612,7 @@              "dictionaryPriority": 0,              "id": 16,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                10              ], @@ -11471,6 +11669,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -11505,6 +11704,7 @@              "dictionaryPriority": 0,              "id": 17,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                11              ], @@ -11561,6 +11761,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -11595,6 +11796,7 @@              "dictionaryPriority": 0,              "id": 18,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                12              ], @@ -11651,6 +11853,7 @@          "isPrimary": true,          "inflections": [],          "score": 1, +        "frequencyOrder": 0,          "dictionaryIndex": 0,          "dictionaryPriority": 0,          "sourceTermExactMatchCount": 1, @@ -11685,6 +11888,7 @@              "dictionaryPriority": 0,              "id": 19,              "score": 1, +            "frequencyOrder": 0,              "sequences": [                13              ], diff --git a/test/test-options-util.js b/test/test-options-util.js index 0feeb21c..70229683 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -302,7 +302,9 @@ function createProfileOptionsUpdatedTestData1() {              popupActionBarVisibility: 'auto',              popupActionBarLocation: 'top',              frequencyDisplayMode: 'split-tags-grouped', -            termDisplayMode: 'ruby' +            termDisplayMode: 'ruby', +            sortFrequencyDictionary: null, +            sortFrequencyDictionaryOrder: 'descending'          },          audio: {              enabled: true, @@ -593,7 +595,7 @@ function createOptionsUpdatedTestData1() {              }          ],          profileCurrent: 0, -        version: 14, +        version: 15,          global: {              database: {                  prefixWildcardsSupported: false |