meetDeveloper / freeDictionaryAPI

There was no free Dictionary API on the web when I wanted one for my friend, so I created one.

Home Page:https://dictionaryapi.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Order things as an Array

rawandahmad698 opened this issue · comments

Hello there,

Thank you for the great effort you put in to this, we have an application and we use your script to scrape Google Dictionary Data.

At this moment, we have to loop through word classes e.g noun, verb, adjective in order to get the data, However. these three aren't the only ones, there are nounarchaic, nounBotany, verbFormal and a lot more we don't know..

So, we can't actually get the data, since it's a Dictionary, we have to indicate the word class in our code to get a word data, for example

screenshot at may 28 20-30-18
Language: Swift

Here json2 is a Dictionary on your server, and we use the word class to get the word details, without that, we can't grab the data

So my question is, can you re-order the data?

Something like this?
https://api.myjson.com/bins/bwrf2

Use https://jsonlint.com to view it more precisely

This would be so awesome, can you do this?

I will try to solve what you propose here, Sorry for late reply, notification for issues does not come on my mail, it would from now on, Sorry for late response.

Actually can you tell me, this json2 is object right?? Which you made from json response.

I think what you need is Mirror, https://developer.apple.com/documentation/swift/mirror. It will help you out. In case you find any trouble you can ask for help.

You can take a look at this https://makeitnew.io/reflection-in-swift-68a06ba0cf0e. It will help you a lot and definitely solve your problem.

I have introduced v2 of API that will solve this problem. Kindly look at the readme.

Hello @meetDeveloper. First, I'd like to congratulate you on your work this API... it's really amazing. I've been currently working on an app prototype which uses your dictionary API to retrieve word entries. Since I noticed a change in behavior lately, I checked the code here in Github and saw that changes were actually made to it.

As previously mentioned, this structure change really helped a lot, since I dealt with the same problems when retrieving and parsing the data. The change that I noticed and made me come here is that the phonetic data isn't being retrieved anymore, as it seems. I just would like to confirm that this is the intended behavior, and not some sort of bug/problem of the API.

Best regards,
Bruno.

Actually the code here is not the current one, can you exactly tell me your problem, which version are you using and for which language?

I started working with the version available at https://dictionaryapi.dev/, which I believe is the v1 version. I first started about 2-3 weeks ago, and I remember it retrieved phonetic data (in IPA style) alongside definitions. I'm noticing that the both the v1 and v2 (which I discovered when browsing this page) aren't retrieving phonetic data anymore.

I just tested this in versions v1 and v2 with the following words (in english): link, love, sky, in, scourge. I explicitly remember that the word 'link' had phonetics associated with it (I had to make changes in my app to accept the different encoding and I used 'link' as reference for it).

@brunodema Thanks for bringing this up, I will fix this as soon as possible. Sorry for the inconvenience.

@brunodema I have fixed this now, could you check once. Sorry for so late reply, life got me little busy. Can you check once and tell me? Again I am sorry for the inconvenience you faced.

Hello @meetDeveloper. Sorry, but I set github notifications as spam due to some annoyances lately.

I just tested the API with the same 5 words that I previously used and all of them returned the new (at least I assume that you implemented this in the last build) phonetic structure, with both IPA pronunciation and link for audio pronunciation.

All words retrieved both attributes, except 'love', which had it's IPA text empty (but retrieved the audio link).

I also took the opportunity to check the retrieved phonetic data for other languages (german and spanish) for the word 'link' (which is valid for these languages as well). I noticed that the retrieved structure for these entries weren't consistent - that is, sometimes the phonetic branch just returned empty; in other cases it retrieved multiple phonetic results (with only the phonetic text). I also noticed it didn't return the audio link for these languages. French entries also showed this inconsistencies for some words.

I know that these remarks aren't related to my original issue... I just wanted to notify you in case this structure change you adopted was supposed to be universal and not only for the English language. Regardless, thank you very much for taking the time you took to look on these issues :)
Best regards

Best regards.

Can you tell me the non english words you tested, I found the problem for the word love. Fixing it, for others I need to know the words you tried, for the word link in spanish the source I am using does not provide the phonetics, for german it does not provide the audio. Are there any other words that contains inconsistencies?. So when audio exists it will be returned. I will soon make sure non english words have audio most of the times. @brunodema

@brunodema I have fixed the phonetics for love.

I just tested 'love' and it retrieved all fields (text/audio).

I'll mention a few words that I tested for some languages that I know of:

French:

  • fromage: both empty;
  • aile: both empty;
  • mon: both empty.

German:

  • Kopf: retrieves a 'phonetic' struct (has IPA text data) and a 'phonetics' struct (the same IPA text from the other struct, no audio);
  • Wurst: retrieves a 'phonetic' struct (has IPA text data) and a 'phonetics' struct (the same IPA text from the other struct, no audio);
  • Kirche: retrieves a 'phonetic' struct (has IPA text data) and a 'phonetics' struct (has two identical 'text' fields with the same IPA text as the other struct, no audio);

Italian:

  • ala: retrieves a 'phonetic' struct (has IPA text data) and a 'phonetics' struct (the same IPA text from the other struct, no audio);
  • casa: retrieves a 'phonetic' struct (has IPA text data) and a 'phonetics' struct (the same IPA text from the other struct, no audio);
  • giro: retrieves a 'phonetic' struct (has IPA text data) and a 'phonetics' struct (the same IPA text from the other struct, no audio);

These were all random words that I thought of. I'll try to take a look on the code and help, If I can.

So, as an exercise to both learn node.js, and to try help you with the API, I cloned this repository and tested it for a while. After a couple of hours digging stuff (due to lack of knowledge hehe), I noticed that dictionary.js contains the v1 implementation of the API, and not the current one - at least that's what I assumed after testing it with the word 'hi', which retrieved me the old data structure, with no 'partOfSpeech'. Am I crazy or does this version contain the current implementation?

@brunodema Actually in repository the code is not present for the v2 implementation. The code uploaded is little different from here.

I am relaying what google is sending me in some cases it just send the text and in some it send the audio also, I am just relaying it back. I checked for all the words you mentioned google is sending me the same data, for most cases it does not send the audio back, but I have a way to have the audio, I will soon update the API to include those.

Regarding the phonetic struct, I kept that for backward compatibility when I introduced the phonetics. I will soon remove that entirely

OK, no problem @meetDeveloper . I just wanted to let you know in case something unplanned by the app was happening.

If you decide to put v2 here or somewhere else, let me know... I'd like to take a look and see if I can help.

@brunodema Thanks, I will soon push the commit to github. :) Is there any particular thing you want to see in the API?

Nah, nothing in particular at the moment. After reading the current version's code, I could understand the flow of information in the API and from where you take the information, so I believe that v2 probably has the same structure. Once you post it here I'll try to mess with it a little, at least while I have time to do so.

@brunodema Sure, I am closing this ticket then. Will keep you updated when I post v2 API here. 😊

@meetDeveloper any success with posting the v2 API ? Thanks.