Skip to main content

Kaeshir Dictionary - Python Package (kashmiri)

An open-source English–Kashmiri lexical database with Python package access, powering the Kaeshir Dictionary platform. Freely available for educational, research, software development or any purpose related to the Kashmiri language.


Table of Contents


About

This repository serves as both the open-source data repository and the Python package for Kaeshir Dictionary, launched in October 2020. The objective is to make Kashmiri resources openly available for anyone building language technologies, educational tools or conducting linguistic research. Rather than keeping the dataset locked inside an application, it is published here so the community can study, improve and reuse it.


Features

Comprehensive Dataset - 28,718+ Kashmiri words from multiple authoritative sources
Audio Pronunciations - 2,919 words with audio URLs
Fast Search - Efficient binary search with in-memory caching
Multiple Sources - Data from Sheeba Hassan, Grierson, and curated collections
Easy Integration - With jsDelivr CDN and Python package Open Source - MIT licensed for any use


API Reference

You can access the data directly from the jsDelivr CDN without installing the Python package. The following endpoints are available:


Installation

Install the Python package via pip:

pip install kashmiri

Requirements

  • Python 3.7 or higher
  • No external dependencies (uses only standard library)

Quick Start

from kashmiri import find, get_all_words

# Find a specific word
word_info = find("water")
print(word_info)
# Output: {'word': 'water', 'meaning': '...'}

# Get all words
all_words = get_all_words()
print(f"Total words: {len(all_words)}")
# Output: Total words: 28718

# Search is case-insensitive
find("WATER") == find("water")  # True

Dataset

The repository contains three complementary JSON files with Kashmiri lexical data:

1. audio-words.json

Words with audio pronunciations (sourced from the work of Sheeba Hassan)

Schema:

{
  "word": "ā",
  "audioUrl": "https://dsal.uchicago.edu/dictionaries/hassan/audio/00404.mp3",
  "desc": "interj. a"
}

2. dictionary-words.json

English-to-Kashmiri dictionary entries, sourced from Grierson

Schema:

{
  "word": "āb",
  "meaning": "m. water. This word is generally employed by Musalmāns..."
}

3. collected-words.json

A curated subset of words collected manually from various sources

Schema:

{
  "title": "Abandoned",
  "pos": "/ ə-ˈban-dənd/, adjective",
  "englishMeaning": "Trovmut (m.)",
  "kashmiriMeaning": "ترٛومُت",
  "englishExample": "An abandoned factory.",
  "kashmiriExample": "Akh traivmich factry."
}

Note: Field names and structure vary between files. Inspect a few entries in each file before writing a parser rather than assuming a single shared schema across all three.

Usage

Finding a Word

Use the find() function to search for a word. The returned format depends on which data source contains the word:

>>> from kashmiri import find
>>> from pprint import pprint
>>>
>>> # Example from audio-words.json
>>> find("ablι")
{'word': 'ablι', 'audioUrl': 'https://dsal.uchicago.edu/dictionaries/hassan/audio/00007.mp3', 'desc': 'adj. idiot, stupid, foolish'}
>>>
>>> # Example from dictionary-words.json
>>> find("āb")
{'word': 'āb', 'meaning': 'm. water. This word is generally employed by Musalmāns...'}
>>>
>>> # Example from collected-words.json
>>> x = find('abandoned')
>>> pprint(x)
{'englishExample': 'An abandoned factory.',
 'englishMeaning': 'Trovmut (m.)',
 'kashmiriExample': 'Akh traivmich factry.',
 'kashmiriMeaning': 'ترٛومُت',
 'pos': '/ ə-ˈban-dənd/, adjective',
 'title': 'Abandoned'}
>>>
  • If the given word is not found, a string saying Not Found will be displayed.
>>> find('grep')
Not Found
>>>
  • Search is Case Insensitive

Contributing

We welcome contributions from the community! Whether you want to:

  • Report a bug
  • Suggest a new feature
  • Improve documentation
  • Add or correct words
  • Contribute code

Please read our Contributing Guide to get started.

Quick Links


Acknowledgments

This project is dedicated to keeping our beloved Kashmiri language alive digitally.

Special Thanks:

  • Sheeba Hassan - Audio pronunciations and phonetic transcriptions
  • Grierson Project - A Dictionary Of Kashmiri Language

License

Released under the MIT License. See LICENSE file for details.


Contact

Have questions, ideas, or want to collaborate?


Made with ❤️ for the Kaeshir Zabaan

>>> find('acʰkan')
{'word': 'acʰkan', 'audioUrl': 'https://dsal.uchicago.edu/dictionaries/hassan/audio/00015.mp3', 'desc': 'n.m. tight long coat with full buttons in front, achkan'}
>>>
>>> find('AcʰKaN')
{'word': 'acʰkan', 'audioUrl': 'https://dsal.uchicago.edu/dictionaries/hassan/audio/00015.mp3', 'desc': 'n.m. tight long coat with full buttons in front, achkan'}
>>>
  • AssertionError will be thrown if you search for some gibberish
