An open API service indexing awesome lists of open source software.

https://github.com/cotneo/dictionary_c-

This project is c# study
https://github.com/cotneo/dictionary_c-

Last synced: 10 months ago
JSON representation

This project is c# study

Awesome Lists containing this project

README

          

# CEFR Word Fetcher (C# + WordsAPI)

A SOLID-principled C# console application to:

* Load CEFR-level vocabulary from a dataset
* Randomly select 10 words (optionally by level)
* Fetch definitions and usage examples using WordsAPI
* Output to console or save as JSON

## ๐Ÿš€ Technologies

* C# (.NET 8.0)
* HttpClient
* CSV parsing (CsvHelper)
* JSON serialization (Newtonsoft.Json)
* SOLID Principles implementation

## ๐Ÿ“ Project Structure

```
CEFRWordFetcher/
โ”œโ”€โ”€ CEFRWordFetcher.sln
โ”œโ”€โ”€ /CEFRWordFetcher.Core # Domain models and interfaces
โ”‚ โ”œโ”€โ”€ Models/
โ”‚ โ”‚ โ”œโ”€โ”€ CEFRWord.cs
โ”‚ โ”‚ โ””โ”€โ”€ WordInfo.cs
โ”‚ โ”œโ”€โ”€ Interfaces/
โ”‚ โ”‚ โ”œโ”€โ”€ IWordSelector.cs
โ”‚ โ”‚ โ””โ”€โ”€ IWordsApiService.cs
โ”‚ โ””โ”€โ”€ Services/
โ”‚ โ””โ”€โ”€ RandomWordSelector.cs
โ”‚
โ”œโ”€โ”€ /CEFRWordFetcher.Infrastructure # Data loading (CSV)
โ”‚ โ””โ”€โ”€ CsvLoader.cs
โ”‚
โ”œโ”€โ”€ /CEFRWordFetcher.Api # WordsAPI HTTP service
โ”‚ โ””โ”€โ”€ WordsApiService.cs
โ”‚
โ”œโ”€โ”€ /CEFRWordFetcher.ConsoleApp # Main app (UI entry point)
โ”‚ โ””โ”€โ”€ Program.cs
โ”‚
โ”œโ”€โ”€ /data
โ”‚ โ””โ”€โ”€ cefr_dataset.csv
โ”œโ”€โ”€ /output
โ”‚ โ””โ”€โ”€ output.json
```

## ๐Ÿงช SOLID Principles Applied

| Principle | Implementation |
|-----------|----------------|
| **S - Single Responsibility** | Each class has one job (API, CSV loading, word selection, etc.) |
| **O - Open/Closed** | New word selectors can be added without modifying existing code |
| **L - Liskov Substitution** | Interfaces can be mocked or replaced with different implementations |
| **I - Interface Segregation** | Small, focused interfaces like `IWordsApiService`, `IWordSelector` |
| **D - Dependency Inversion** | Main app depends on abstractions, not concrete implementations |

## โ–ถ๏ธ Usage

### Basic Usage
```bash
dotnet run --project CEFRWordFetcher.ConsoleApp
```

### Filter by CEFR Level
```bash
dotnet run --project CEFRWordFetcher.ConsoleApp -- --level=A1
dotnet run --project CEFRWordFetcher.ConsoleApp -- --level=B2
```

## ๐Ÿ”‘ WordsAPI Setup

1. Sign up: [https://rapidapi.com/dpventures/api/wordsapi](https://rapidapi.com/dpventures/api/wordsapi)
2. Set your API key: `export WORDS_API_KEY="your_api_key_here"`
3. Run the application to fetch detailed word information

## ๐Ÿ“„ License

Maintenance, Author Cotneo