Thanks to visit codestin.com
Credit goes to github.com

Skip to content

satyamedh/nDictionary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nDictionary

A compressed dictionary application for the TI-Nspire calculator using Ndless. This project provides a complete offline dictionary with efficient storage using Huffman compression. (Also, this was partially vibe-coded)

Prerequisites

For Building the Dictionary Data

  • Python 3.7+ with pip
  • Wiktextract data file (wiktextract.jsonl)

For Building the TI-Nspire Application

  • Ndless SDK (nspire-gcc toolchain)
  • make utility
  • Linux/WSL environment (recommended)

Installation

1. Set Up Python Environment

cd process_words
pip install -r requirements.txt

2. Download Dictionary Data

Download the English wiktextract JSONL file from Kaikki.org:

# Example: Download English wiktextract data
wget https://kaikki.org/dictionary/English/kaikki.org-dictionary-English.jsonl
mv kaikki.org-dictionary-English.jsonl process_words/wiktextract.jsonl

3. Set Environment Variable

export WIKTEXTRACT_PATH="process_words/wiktextract.jsonl"

4. Build Everything

From the main project directory:

make

This will:

  1. Process the wiktextract data to generate compressed dictionary files
  2. Compile the C++ application for TI-Nspire
  3. Copy all files to the calcbin/ folder

5. Copy to Calculator

Copy the generated files from calcbin/ to your TI-Nspire calculator. huffman_table.csv.tns, index.csv.tns, and dictionary.bin.tns must be in the root directory of the calculator, but nDictionary.tns can be in any folder.

File Formats

The dictionary uses three main files:

dictionary.bin.tns

Binary file containing Huffman-encoded word definitions:

  • uint16: Size of encoded data (big-endian)
  • uint8: Number of padding bits
  • bytes[]: Huffman-encoded text

index.csv.tns

CSV index for word lookups:

word,offset,size
apple,0,156
banana,156,203
...

huffman_table.csv.tns

Character encoding table:

char,code
32,101
97,001
101,11
...

Usage

  1. Copy files from calcbin/ to your TI-Nspire calculator. huffman_table.csv.tns, index.csv.tns, and dictionary.bin.tns must be in the root directory of the calculator.
  2. Launch nDictionary.tns using Ndless
  3. Type a word and press Enter to search
  4. Use DEL key to delete characters
  5. Press ESC or use calculator controls to exit

Troubleshooting

"JSONL file not found" Error

Ensure the wiktextract file exists and set the environment variable:

export WIKTEXTRACT_PATH="/full/path/to/wiktextract.jsonl"

Python Dependencies Missing

Install required packages:

pip install -r process_words/requirements.txt

Ndless Compilation Errors

Ensure you have the Ndless SDK properly installed and in your PATH:

which nspire-gcc  # Should return a path

License

This project is licensed under the MIT License. See the LICENSE file for details.

TODO:

  • add a lua-based GUI
  • use LZ-based compression instead of Huffman
  • store the index file, huffman file and dictionary file together
  • allow the words' files to be stored in a subfolder alongside the app file
  • add more words, and come up with a better way to filter duplicate words than pick the longest definition
  • Don't load the entire index file into memory, instead use a binary search on the file directly?
  • multi-threading for building the dictionary

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published