meetDeveloper / freeDictionaryAPI

There was no free Dictionary API on the web when I wanted one for my friend, so I created one.
https://dictionaryapi.dev/
GNU General Public License v3.0
2.63k stars 266 forks source link

Empty objects are returned when provided certain words. #40

Closed Niweera closed 4 years ago

Niweera commented 5 years ago

For example 'Zinc'

[
  {
    "word": "zinc",
    "phonetic": "/zɪŋk/",
    "origin": "Mid 17th century from German Zink, of unknown origin.",
    "meaning": {
      "noun": [
        {

        }
      ],
      "verb": [
        {
          "definition": "Coat (iron) with zinc or a zinc compound to prevent rust.",
          "example": "the street lamps are adorned with tiny zinced crowns"
        }
      ]
    }
  }
]

For example 'Women'

[
  {
    "word": "women",
    "phonetic": "/ˈwɪmɪn/",
    "meaning": {

    }
  }
]

For example 'Men'

[
  {
    "word": "men",
    "phonetic": "/mɛn/",
    "meaning": {

    }
  }
]

I reviewed your code and found out that there is an issue with the code in line 205 to 207 in app.js.

if (definition.length === 0) {
           definition = $(item).find(".crossReference").first().text();
}

I suggest you to check the crossReference class again in the Lexico.com site and refactor the code.

Best regards.

stevenlis commented 5 years ago

I think their API was also designed to just accept headwords only.

https://developer.oxforddictionaries.com/documentation

TIP: Entries ONLY works for dictionary headwords. You may need to use the Lemmas endpoint first to link an inflected form back to its headword (e.g., pixels --> pixel).

meetDeveloper commented 5 years ago

@StevenLi-DS I have a way around that, and use that to convert all words like pixels to pixel, so that is not the problem. I know what is happening, will push a fix soon.

Niweera commented 5 years ago

@StevenLi-DS I have a way around that, and use that to convert all words like pixels to pixel, so that is not the problem. I know what is happening, will push a fix soon.

Marvelous. Actually this is where I am stuck at my project. I found a temporary solution for this. But I am eagerly waiting for your solution. Thanks in advance...

stevenlis commented 5 years ago

@meetDeveloper that would be great, but will the API just return the meaning of "man" or including "the plural form of man" as well when passing "men" image

Niweera commented 5 years ago

@meetDeveloper that would be great, but will the API just return the meaning of "man" or including "the plural form of man" as well when passing "men" image

I think there is a possibility to follow the hyperlink such as in the following example. https://www.google.com/search?q=define+men then follow the link as; https://www.google.com/search?q=define+men#dobs=man

ssabbarw commented 4 years ago

I'm now stuck at this, was anybody able to find a work around or a permanent solution? Kindly reply.

meetDeveloper commented 4 years ago

@ssabbarw Will take a closer look at this today. Sorry for the delay.

meetDeveloper commented 4 years ago

@ssabbarw @StevenLi-DS @Niweera Fixed the problems, now meanings will be shown for the words that are not headwords and also added fix for the word such as zinc. This one had different kind of problem, I have fixed them. Kindly check and close the issue if you seem satisfied.

I am really sorry for the long delays, life was too hectic. I am now giving time to this API and improving it. Thanks a lot to you guys for using this API. It feels good when someone uses your project and build something on top of that.

Niweera commented 4 years ago

@meetDeveloper Sorry, I actually forgot that I opened issue since it has been a long time now. I have developed my own dictionary API on top of your dictionary API. Thanks to your API I learned a great many things.

ssabbarw commented 4 years ago

Hi @meetDeveloper thanks for amazing work. Seems to be working for me too.