yomichan icon indicating copy to clipboard operation
yomichan copied to clipboard

[Feature Request] Allow selecting 1 pitch accent dictionary during card creation when multiple pitch accent dictionaries are installed

Open kuroahna opened this issue 3 years ago • 5 comments

If you have multiple pitch accent dictionaries installed, and click the Add Expression button, the {pitch-accent-positions} and {pitch-accent-graphs} will import all of them.

Example: 読む

NHK 2016 よむ [1]
大辞泉 よむ [1]
新明解第八版 よむ [1]

{pitch-accent-positions} will return [1][1][1]

It would be nice to be able to select one of the dictionaries before clicking Add Expression. If none is selected, it can select the first one by default.

kuroahna avatar Feb 21 '22 21:02 kuroahna

oh snap is there a yomichan conversion of 新明解第八版 out there now?

Thermospore avatar Feb 21 '22 21:02 Thermospore

@Thermospore Yeah, someone in TheMoeWay server shared the pitch accent dictionaries:

- 新明解第八版
- 新明解第七版
- 大辞泉 
- Kanjium
- 大辞林第四版
- NHK 1998
- NHK 2016

Not sure if I can share it here, but you can find it in the #resources-sharing channel

kuroahna avatar Feb 22 '22 01:02 kuroahna

Ah just the pitch accent. Thanks!

AFAIK for yomichan there is only a 7th (but missing some stuff + kinda jank) and 5th (pretty decent conversion, but 25 years old) edition out there at the moment

Thermospore avatar Feb 22 '22 02:02 Thermospore

There is a handlebar in the pinned messages to have one dictionary exported when making a card, the same applies to pitch accent dict but you need to edit the bit of code or ask the person who make(or some people on the server)

Ceynou avatar Feb 22 '22 10:02 Ceynou

Someone shared this so that it returns the first pitch accent information available

{{#*inline "pitch-accent-list-single-dict"}}
    {{~#if (op ">" pitchCount 1)~}}<ol>{{~/if~}}
    {{~#eachUpTo pitches 1~}}
        {{~#each pitches~}}
            {{~#if (op ">" ../../pitchCount 1)~}}<li>{{~/if~}}
                {{~> pitch-accent-item-disambiguation~}}
                {{~> pitch-accent-item format=../../format~}}
            {{~#if (op ">" ../../pitchCount 1)~}}</li>{{~/if~}}
        {{~/each~}}
    {{~else~}}
        No pitch accent data
    {{~/eachUpTo~}}
{{/inline}}

{{#*inline "pitch-accents-single-dict"}}
    {{~> pitch-accent-list-single-dict format='text'~}}
{{/inline}}

{{#*inline "pitch-accent-graphs-single-dict"}}
    {{~> pitch-accent-list-single-dict format='graph'~}}
{{/inline}}

{{#*inline "pitch-accent-positions-single-dict"}}
    {{~> pitch-accent-list-single-dict format='position'~}}
{{/inline}}

I've edited it so that it removes the html tags on pitch-accent-positions-single-dict, remove the ordered list in the graphs, and remove the No pitch accent data text when there's no pitch accent information

{{#*inline "pitch-accent-list-single-dict"}}
    {{~#if (op ">" pitchCount 1)~}}{{~/if~}}
    {{~#eachUpTo pitches 1~}}
        {{~#each pitches~}}
            {{~#if (op ">" ../../pitchCount 1)~}}{{~/if~}}
                {{~> pitch-accent-item-disambiguation~}}
                {{~> pitch-accent-item format=../../format~}}
            {{~#if (op ">" ../../pitchCount 1)~}}{{~/if~}}
        {{~/each~}}
    {{~else~}}
    {{~/eachUpTo~}}
{{/inline}}

{{#*inline "pitch-accents-single-dict"}}
    {{~> pitch-accent-list-single-dict format='text'~}}
{{/inline}}

{{#*inline "pitch-accent-graphs-single-dict"}}
    {{~> pitch-accent-list-single-dict format='graph'~}}
{{/inline}}

{{#*inline "pitch-accent-positions-single-dict"}}
    {{#regexReplace "<(.|\n)*?>" ""}}{{~> pitch-accent-list-single-dict format='position'~}}{{/regexReplace}}
{{/inline}}

kuroahna avatar Jul 18 '22 20:07 kuroahna