Dushistov / sdcv

https://dushistov.github.io/sdcv/
GNU General Public License v2.0
288 stars 42 forks source link

Most sdcv output is repeated twice #76

Open clauseggers opened 2 years ago

clauseggers commented 2 years ago

Here’s an odd one. Most output I get from sdcv (0.52) is shown two times. The second output consecutively to the first. However something like sdcv -v is only output once. Here is the output of sdcv -l:

> sdcv -l
Dictionary's name   Word count
The Britannica Concise    24402
Duden    118901
LDaF    57822
Oxford Advanced Learner's Dictionary    34153
English Thesaurus    20003
AHD Indo-European and Semitic Roots Supplement (En-En)    1022
Apresyan (En-Ru)    117141
English Etymology    18380
Obscene language (En-Ru)    226
English-Greek    13357
Oxford English Dictionary 2nd Ed. P1    140086
Latin-English    2300
Longman Dictionary of Common Errors (En-En)    1277
Collins Thesaurus (En-En)    11649
AHD Indo-European and Semitic Roots Supplement (En-En)    1022
American_Idioms 2nd Ed    25740
The Britannica Concise    24402
Duden    118901
LDaF    57822
Oxford Advanced Learner's Dictionary    34153
English Thesaurus    20003
AHD Indo-European and Semitic Roots Supplement (En-En)    1022
Apresyan (En-Ru)    117141
English Etymology    18380
Obscene language (En-Ru)    226
English-Greek    13357
Oxford English Dictionary 2nd Ed. P1    140086
Latin-English    2300
Longman Dictionary of Common Errors (En-En)    1277
Collins Thesaurus (En-En)    11649
AHD Indo-European and Semitic Roots Supplement (En-En)    1022
American_Idioms 2nd Ed    25740

And here the output of an interactive query:

> sdcv bread
Found 16 items, similar to bread.
0)The Britannica Concise-->bread
1)Oxford Advanced Learner's Dictionary-->bread
2)Apresyan (En-Ru)-->bread
3)English Etymology-->bread
4)English-Greek-->bread
5)Oxford English Dictionary 2nd Ed. P1-->bread
6)Longman Dictionary of Common Errors (En-En)-->bread
7)Collins Thesaurus (En-En)-->bread
8)The Britannica Concise-->bread
9)Oxford Advanced Learner's Dictionary-->bread
10)Apresyan (En-Ru)-->bread
11)English Etymology-->bread
12)English-Greek-->bread
13)Oxford English Dictionary 2nd Ed. P1-->bread
14)Longman Dictionary of Common Errors (En-En)-->bread
15)Collins Thesaurus (En-En)-->bread
Your choice[-1 to abort]: 

The doubling of output also happen when I use this shell function:

dict () {
    sdcv -n --utf8-input --utf8-output --color "$@" 2>&1 | fold --width="$(tput cols)" | w3m
}

I’m running it under ZorinOS 16 (which is based on Ubuntu 20.04). I’m at a loss as to why this happens. I’ve manually set the $STARDICT_DATA_DIR to $HOME/.stardict/dic/ and placed the dictionaries in sub-directories within.

cyphar commented 2 years ago

Does this happen if you use the -e (exact / no fuzzy search) option? KoReader has some code that works around the fact that sdcv can output the same entry multiple times if it decides to trigger a fuzzy search after finding an exact search (the exact search finds an entry and outputs it, then fuzzy search finds the same entry and outputs it again).

clauseggers commented 2 years ago

Yup, same outcome.

dosimple commented 2 years ago

I experienced a similar issue awhile ago. It turned out, I had two sets of dictionaries at different locations, both used by sdcv at the same time!