# asynccoder-10/spacy_hugging-face architecture

> Architecture diagram of the GitHub repository asynccoder-10/spacy_hugging-face, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/asynccoder-10/spacy_hugging-face
- Repository: https://github.com/asynccoder-10/spacy_hugging-face

## Overview

This repository is an educational NLP project whose final product is a FastAPI text-analysis API. Its principal workflow accepts text, runs sentiment classification and—on the combined endpoint—spaCy entity recognition, then returns validated structured results. Separate curriculum scripts demonstrate tokenization, syntax analysis, custom NER rules, and Hugging Face model loading. The API implementation is sampled; curriculum capabilities are represented from their source excerpts. API model inference runs locally through libraries, not as a remote inference service.

Main entry points: [`mini-project/main.py`](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py) (Full Analysis Endpoint), [`tokenizer_task.py`](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/tokenizer_task.py) (Tokenization Demo), [`custom_tokenizer.py`](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/custom_tokenizer.py) (Custom Tokenizer), [`advance_tokenizer.py`](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/advance_tokenizer.py) (Regex Tokenizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_api_app["FastAPI App<br/>[main.py]"]
  node_request_schema["Request Schema<br/>[main.py]"]
  node_sentiment_endpoint["Sentiment Endpoint<br/>[main.py]"]
  node_full_endpoint["Full Analysis Endpoint<br/>[main.py]"]
  node_response_schemas["Response Schemas<br/>[main.py]"]
end

subgraph group_inference["API NLP Inference"]
  node_sentiment_model["Sentiment Classifier<br/>[main.py]"]
  node_entity_recognition["Entity Recognition<br/>[main.py]"]
end

subgraph group_curriculum["NLP Curriculum"]
  node_tokenization_demo["Tokenization Demo<br/>[tokenizer_task.py]"]
  node_custom_tokenizer["Custom Tokenizer"]
  node_advanced_tokenizer["Regex Tokenizer"]
  node_syntax_analysis["Syntax Analysis<br/>[syntax_task.py]"]
  node_ner_demo["NER Demo<br/>[ner_task.py]"]
  node_custom_ner["Custom NER Rules"]
  node_spacy_check["spaCy Verification<br/>[verify_spacy.py]"]
end

subgraph group_models["Model Exploration"]
  node_transformer_demo["Transformer Sentiment Demo<br/>[sentiment_task.py]"]
  node_hub_model_loading["Hub Model Loading"]
end

node_client(("API Client"))

node_client -->|"sends requests"| node_api_app
node_api_app -->|"routes to"| node_sentiment_endpoint
node_api_app -->|"routes to"| node_full_endpoint
node_sentiment_endpoint -->|"accepts"| node_request_schema
node_full_endpoint -->|"accepts"| node_request_schema
node_sentiment_endpoint -->|"classifies text"| node_sentiment_model
node_full_endpoint -->|"classifies text"| node_sentiment_model
node_full_endpoint -->|"extracts entities"| node_entity_recognition
node_sentiment_endpoint -->|"returns prediction"| node_response_schemas
node_full_endpoint -->|"returns analysis"| node_response_schemas
node_tokenization_demo -->|"segments sentences"| node_tokenization_demo
node_syntax_analysis -->|"parses syntax"| node_syntax_analysis
node_ner_demo -->|"extracts entities"| node_ner_demo
node_custom_ner -->|"applies patterns"| node_custom_ner
node_custom_tokenizer -->|"customizes rules"| node_custom_tokenizer
node_advanced_tokenizer -->|"splits text"| node_advanced_tokenizer
node_spacy_check -->|"checks pipeline"| node_spacy_check
node_transformer_demo -->|"runs classifiers"| node_transformer_demo
node_hub_model_loading -->|"loads pretrained model"| node_hub_model_loading

click node_api_app "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py"
click node_request_schema "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py"
click node_sentiment_endpoint "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py"
click node_full_endpoint "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py"
click node_response_schemas "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py"
click node_sentiment_model "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py"
click node_entity_recognition "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py"
click node_tokenization_demo "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/tokenizer_task.py"
click node_custom_tokenizer "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/custom_tokenizer.py"
click node_advanced_tokenizer "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/advance_tokenizer.py"
click node_syntax_analysis "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/syntax_task.py"
click node_ner_demo "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/ner_task.py"
click node_custom_ner "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/custom_ner_rules.py"
click node_spacy_check "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/verify_spacy.py"
click node_transformer_demo "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/sentiment_task.py"
click node_hub_model_loading "https://github.com/asynccoder-10/spacy_hugging-face/blob/main/huggingface_task.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api_app,node_request_schema,node_sentiment_endpoint,node_full_endpoint,node_response_schemas,node_client toneBlue
class node_sentiment_model,node_entity_recognition toneAmber
class node_tokenization_demo,node_custom_tokenizer,node_advanced_tokenizer,node_syntax_analysis,node_ner_demo,node_custom_ner,node_spacy_check toneMint
class node_transformer_demo,node_hub_model_loading toneRose
```

## Components

### REST API

- [FastAPI App](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py): `mini-project/main.py`
- [Request Schema](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py): `mini-project/main.py`
- [Sentiment Endpoint](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py): `mini-project/main.py`
- [Full Analysis Endpoint](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py): `mini-project/main.py`
- [Response Schemas](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py): `mini-project/main.py`

### API NLP Inference

- [Sentiment Classifier](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py): `mini-project/main.py`
- [Entity Recognition](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/mini-project/main.py): `mini-project/main.py`

### NLP Curriculum

- [Tokenization Demo](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/tokenizer_task.py): `tokenizer_task.py`
- [Custom Tokenizer](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/custom_tokenizer.py): `custom_tokenizer.py`
- [Regex Tokenizer](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/advance_tokenizer.py): `advance_tokenizer.py`
- [Syntax Analysis](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/syntax_task.py): `syntax_task.py`
- [NER Demo](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/ner_task.py): `ner_task.py`
- [Custom NER Rules](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/custom_ner_rules.py): `custom_ner_rules.py`
- [spaCy Verification](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/verify_spacy.py): `verify_spacy.py`

### Model Exploration

- [Transformer Sentiment Demo](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/sentiment_task.py): `sentiment_task.py`
- [Hub Model Loading](https://github.com/asynccoder-10/spacy_hugging-face/blob/main/huggingface_task.py): `huggingface_task.py`

### Other components

- **API Client**

## Connections

- API Client → FastAPI App: sends requests (evidence: `README.md`)
- FastAPI App → Sentiment Endpoint: routes to (evidence: `mini-project/main.py`)
- FastAPI App → Full Analysis Endpoint: routes to (evidence: `mini-project/main.py`)
- Sentiment Endpoint → Request Schema: accepts (evidence: `mini-project/main.py`)
- Full Analysis Endpoint → Request Schema: accepts (evidence: `mini-project/main.py`)
- Sentiment Endpoint → Sentiment Classifier: classifies text (evidence: `mini-project/main.py`)
- Full Analysis Endpoint → Sentiment Classifier: classifies text (evidence: `mini-project/main.py`)
- Full Analysis Endpoint → Entity Recognition: extracts entities (evidence: `mini-project/main.py`)
- Sentiment Endpoint → Response Schemas: returns prediction (evidence: `mini-project/main.py`)
- Full Analysis Endpoint → Response Schemas: returns analysis (evidence: `mini-project/main.py`)
- Tokenization Demo → Tokenization Demo: segments sentences (evidence: `tokenizer_task.py`)
- Syntax Analysis → Syntax Analysis: parses syntax (evidence: `syntax_task.py`)
- NER Demo → NER Demo: extracts entities (evidence: `ner_task.py`)
- Custom NER Rules → Custom NER Rules: applies patterns (evidence: `custom_ner_rules.py`)
- Custom Tokenizer → Custom Tokenizer: customizes rules (evidence: `custom_tokenizer.py`)
- Regex Tokenizer → Regex Tokenizer: splits text (evidence: `advance_tokenizer.py`)
- spaCy Verification → spaCy Verification: checks pipeline (evidence: `verify_spacy.py`)
- Transformer Sentiment Demo → Transformer Sentiment Demo: runs classifiers (evidence: `sentiment_task.py`)
- Hub Model Loading → Hub Model Loading: loads pretrained model (evidence: `huggingface_task.py`)
