Writing a decent spell checker requires a decent dictionary and logic, you should consider looking at existing ones e.g.
https://github.com/loresoft/NetSpell
https://www.codeproject.com/Articles/5277/NetSpell-Spell-Checker-for-NET
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Dear Sir or Madam,
I have a question about finding the keywords in Json object after reading the file (I read the file like this:
string path = @"path";
var JObject = JsonConvert.DeserializeObject(File.ReadAllText(path));
Console.WriteLine(JObject);).
I would like to solve this with try and catch to check if the keywords exist and also I would like to check the spelling of the keywords after checking the keywords for "is there or not". I have already created the required classes for it (the class looks like this:
public class Driver
{
public string type;
public int speed;
public string label;
public string name;
public int id;
public string startpoint;
public string midPoint;
public string endpoint;
}
--> For example I want to find the keyword Speed in the json object and then I want to make sure that the keyword does not have any misspellings like Sped instead of Speed.
Do you have an idea how I can do this best. Thanks in advance.
With kind regards,
Sela
Writing a decent spell checker requires a decent dictionary and logic, you should consider looking at existing ones e.g.
https://github.com/loresoft/NetSpell
https://www.codeproject.com/Articles/5277/NetSpell-Spell-Checker-for-NET
It is probably easier to look in json in file instead of looking in object for key word
string path = @"path";
string json = File.ReadAllText(path);
bool hasKeyWord = json.Contains("MyKeyWord");
var JObject = JsonConvert.DeserializeObject(json);
You could do something like this if you want to let the framework parse the JSON for you & you just need to check the properties:
(forum blocked posting)
as you are using newtonsoft. you could just use the standard json schema validation support rather than trying to roll your own: