# omar-khecharem/indexation-recherche-information architecture

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

- Interactive diagram: https://gitdiagram.com/omar-khecharem/indexation-recherche-information
- Repository: https://github.com/omar-khecharem/indexation-recherche-information

## Overview

This repository is a set of progressively developed information-retrieval practicals, not a single integrated search service. Its runnable workflow loads a document collection, preprocesses text, builds or uses an inverted index, and searches by term or intersection; TP3 adds TF-IDF statistics and document vectors. The README also describes query vectors, cosine scoring, ranking, and interactive Top-K search, but those stages are not present in the sampled TP3 excerpt, so their implementation links are omitted. The graph reflects only shown calls and documented capabilities.

Main entry points: [`TP3.py`](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py) (Enriched index), [`TP 1.py`](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py) (TP1 document loader), [`documents.tsv`](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/documents.tsv) (TSV collections), [`TP2.py`](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP2.py) (TP2 postings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_corpus["Document input"]
  node_corpusfiles[("TSV collections<br/>[documents.tsv]")]
end

subgraph group_basic["Basic retrieval"]
  node_tp1load["TP1 document loader<br/>[TP 1.py]"]
  node_tp2data["TP2 postings<br/>[TP2.py]"]
  node_tp1prep["Tokenize and filter<br/>[TP 1.py]"]
  node_tp1naive["Naive term search<br/>[TP 1.py]"]
  node_tp1index["Inverted index<br/>[TP 1.py]"]
  node_tp1query["Term lookup<br/>[TP 1.py]"]
  node_tp1intersection["Posting intersection<br/>[TP 1.py]"]
  node_tp2intersection["Skip intersection<br/>[TP2.py]"]
end

subgraph group_ranking["Vector ranking"]
  node_tp3load["TP3 document loader<br/>[TP3.py]"]
  node_tp3prep["TP3 preprocessing<br/>[TP3.py]"]
  node_tp3index["Enriched index<br/>[TP3.py]"]
  node_idf["DF and IDF<br/>[TP3.py]"]
  node_tfidf["TF-IDF weights<br/>[TP3.py]"]
  node_vocabulary["Vocabulary<br/>[TP3.py]"]
  node_vectors["Document vectors<br/>[TP3.py]"]
  node_queryvector["Query vectors"]
  node_cosine["Cosine similarity"]
  node_topk["Ranking and Top-K"]
  node_interactive["Interactive search"]
  node_results["Search results"]
end

node_user(("User"))

node_user -->|"enters term"| node_tp1naive
node_user -->|"enters terms"| node_tp1intersection
node_user -->|"enters terms"| node_tp2intersection
node_corpusfiles -->|"read by"| node_tp1load
node_corpusfiles -->|"opened by"| node_tp2data
node_tp1load -->|"searches"| node_tp1naive
node_tp1load -->|"preprocesses"| node_tp1prep
node_tp1prep -->|"provides terms"| node_tp1index
node_tp1load -->|"builds"| node_tp1index
node_tp1index -->|"queries postings"| node_tp1query
node_tp1index -->|"supplies postings"| node_tp1intersection
node_tp2data -->|"supplies postings"| node_tp2intersection
node_tp3load -->|"preprocesses"| node_tp3prep
node_tp3prep -->|"provides terms"| node_tp3index
node_tp3load -->|"builds"| node_tp3index
node_tp3index -->|"supplies DF"| node_idf
node_tp3index -->|"supplies TF"| node_tfidf
node_idf -->|"provides IDF"| node_tfidf
node_tp3index -->|"provides terms"| node_vocabulary
node_vocabulary -->|"defines dimensions"| node_vectors
node_tfidf -->|"weights terms"| node_vectors
node_vectors -.->|"compared with query"| node_cosine
node_queryvector -.->|"scored against"| node_cosine
node_cosine -.->|"ranks scores"| node_topk
node_topk -.->|"returns"| node_results
node_user -.->|"enters query"| node_interactive
node_interactive -.->|"requests ranking"| node_topk

click node_corpusfiles "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/documents.tsv"
click node_tp1load "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py"
click node_tp2data "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP2.py"
click node_tp3load "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py"
click node_tp1prep "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py"
click node_tp1naive "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py"
click node_tp1index "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py"
click node_tp1query "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py"
click node_tp1intersection "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py"
click node_tp2intersection "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP2.py"
click node_tp3prep "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py"
click node_tp3index "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py"
click node_idf "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py"
click node_tfidf "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py"
click node_vocabulary "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py"
click node_vectors "https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.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_corpusfiles,node_user toneBlue
class node_tp1load,node_tp2data,node_tp1prep,node_tp1naive,node_tp1index,node_tp1query,node_tp1intersection,node_tp2intersection toneAmber
class node_tp3load,node_tp3prep,node_tp3index,node_idf,node_tfidf,node_vocabulary,node_vectors,node_queryvector,node_cosine,node_topk,node_interactive,node_results toneMint
```

## Components

### Document input

- [TSV collections](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/documents.tsv): `documents.tsv`

### Basic retrieval

- [TP1 document loader](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py): `TP 1.py`
- [TP2 postings](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP2.py): `TP2.py`
- [Tokenize and filter](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py): `TP 1.py`
- [Naive term search](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py): `TP 1.py`
- [Inverted index](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py): `TP 1.py`
- [Term lookup](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py): `TP 1.py`
- [Posting intersection](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP%201.py): `TP 1.py`
- [Skip intersection](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP2.py): `TP2.py`

### Vector ranking

- [TP3 document loader](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py): `TP3.py`
- [TP3 preprocessing](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py): `TP3.py`
- [Enriched index](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py): `TP3.py`
- [DF and IDF](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py): `TP3.py`
- [TF-IDF weights](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py): `TP3.py`
- [Vocabulary](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py): `TP3.py`
- [Document vectors](https://github.com/omar-khecharem/indexation-recherche-information/blob/main/TP3.py): `TP3.py`
- **Query vectors**
- **Cosine similarity**
- **Ranking and Top-K**
- **Interactive search**
- **Search results**

### Other components

- **User**

## Connections

- User → Naive term search: enters term (evidence: `TP 1.py`)
- User → Posting intersection: enters terms (evidence: `TP 1.py`)
- User → Skip intersection: enters terms (evidence: `TP2.py`)
- TSV collections → TP1 document loader: read by (evidence: `TP 1.py`)
- TSV collections → TP2 postings: opened by (evidence: `TP2.py`)
- TP1 document loader → Naive term search: searches (evidence: `TP 1.py`)
- TP1 document loader → Tokenize and filter: preprocesses (evidence: `TP 1.py`)
- Tokenize and filter → Inverted index: provides terms (evidence: `TP 1.py`)
- TP1 document loader → Inverted index: builds (evidence: `TP 1.py`)
- Inverted index → Term lookup: queries postings (evidence: `TP 1.py`)
- Inverted index → Posting intersection: supplies postings (evidence: `TP 1.py`)
- TP2 postings → Skip intersection: supplies postings (evidence: `TP2.py`)
- TP3 document loader → TP3 preprocessing: preprocesses (evidence: `TP3.py`)
- TP3 preprocessing → Enriched index: provides terms (evidence: `TP3.py`)
- TP3 document loader → Enriched index: builds (evidence: `TP3.py`)
- Enriched index → DF and IDF: supplies DF (evidence: `TP3.py`)
- Enriched index → TF-IDF weights: supplies TF (evidence: `TP3.py`)
- DF and IDF → TF-IDF weights: provides IDF (evidence: `TP3.py`)
- Enriched index → Vocabulary: provides terms (evidence: `TP3.py`)
- Vocabulary → Document vectors: defines dimensions (evidence: `TP3.py`)
- TF-IDF weights → Document vectors: weights terms (evidence: `TP3.py`)
- Document vectors → Cosine similarity: compared with query (evidence: `README.md`)
- Query vectors → Cosine similarity: scored against (evidence: `README.md`)
- Cosine similarity → Ranking and Top-K: ranks scores (evidence: `README.md`)
- Ranking and Top-K → Search results: returns (evidence: `README.md`)
- User → Interactive search: enters query (evidence: `README.md`)
- Interactive search → Ranking and Top-K: requests ranking (evidence: `README.md`)