>>> find("osama bin laden")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    assert word.isalpha(), "You might be a Haput, else you could have entered a correct word."
AssertionError: You might be a Haput, else you could have entered a correct word.
>>>

Getting All Words

Access the entire database using get_all_words():

>>> from kashmiri import get_all_words
>>> words = get_all_words()
>>> len(words)
28718
>>>
>>> # First few entries (sorted alphabetically)
>>> words[0]
{'englishExample': '-', 'englishMeaning': 'Kehen teh', 'kashmiriExample': '-', 'kashmiriMeaning': 'کٕہنؠ تہِ', 'pos': '/ ˈnən/, pronoun', 'title': None}
>>>
>>> # Find entries with audio
>>> audio_entries = [w for w in words if 'audioUrl' in w]
>>> len(audio_entries)
2919
>>>

Understanding Different Data Formats

Since the data comes from three different sources, you'll encounter three different schemas. Here's how to handle them:

from kashmiri import find

result = find("someword")

if result:
    # Get the word/title (works for all schemas)
    word = result.get('word') or result.get('title')
---

## API Reference

### `find(word: str) -> dict | None`

Find a Kashmiri word and return its details.

**Parameters:**
- `word` (str): The word to search for (case-insensitive, alphabetic characters only)

**Returns:**
- `dict`: Dictionary containing word details in its original schema, or `None` if not found

**Raises:**
- `AssertionError`: If word contains non-alphabetic characters

**Example:**
```python
>>> from kashmiri import find
>>> result = find("water")
>>> print(result)
{'word': 'water', 'meaning': '...'}

get_all_words() -> list[dict]

Get all words from the combined database.

Returns:

  • list[dict]: Sorted list of all word entries (28,718+ entries)

Example:

>>> from kashmiri import get_all_words
>>> words = get_all_words()
>>> len(words)
28718

Migration Guide

Upgrading from version 0.0.1? See the Migration Guide for detailed information about:

  • Breaking changes
  • API updates
  • New features
  • Schema changes

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/izan-majeed/kaeshir-dictionary-data.git
cd kaeshir-dictionary-data

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Running Tests

# Run pytest
pytest tests/ -v

# Run with coverage
pytest --cov=kashmiri tests/

Code Quality

# Format code
make format

# Run linters
make lint

# Type checking
mypy kashmiri/

Building and Publishing

# Build package
make build

# Publish to TestPyPI
make publish-test

# Publish to PyPI (requires credentials)
make publish

Note

The first time you use the find() function, it will download the data from the CDN sources. The data is cached in memory for subsequent lookups, making searches very fast.

What's New in Version 1.0.0

  • Breaking Change: The package now fetches data from online CDN sources from the Kaeshir Dictionary Data repository
  • 28,718 words from three different data sources with different schemas:
    • audio-words.json: 2,919 words with audio pronunciations (Sheeba Hassan's work)
    • dictionary-words.json: 20,643 manually curated words from various sources
    • collected-words.json: 5,156 English-to-Kashmiri entries (Grierson's work)
  • Data is automatically cached for fast lookups
  • New get_all_words() function to access all dictionary entries
  • Each entry maintains its original schema from its source

For migration information from version 0.0.1, see MIGRATION.md.

Note: The database.py file is no longer used and can be safely deleted from your installation.

Data Schema Reference

Source Fields Description
audio-words.json word, audioUrl, desc Words with audio pronunciations from Sheeba Hassan's work
dictionary-words.json word, meaning Manually collected words from various sources
collected-words.json title, pos, englishMeaning, kashmiriMeaning, englishExample, kashmiriExample English-to-Kashmiri dictionary from Grierson

Credits

Release files for kashmiri 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kashmiri 1.0.2
File Size Uploaded
kashmiri-1.0.2.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for kashmiri 1.0.2
File Interpreter ABI Platform
kashmiri-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 3.7 MB

Release files / kashmiri-1.0.2.tar.gz

Download URL kashmiri-1.0.2.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
2d95fc594623bebf04502995a9a5759f01b64fbea91e583a48a4bc82e9c14479
BLAKE2b-256 checksum
How to use checksums
cf4b7014d1bb87b9d6a6c3ada3831fe3cd8f71dcecf7bea22cc01c5dd667be1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / kashmiri-1.0.2-py3-none-any.whl

Download URL kashmiri-1.0.2-py3-none-any.whl
Size 1.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b7055f5ed7a95e52244338340f4a2cfe8e8d4552f38401fe5fb71325d14af20b
BLAKE2b-256 checksum
How to use checksums
e5cf7e25552a9556dcfa7b0449252e5b6dabe3d16c381607b7cba0d08a9492a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page