--- title: ResearchRAG emoji: ๐Ÿ“š colorFrom: blue colorTo: indigo sdk: static pinned: false license: mit short_description: Evidence-based document search with clear source citations. tags: - nlp - research - document-retrieval - multilingual - explainable-ai --- # ResearchRAG ยท Browser Edition **Evidence-based multilingual document search with traceable source excerpts.** A practical, free and public [Hugging Face Static Space](https://huggingface.co/docs/hub/spaces-sdks-static) developed as part of Rodrigo Pantoja's applied AI portfolio. ## What it does - Loads example documents or accepts pasted text and TXT, Markdown, CSV files. - Builds a browser-local passage index with source identifiers such as `D1:C2`. - Retrieves relevant passages using BM25-style word relevance, query term coverage and character-trigram overlap. - Extracts relevant **existing** source sentences, each tied to a document and passage citation. - Displays retrieval scores for transparent interpretation and exports a Markdown evidence report. - Supports English, Spanish and Portuguese token matching (but is not a full multilingual semantic search model). - Runs on the visitor's machine without a paid compute instance or external generative API. ## Try it 1. Open the **App** tab. 2. Click **Load 3 example documents**. 3. Click **Find evidence**, or ask: `Why is source verification important in research?`. 4. Read the extractive evidence and use citation labels to identify source excerpts. 5. Download the Markdown report, or replace the demos with your own text. ## Privacy and supported formats All submitted document text remains in the current browser tab for local indexing and search. This app does not intentionally upload source text to any backend or external AI API. Hosting platforms and your browser may still handle normal web connection metadata. Do not assume absolute security on a shared device. **Accepted uploads:** `.txt`, `.md`, `.csv` (up to 1 MB/file, 15 documents maximum). Paste text instead of uploading, if desired. **Not directly supported in this edition:** PDF, DOCX and scanned-image OCR. Copy/export their text before importing it. No documents persist across page refreshes. ## Reproducible method 1. Clean and segment document text into passages, usually around 650 characters (plus short overlap). 2. Tokenize and remove common stopwords for Spanish, English and Portuguese. 3. Index per-passage word frequencies and character 3-grams. 4. Rank passages using a weighted mix of BM25-like lexical relevance (63%), query term coverage (27%) and character similarity (10%). 5. Select a small set of extractive evidence sentences, retaining the passage and document names. 6. Export passages and citations without generating unsourced answers. `engine.js` is independent of the user interface, enabling deterministic Node.js tests. ## Important limitations This is an **explainable lexical retrieval system**, not generative question answering, deep semantic embeddings, RAG generation with an LLM, factual verification, or a trained search model. It can miss paraphrases, especially cross-language paraphrases without shared words. Its relevance score is **not** a probability of truth. Extracted text may lack important context. Always check the original source. The original companion **Python/Gradio ResearchRAG** prototype implements an optional multilingual embedding retriever and experimental generation; this browser edition intentionally does not claim those features because it is hosted without paid server compute. This is a distinct deployable variant, not a replacement for the original source code. ## Project files - `index.html`: interface and inline responsive CSS. - `engine.js`: local indexing, hybrid lexical scoring and extractive evidence synthesis. - `app.js`: user actions, uploads, display and report download. - `LICENSE`: MIT license. - `README.md`: project card and reproducibility notes. ## License and attribution MIT License. Authored for Rodrigo Pantoja's professional open-source portfolio. Demo documents are original illustrative text, not a research corpus. No claims about an external benchmark or real-world model accuracy are made for this browser version.