Skip to content

History and Learning

mmaher88 edited this page Mar 11, 2026 · 2 revisions

History & Learning

Laren remembers your preferred candidates and shows them first in future sessions.

How It Works

sequenceDiagram
    participant U as User
    participant L as Laren
    participant H as History File

    Note over U,H: First time typing "asd"
    U->>L: Type "asd"
    L->>L: transliterate("asd")
    L-->>U: Show candidates:<br/>1. أسد (dictionary)<br/>2. عسد (dictionary)<br/>3. اسد (skeletal)

    U->>L: Select "أسد"
    L->>H: Save: asd → أسد

    Note over U,H: Next time typing "asd"
    U->>L: Type "asd"
    L->>H: Lookup "asd"
    H-->>L: Found: أسد
    L-->>U: Show candidates:<br/>⭐ أسد (history)<br/>──────────<br/>1. عسد (dictionary)<br/>2. اسد (skeletal)
Loading

Storage

History is stored as a simple TSV file at:

~/.local/share/laren/history.tsv

Format:

asd	أسد
madrasa	مدرسه
salam	سلام
3een	عين

Display

When a history match exists, it appears at the top of the candidate list with a separator:

┌─────────────────────┐
│ ⭐ مدرسه              │  ← History (your previous choice)
│ ──────────────────── │  ← Separator
│ 1. مدرسة              │  ← Dictionary candidates
│ 2. مدرسا              │
│ 3. مدرسه              │
│ ...                  │
└─────────────────────┘
flowchart TD
    A["User types input"] --> B{"History lookup"}
    B -->|"Found"| C["Place at top<br/>Remove duplicate from list<br/>Add separator"]
    B -->|"Not found"| D["Normal candidate list"]

    C --> E["Display list"]
    D --> E

    F["User selects candidate"] --> G["Save to history"]
    G --> H["Write to TSV file"]

    style C fill:#fff9c4
    style G fill:#e8f5e9
Loading

Behavior

  • History is per exact input"salam" and "salaam" are separate entries
  • Selecting any candidate (history or regular) updates the history
  • History persists across sessions (saved to disk on every selection)
  • History file is human-readable and can be manually edited

Clone this wiki locally