diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-07-26 19:45:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-26 19:45:30 -0400 |
commit | b0596c8a3c6eb7073750ed07ba862b0ba2d44140 (patch) | |
tree | 71df0f7b1a70a7495bc41a28bdf24d4cac4ff5db /ext/js/display/display-generator.js | |
parent | a9710b8acf6370f229098b172eb2a3aa65ae5dc7 (diff) |
Rename pitchAccent in source code (#1852)
* Rename pitchAccentPosition to pitchAccentDownstepPosition
* Rename function
* Rename
* Rename
* pitches => pronunciations
Diffstat (limited to 'ext/js/display/display-generator.js')
-rw-r--r-- | ext/js/display/display-generator.js | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index f6860b93..95b4224b 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -51,14 +51,14 @@ class DisplayGenerator { const headwordsContainer = node.querySelector('.headword-list'); const inflectionsContainer = node.querySelector('.inflection-list'); - const pitchesContainer = node.querySelector('.pronunciation-group-list'); + const groupedPronunciationsContainer = node.querySelector('.pronunciation-group-list'); const frequencyGroupListContainer = node.querySelector('.frequency-group-list'); const definitionsContainer = node.querySelector('.definition-list'); const headwordTagsContainer = node.querySelector('.headword-list-tag-list'); const {headwords, type, inflections, definitions, frequencies, pronunciations} = dictionaryEntry; - const pitches = DictionaryDataUtil.getPitchAccentInfos(dictionaryEntry); - const pitchCount = pitches.reduce((i, v) => i + v.pitches.length, 0); + const groupedPronunciations = DictionaryDataUtil.getGroupedPronunciations(dictionaryEntry); + const pronunciationCount = groupedPronunciations.reduce((i, v) => i + v.pronunciations.length, 0); const groupedFrequencies = DictionaryDataUtil.groupTermFrequencies(dictionaryEntry); const termTags = DictionaryDataUtil.groupTermTags(dictionaryEntry); @@ -72,8 +72,8 @@ class DisplayGenerator { node.dataset.format = type; node.dataset.headwordCount = `${headwords.length}`; node.dataset.definitionCount = `${definitions.length}`; - node.dataset.pronunciationDictionaryCount = `${pitches.length}`; - node.dataset.pronunciationCount = `${pitchCount}`; + node.dataset.pronunciationDictionaryCount = `${groupedPronunciations.length}`; + node.dataset.pronunciationCount = `${pronunciationCount}`; node.dataset.uniqueTermCount = `${uniqueTerms.size}`; node.dataset.uniqueReadingCount = `${uniqueReadings.size}`; node.dataset.frequencyCount = `${frequencies.length}`; @@ -88,7 +88,7 @@ class DisplayGenerator { this._appendMultiple(inflectionsContainer, this._createTermInflection.bind(this), inflections); this._appendMultiple(frequencyGroupListContainer, this._createFrequencyGroup.bind(this), groupedFrequencies, false); - this._appendMultiple(pitchesContainer, this._createPitches.bind(this), pitches); + this._appendMultiple(groupedPronunciationsContainer, this._createGroupedPronunciation.bind(this), groupedPronunciations); this._appendMultiple(headwordTagsContainer, this._createTermTag.bind(this), termTags, headwords.length); for (const term of uniqueTerms) { @@ -432,19 +432,19 @@ class DisplayGenerator { return this._createTag(this._createTagData(text, 'search')); } - _createPitches(details) { - const {dictionary, pitches} = details; + _createGroupedPronunciation(details) { + const {dictionary, pronunciations} = details; const node = this._templates.instantiate('pronunciation-group'); node.dataset.dictionary = dictionary; - node.dataset.pitchesMulti = 'true'; - node.dataset.pitchesCount = `${pitches.length}`; + node.dataset.pronunciationsMulti = 'true'; + node.dataset.pronunciationsCount = `${pronunciations.length}`; const tag = this._createTag(this._createTagData(dictionary, 'pronunciation-dictionary')); node.querySelector('.pronunciation-group-tag-list').appendChild(tag); let hasTags = false; - for (const {tags} of pitches) { + for (const {tags} of pronunciations) { if (tags.length > 0) { hasTags = true; break; @@ -453,12 +453,12 @@ class DisplayGenerator { const n = node.querySelector('.pronunciation-list'); n.dataset.hasTags = `${hasTags}`; - this._appendMultiple(n, this._createPitch.bind(this), pitches); + this._appendMultiple(n, this._createPronunciation.bind(this), pronunciations); return node; } - _createPitch(details) { + _createPronunciation(details) { const jp = this._japaneseUtil; const {reading, position, nasalPositions, devoicePositions, tags, exclusiveTerms, exclusiveReadings} = details; const morae = jp.getKanaMorae(reading); @@ -474,7 +474,7 @@ class DisplayGenerator { this._appendMultiple(n, this._createTag.bind(this), tags); n = node.querySelector('.pronunciation-disambiguation-list'); - this._createPitchAccentDisambiguations(n, exclusiveTerms, exclusiveReadings); + this._createPronunciationDisambiguations(n, exclusiveTerms, exclusiveReadings); n = node.querySelector('.pronunciation-downstep-notation-container'); n.appendChild(this._pronunciationGenerator.createPronunciationDownstepPosition(position)); @@ -488,7 +488,7 @@ class DisplayGenerator { return node; } - _createPitchAccentDisambiguations(container, exclusiveTerms, exclusiveReadings) { + _createPronunciationDisambiguations(container, exclusiveTerms, exclusiveReadings) { const templateName = 'pronunciation-disambiguation'; for (const term of exclusiveTerms) { const node = this._templates.instantiate(templateName); |