SavchenkoValeriy / emacs-powerthesaurus

Powerthesaurus integration for Emacs
GNU General Public License v3.0
269 stars 11 forks source link

Show the rating of the results #19

Closed msteinbeck closed 1 year ago

msteinbeck commented 2 years ago

Synonyms, antonyms, phrases etc. on powerthesaurus have a rating. It would be useful to show the rating of each result.

maxchaos commented 2 years ago

The results displayed on powerthesaurus.org are sorted by default based on ratings, although from what I can see, these values are not publicly available. The current implementation of this package extracts results using the default sorting criteria and displays them in the minibuffer in that exact order. From what I gather, this is the closest to the functionality that you describe above. Are you suggesting to also enumerate the results in the minibuffer?

msteinbeck commented 2 years ago

That the entries are sorted according to their rating makes sense. However, the rating of an entry could be twice as good as the rating of the next entry. From the sorting we now which one is rated better but we don't know "how much" better is (well, one could argue that ratings aren't metrics, but... still).

maxchaos commented 2 years ago

I agree with you that including ratings is useful and it's worth implementing as a feature. The problem here is that the webservice does not include ratings associated with each synonym, antonym, etc displayed on the results page of a query (at the very least, I do not see such values without logging in). Unless I am missing something here, then there is no way to access and extract these values from the results in order to include them along with the candidates during completion.

SavchenkoValeriy commented 1 year ago

JSON from the page does contain rating information:

  "Term:1236": {
    "__typename": "Term",
    "id": "1236",
    "name": "wonderful",
    "slug": "wonderful"
  },
  "Thesaurus:{\"id\":\"19260414\",\"_type\":\"COMMON\"}": {
    "__typename": "Thesaurus",
    "_type": "COMMON",
    "id": "19260414",
    "isPinned": null,
    "targetTerm": {
      "__ref": "Term:1236"
    },
    "relations": {
      "tags": [
        "amazing",
        "good"
      ],
      "parts_of_speech": [
        1
      ]
    },
    "rating": 219,
    "vote": null,
    "votes": {
      "up": 219,
      "down": 1,
      "votes": 220
    }
  }

you can see that it even has the number of upvotes and downvotes for each term.