huzheng001/stardict-3

Synonyms should only point to the specific definition pointed to by the .syn file, not to all the definitions for that word

Opened this issue · 2 comments

Often, a synonym is only a synonym for one sense of the word. Right now, StarDict looks at the word pointed to by the synonym and searches it up and returns all definitions for that word, if there are multiple. However, the word pointed to can be just one of the different indices in the .idx file with the same word; StarDict should only point to the definition for the given index, not every identical word in the .idx file; we never specified those as synonyms, just the specific one we put in the .syn file.

e.g. Say you have in your .idx file three different entries for the word "go", one of them is the verb definition, one of them is a noun, one of them is an adjective.

We create a synonym "gone" in the .syn file, pointing to the index for only the verb definition of "go". However, upon searching "gone", StarDict will return the results for all 3 definitions of "go", as if you typed in "go" directly instead.

This is not desirable; we only want the verb definition, because the .syn file points to the .idx index that points only to the verb definition. If we want to make "gone" point to the noun definition too, we can always trivially put in a second synonym in the .syn file for "gone" that points to the noun definition.

This is quite a significant issue for a dictionary, I have been wondering about the same thing.

This behaviour is also annoying when you have a hyperlink within a definition that links to another specific word but said word has multiple entries. Obviously you would want the specific referenced entry to be displayed instead of having multiple entries displayed and be confused as to which one is actually referenced.

A way to go around this issue would be to assign a specific numeric value to each single definition and then treat everything as synonyms but then that value ends up being displayed in the dictionary software which is not optimal.
For instance:
image

ilius commented

Synonyms are stored in syn file, and syn file does not contain any information about which sense is it referring to. And I don't think StarDict format has any understanding of senses and how they are structured inside articles (in html format).

StarDict can look for that synonym within the article, either in bold or heading or in lists (<ol> or <ul>), but this is kinda hacky and specific to certain group of dictionaries.