0

I'm trying to develop a simple script that reads the words of a string, and compare with a dictionary .txt, .dic... or an Array Collection of correct words.

The format of my string is like this:

<data>
    <value>Exmple</value>
</data>
<data>
    <value>Boxx</value>
</data>
<data>
    <value>Softvare</value>
</data>
 <data>
    <value>Adres</value>
</data>

He can only apply the fix on the words that you have within the <value> tag. What he would have me return should be the same structure with the words corrected. This Form.

<data>
    <value>Example</value>
</data>
<data>
    <value>Box</value>
</data>
<data>
    <value>Software</value>
</data>
 <data>
    <value>Adress</value>
</data>

I'm trying to get at first this result using some combinations .replace()

My application will run on a system without internet access. So I need to do something that does not require access to any web service, which requires consultation or at some other file linguaguem. So precisso be developing this checker in jquery / javascript PURE! Is it possible to do this? If yes how can I be doing in my code? Example?

DEMO CODE

$('button').click(function () {
    var code = $('textarea[name=message]').val();

    if ($('#output').length < 1) {
        $("body").append('<h2>Output</h2><textarea id="output" rows="10" cols="100"></textarea>');
    }



    $('#output').val(code);
});

My English is bad I hope my question has been clear and can be understood by you.

user3743128
  • 65
  • 1
  • 7
  • you'll need a database or some file to store all the correct words, then you'll need an algorithm that identifies the closest match. You can google one and convert into a js func. – Sunny Jun 28 '14 at 19:21
  • @Sunny Some example of this? – user3743128 Jun 29 '14 at 00:58
  • The first SO link in google search([this one](http://stackoverflow.com/questions/2294915/what-algorithm-gives-suggestions-in-a-spell-checker)) has pretty good explanations and many a useful references. Hope it will point you in the right direction. – Sunny Jun 29 '14 at 14:30

0 Answers0