Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dictionary API (lexical) [closed]

Tags:

c#

.net

api

Does anyone know a good .NET dictionary API? I'm not interested in meanings, rather I need to be able to query words in a number of different ways - return words of x length, return partial matches and so on...

like image 485
flesh Avatar asked Dec 02 '08 21:12

flesh


People also ask

Is Oxford Dictionary API free?

Free, immediate access The Oxford Dictionaries API gives you access to: flexible endpoints including headwords, parts of speech, definitions, translations, audio, example sentences, labels, and more… data expertly pre-processed by our in-house engineers to ensure accuracy and consistency of format.

Is there an API for dictionary?

The Merriam-Webster Dictionary API gives developers access to a comprehensive resource of dictionary and thesaurus content as well as specialized medical, Spanish, ESL, and student-friendly vocabulary.


1 Answers

Grab the flat text file from an open source spellchecker like ASpell (http://aspell.net/) and load it into a List or whatever structure you like.

for example,

List<string> words = System.IO.File.ReadAllText("MyWords.txt").Split(new string[]{Environment.NewLine}).ToList();

// C# 3.0 (LINQ) example:

    // get all words of length 5:
    from word in words where word.length==5 select word

    // get partial matches on "foo"
    from word in words where word.Contains("foo") select word

// C# 2.0 example:

    // get all words of length 5:
    words.FindAll(delegate(string s) { return s.Length == 5; });

    // get partial matches on "foo"
    words.FindAll(delegate(string s) { return s.Contains("foo"); });
like image 111
James Orr Avatar answered Sep 28 '22 06:09

James Orr