# elvitapaskauskaite/documentqa architecture

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

- Interactive diagram: https://gitdiagram.com/elvitapaskauskaite/documentqa
- Repository: https://github.com/elvitapaskauskaite/documentqa

## Overview

This is a Java document-search learning project. Its implemented workflow is loading text, splitting it into paragraph-based chunks, and keyword-searching for matching chunks. Semantic search and embedding/vector comparison are in progress; answer generation, PDF support, and a REST API are planned, not current capabilities. The README documents these stages but no source excerpts were provided, so edges reflect only README-described relationships; internal calls and runtime entry points cannot be verified.

Main entry points: [`src/com/example/documentqa/TextSplitter.java`](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/TextSplitter.java) (Text Splitter), [`src/com/example/documentqa/SearchService.java`](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/SearchService.java) (Keyword Search), [`src/com/example/documentqa/DocumentLoader.java`](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/DocumentLoader.java) (Document Loader), [`src/com/example/documentqa/SemanticSearchService.java`](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/SemanticSearchService.java) (Semantic Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_document_processing["Document Processing"]
  node_document_loader["Document Loader"]
  node_document["Document<br/>[Document.java]"]
  node_text_splitter["Text Splitter<br/>[TextSplitter.java]"]
  node_text_chunk["Text Chunk<br/>[TextChunk.java]"]
end

subgraph group_retrieval["Search and Retrieval"]
  node_search_service["Keyword Search<br/>[SearchService.java]"]
end

subgraph group_semantic["Semantic Search"]
  node_semantic_search["Semantic Search"]
  node_embedding_model["Embedding Model"]
  node_bag_of_words["Bag-of-Words Model"]
  node_ollama_model["Ollama Model"]
  node_vector_math["Vector Math<br/>[VectorMath.java]"]
  node_embedding_score["Embedding Score"]
end

node_user(("Document User"))

node_document_loader -->|"loads then chunks"| node_text_splitter
node_text_splitter -->|"chunks for search"| node_search_service
node_search_service -->|"returns matches"| node_user
node_semantic_search -.->|"compares vectors"| node_vector_math

click node_document_loader "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/DocumentLoader.java"
click node_document "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/Document.java"
click node_text_splitter "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/TextSplitter.java"
click node_text_chunk "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/TextChunk.java"
click node_search_service "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/SearchService.java"
click node_semantic_search "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/SemanticSearchService.java"
click node_embedding_model "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/EmbeddingModel.java"
click node_bag_of_words "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/BagOfWordsEmbeddingModel.java"
click node_ollama_model "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/OllamaEmbeddingModel.java"
click node_vector_math "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/VectorMath.java"
click node_embedding_score "https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/EmbeddingScore.java"

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_document_loader,node_document,node_text_splitter,node_text_chunk,node_user toneBlue
class node_search_service toneAmber
class node_semantic_search,node_embedding_model,node_bag_of_words,node_ollama_model,node_vector_math,node_embedding_score toneMint
```

## Components

### Document Processing

- [Document Loader](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/DocumentLoader.java): `src/com/example/documentqa/DocumentLoader.java`
- [Document](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/Document.java): `src/com/example/documentqa/Document.java`
- [Text Splitter](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/TextSplitter.java): `src/com/example/documentqa/TextSplitter.java`
- [Text Chunk](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/TextChunk.java): `src/com/example/documentqa/TextChunk.java`

### Search and Retrieval

- [Keyword Search](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/SearchService.java): `src/com/example/documentqa/SearchService.java`

### Semantic Search

- [Semantic Search](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/SemanticSearchService.java): `src/com/example/documentqa/SemanticSearchService.java`
- [Embedding Model](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/EmbeddingModel.java): `src/com/example/documentqa/EmbeddingModel.java`
- [Bag-of-Words Model](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/BagOfWordsEmbeddingModel.java): `src/com/example/documentqa/BagOfWordsEmbeddingModel.java`
- [Ollama Model](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/OllamaEmbeddingModel.java): `src/com/example/documentqa/OllamaEmbeddingModel.java`
- [Vector Math](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/VectorMath.java): `src/com/example/documentqa/VectorMath.java`
- [Embedding Score](https://github.com/elvitapaskauskaite/documentqa/blob/main/src/com/example/documentqa/EmbeddingScore.java): `src/com/example/documentqa/EmbeddingScore.java`

### Other components

- **Document User**

## Connections

- Document Loader → Text Splitter: loads then chunks (evidence: `README.md`)
- Text Splitter → Keyword Search: chunks for search (evidence: `README.md`)
- Keyword Search → Document User: returns matches (evidence: `README.md`)
- Semantic Search → Vector Math: compares vectors (evidence: `README.md`)
