Is there a way to filter my word results to only characters of the alphabet?


I am a student attempting to make a basic word game with Javascript. I was hoping to request results in my Ajax request that only contained letters of the alphabet. Is this possible?

Additionally, is there any examples I could see of an Ajax request? I am having difficulty understanding where to include my key.

By the way, great API! So much easier to use and understand so far than other options.

Thank you!

Best Answer


  • SimoneSimone Administrator admin
    edited March 2017

    Hi @kurtwilliam !
    I'm happy you like the API, and you're finding it easy to use! :smile:
    Let me ask my colleagues about your questions, someone should get back to you very soon.

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    Hi @kurtwilliam,

    Glad you like the API. The most likely scenario is that you will have to do some pre- and/or post-processing to clean up either the input or the output because there isn't a filter available to limit the types of character used.

    That said, this API is a work in progress and we are keen to take onboard any suggestions from real-life use cases to help us direct our development efforts so, if enough people ask for the same thing we can make it more of a priority.

    Can I ask you what type of game you are trying to create? ...and what type of calls you are trying to make (and to which endpoints)?

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    ...also, regarding the programming examples, that is another area we are looking to develop so I have added Ajax to the list (again, development will be guided by demand)

  • kurtwilliamkurtwilliam Member

    Hello @AmosDuveen and @Simone ,

    Thank you for the quick reply. I am making a game where words will generate within other words (probably going splice the strings returned and insert other strings) and you need to find all of the words. I would just like to call general, frequently used words if possible, but I will have to filter the words after calling them.

    I am sorry but I have only been coding for about 2 months, and am unsure what you mean by endpoints (perhaps you mean Firebase?).

    In terms of suggestions I think more specific filtering of words and a possible random word return based on the total amount of words in the search function.

    Thank you so much!

  • kurtwilliamkurtwilliam Member
    edited March 2017

    Incase anybody finds this and is wondering how to use your app_id and app_key to make an ajax request...

    I was trying to make a request on a localhost using the function

    beforeSend: function(xhr) {
    xhr.setRequestHeader("Accept": "application/json");
    xhr.setRequestHeader("app_id": "YOUR_ID_HERE");
    xhr.setRequestHeader("app_key": "YOUR_KEY_HERE");

    but couldn't because I needed to use a proxy (still unsure why). I used my schools proxy in the url, and in the data object I included

    xmlToJSON: "false",
    "Accept": "application/json",
    "app_id": "YOUR_ID_HERE",
    "app_key": "YOUR_KEY_HERE"
    params:{ SEARCH_PARAMS_HERE }

    Still trying to wrap my head around it (had a lot of help) but I hope that helps someone!

  • SimoneSimone Administrator admin

    Hi @kurtwilliam, I'm intrigued by your game, I'd love to see it when ready!
    I'm glad Amos's comments helped, but if you need any other help at all, do shout.

    @AmosDuveen, could you maybe clarify what you meant by 'endpoints'? (@kurtwilliam was wondering if that meant Firebase) - I'm the least knowledgeable one in this discussion! :)

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    Hi @kurtwilliam,

    We have a large database of dictionary content sitting behind the API, endpoints are just the access points to the various parts of the database e.g. to call up a straightforward dictionary entry, you would use the 'entry' endpoint .../api/v1/entries/en/[word]. To get a clearer idea, try browsing the documentation/developer portal which clearly shows the available endpoints and the applicable filters (just be aware that the URLs produced here are for demonstration purposes only and you will have to change the hostname slightly to get them to work for your app).

  • kurtwilliamkurtwilliam Member

    @AmosDuveen Thank you for the explanation. Learning something every day!

    I see now, I guess I would have to use the wordlist endpoint as I need a list of words instead. I managed to pull an array of 5,000 words, I will use a random start point to get a different list each time and pull a few random results from the array.

    Thanks again @Simone, I will post the game in a week or two when it is completed. Have a great day!

  • SimoneSimone Administrator admin

    @kurtwilliam - cool, I'm looking forward to it! :)

  • kurtwilliamkurtwilliam Member

    @Simone @AmosDuveen

    I have finished the first version of the game: . It still needs a lot of work, but I would like to eventually add difficulty settings (word length, # of words, etc...) user login, score keeping, leaderboards, etc... As you can see, I use your API to pull random words between 3-5 letters! Very useful, thank you so much!

    In terms of suggestions for functionality, it would be very useful for this app if a developer could sort results by frequency of use ( or

    And in terms of the original question I asked (sorting without special characters), I ended up filtering the array with .match method and Regex, as follows:

    let filteredWords = wordsArray.filter((word) => {
    return word.word.match(/\'|-|\ /ig) === null

    Thank you!

  • SimoneSimone Administrator admin

    @kurtwilliam - oh, cool!
    I tried it, I keep losing - and that's without the further difficult settings! :smiley:
    I was trying to form words with the scrambled letters, but I realise it's not allowed, lol :)
    Anyway, it's fun, and a good game for learners.
    Thanks for posting, it is very nice to see how your are using the API, and in a very interesting project as well. :)

  • joughtredjoughtred Member, Administrator, Moderator admin

    Hi @kurtwilliam,

    Would you like to enter this game into our developer competition? You can fill out an entry form here: and just email the link to your game to [email protected] if you would like to be involved.

    If you do enter... good luck!


  • SimoneSimone Administrator admin

    By the way, @kurtwilliam, your game was widely circulated here in the office, you got the whole Dictionaries Marketing department in OUP addicted! :)

  • EditorEditor Member

    I get a 404 now :(

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    Hi @Editor,

    Error code 404 normally indicates that there are no matching entries; can you please post the URL of the can you were attempting to make so I can check it out my end?

  • joughtredjoughtred Member, Administrator, Moderator admin

    Hi @kurtwilliam,

    We're going to mention your game on our Twitter page today! It would be nice to include it in a newsletter in the future, too. Would you be happy for us to do this?

  • Thank you all for the guidance and kind words!

    @joughtred I don't know how I missed out on the rest of this thread, sorry I didn't reply earlier. Totally would have entered that competition but I somehow missed the replies. Wish I saw the tweet!

    @AmosDuveen In regards to point 1, I wrote some! But intend on improving UI so it doesn't need any! In regards to point 2, I ended up storing the "key words" in an array, and double checking users submissions against it to ensure it was a valid submission. Your solution sounds a bit wiser though, had I seen that earlier I would have tried to implement it. I am hoping to have a good V1 of the app released within a few months, hoping to use some of the new API functionality along with it!

    @Editor my apologies, the url was

    Thank you.

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    Hi @kurtwilliam,

    I can't find what the query was that I was responding to with regard to frequency data but, for your information, we now have a new endpoint called "LexiStats" in beta testing that is due for general release in the very near future.

  • Thank you @AmosDuveen. I will certainly test it out.

Sign In or Register to comment.