https://github.com/timhanewich/dictionarydotcom
.NET class library for accessing definitions for words from Dictionary.com
https://github.com/timhanewich/dictionarydotcom
Last synced: 2 months ago
JSON representation
.NET class library for accessing definitions for words from Dictionary.com
- Host: GitHub
- URL: https://github.com/timhanewich/dictionarydotcom
- Owner: TimHanewich
- License: mit
- Created: 2022-02-02T00:45:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-02T01:23:28.000Z (over 4 years ago)
- Last Synced: 2025-12-30T02:14:31.435Z (6 months ago)
- Language: C#
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# Dictionary.com Nuget Package
A light-weight .NET library for accessing word definitions from Dictionary.com.
## Installing
The package is available to install from nuget [here](https://www.nuget.org/packages/DictionaryDotcom). To install via the .NET command line interface:
```
dotnet add package DictionaryDotcom
```
## Retrieving a definition
```
DictionaryService service = new DictionaryService();
DefinitionSet ds = await service.DefineAsync("departmentalize");
foreach (Definition def in ds.Definitions)
{
Console.WriteLine(def.Class.ToString() + " - " + def.Description);
Console.WriteLine("\t" + "Example: " + def.Example);
Console.WriteLine();
}
```
You can also set a `DictionaryBook` to be used as storage for all retrieved definitions. After doing this, next time you request the same word twice from the `DictionaryService` class, the definition will be pulled from a saved copy of response from the initial request.
Example:
```
DictionaryService service = new DictionaryService();
DictionaryBook db = new DictionaryBook();
service.SetStorage(db);
DefinitionSet ds = await service.DefineAsync("departmentalize");
foreach (Definition def in ds.Definitions)
{
Console.WriteLine(def.Class.ToString() + " - " + def.Description);
Console.WriteLine("\t" + "Example: " + def.Example);
Console.WriteLine();
}
Console.WriteLine(JsonConvert.SerializeObject(ds));
```