alfred-dict.cc-workflow icon indicating copy to clipboard operation
alfred-dict.cc-workflow copied to clipboard

Translation for words present in both languages not working correctly

Open Ruko2010 opened this issue 6 years ago • 3 comments

If you have an input word that is present in both languages, the result is not as expected. For Example: dict de en test should output the english translation of test. But it outputs the german ones first: image

If I switch both languages the result stays the same: dict en de test image

Is this an API issue of dict.cc, or a workflow problem?

Ruko2010 avatar Jan 30 '19 11:01 Ruko2010

Hi @Ruko2010, were you able to resolve this?

natterstefan avatar Jun 08 '20 16:06 natterstefan

Sorry, I tried nothing. I was waiting for a response here, so no, no solution yet.

Ruko2010 avatar Jun 08 '20 18:06 Ruko2010

Hi @Ruko2010,

sorry for the late reply. I didn't have notifications enabled for this repo and I'm not checking in that often. Now I'm watching all activity.

Unfortunately the order of languages you're specifying doesn't influence the output. It just indicates in which languages you're interested.

Under the hood the workflow just calls https://www.dict.cc/?s={your-word} and parses the HTML. The page has two columns and to display the results I'm using a simple heuristic. If the word you've entered appears more often in the left column then that's probably the source-language and you're interested in the right results (the target-language).

Now if you're opening https://www.dict.cc/?s=test you see that the left column contains more direct matches to the word test, so the right column will be printed bold as the result.

Is it possible to fix this? Definitely. I'm happy with the 80:20 approach of the simple heuristic, though.

If anyone is interested in improving this workflow I'm more than happy to accept contributions.

Best, Dennis

dennis-tra avatar Feb 12 '21 09:02 dennis-tra