Universal on-line grammar check with google ajax search api

    Usually I check the English grammar, driving in chunks of phrases on Google, and see what happens.
    If many options are found, then the phrase is correct, if not very many, then it is incorrect. So, he wrote a service that sends requests to Google, and he himself highlights, “correctly” or “incorrectly” pieces of the sentence are written, and in some places even tells you which word can be put on one or another place in the sentence. He also shows in which context the word is found. The great thing is that he doesn't care what language you check. You enter a phrase in the text box, and the check starts automatically. The phrase you are checking is displayed below the input field, and for some words, options are suggested. Inappropriate words are highlighted in red.

    image










    The logic of validation is simple. The phrase is broken into pieces covering it, which are then checked. For example, from the phrase “Masha loves Sasha very much” we will get, among other things, a slice of “Masha loves Sasha very much”. There will be two checking requests for him: “he loves * very much” and “loves sasha very much”. And if the query “loves * very much” ”gives a thousand times more answers than“ loves Sasha very much ”, it means that“ Sasha ”is not suitable here, and you need to choose some other option.

    When you hover over an option, the context in which it occurs is shown. If you click on an option, it will replace the corresponding word in the sentence. When you hover over a word in the phrase itself, statistics are shown for the word: how many documents were found by an asterisk, and how many by exact match.

    image

    My server part is completely absent, that is, the page is written exclusively in html + javascript.

    It is clear that she does not check the grammar perfectly, and sometimes does not check it at all. But you can see whether the words combine well or poorly, look at statistics in a convenient way, pay attention to possible inconsistencies, find other matching words, or use something else.

    PS
    I still have a few questions regarding the google search api license agreement. (I read the English version, because the Russian one was almost written by google translate)
    1. Is it obligatory to put a link to the site on which the content was found (I didn’t find exactly such lines, although I put the link)?
    2. What are the restrictions on the number (officially there are none, but obviously there should be. For each sentence of n words, 2n + 4 requests are sent to me. I have caching during one page load (though there is no cache reset for a long time you’re sitting :)), but this will not save in general.)

    Initially, the service did not expect the ability to access sites from which the content was taken. But in my opinion, this opportunity should be given, since other people's materials are still used, albeit indirectly.
    So far, I have not been able to implement this feature so that it does not spoil the interface.
    So I made the links, but except with the help of the tab, you can’t get to them :).

    PPS I

    also forgot to write that there is a limit on the length of a phrase - somewhere around 25 words.
    Still, the layout is not designed for long phrases, it goes if the phrase creeps out of the window.
    So far, I don’t even know if it is necessary to do something with this, or it can simply prohibit the user from entering too many words,
    because the service is not designed for long phrases or texts.
    Rather - to check small offers :)

    Also popular now: