Create README.md
Browse filesOld English Dictionary Interface
This Python script provides an interface for querying and exploring the Old English Dictionary Alignment dataset. It allows researchers, students, and language enthusiasts to search across multiple Old English dictionaries simultaneously and view aligned entries.
Features
The OldEnglishDictionary class provides the following functionalities:
1) Basic Search
Search for Old English words using different modes:
-Canonical Key: Search using the normalized spelling without length marks
-Normalised Form: Search using the standardized spelling with length marks
-Headword: Search across all dictionaries' headwords simultaneously
python
# Search for words containing "stan" in their canonical key
results = oe_dict.search("stan", mode="canonical")
# Search for the exact normalized form "āberan"
results = oe_dict.search("āberan", mode="normalised", exact=True)
# Search for any headword containing "cyning" in any dictionary
results = oe_dict.search("cyning", mode="headword")
2) Filtered Search
Narrow down search results using filters:
-Part of Speech: Filter by grammatical category (N, V, Adj, Adv, etc.)
-Source Dictionary: Filter by specific dictionary (BT, CH, Sweet, DOE, ParCorOE)
-Exact Matching: Toggle between substring and exact matching
python
# Find nouns containing "helm"
results = oe_dict.search("helm", mode="canonical", pos="N")
# Find words in Bosworth-Toller containing "wer"
results = oe_dict.search("wer", mode="canonical", source="BT")
# Find the exact canonical key "beon"
results = oe_dict.search("beon", mode="canonical", exact=True)
3) Similarity Search
Find similar words using different similarity methods:
-Sound Correspondences: Apply Ellis vocalic transformations to find phonologically related forms
-Edit Distance: Find words with similar spelling patterns
-Prefix: Find words starting with a given prefix
python
# Find words related through sound changes (e.g., beon/bion)
results = oe_dict.find_similar("beon", method="sound")
# Find words with similar spelling
results = oe_dict.find_similar("stan", method="edit")
# Find words starting with "for"
results = oe_dict.find_similar("for", method="prefix")
Results Display
View search results in an organised and readable format:
-Displays canonical key and normalized form
-Shows the entry's part of speech and gloss
-Lists all dictionary headwords for the entry
-Indicates the match type (exact, ellis_vocalic, or single)
python
# Display search results (up to 10 by default)
oe_dict.display_results(results)
# Display more results
oe_dict.display_results(results, limit=20)
# Display a single entry
oe_dict.display_entry(results.iloc[0])
Statistics
Get information about the dataset:
-Total number of entries
-Counts by dictionary source
-Counts by match type
-Distribution of parts of speech
# Get comprehensive statistics
stats = oe_dict.get_statistics()
# Print stats
for key, value in stats.items():
print(f"{key}: {value}")
Installation and Requirements
The script requires:
Python 3.6+
pandas library
To set up:
Install dependencies:
pip install pandas
Place your unified_index.tab file in a data directory or specify a custom path when initialising:
python
oe_dict = OldEnglishDictionary(data_path="path/to/unified_index.tab")
Example Usage
python
from oe_dictionary import OldEnglishDictionary
# Initialize the dictionary
oe_dict = OldEnglishDictionary()
# Perform a basic search
results = oe_dict.search("cyning", mode="canonical")
oe_dict.display_results(results)
# Find words with similar sound patterns
similar = oe_dict.find_similar("beon", method="sound")
oe_dict.display_results(similar)
# Get dataset statistics
stats = oe_dict.get_statistics()
print(f"Total entries: {stats['total_entries']}")
print(f"BT entries: {stats['BT_entries']}")
Running the Demo
The script includes a demonstration of its features when run directly:
python oe_dictionary.py
This will show several example searches and display statistics about the dictionary dataset.
Customisation
You can extend the script by:
-Adding new similarity methods in the find_similar function
-Creating additional filtering options in the search function
-Enhancing the display format in display_entry
-Adding export functions to save search results in various formats
License
This work is licensed under a Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/).
You are free to:
- Share — copy and redistribute the material in any medium or format
- Adapt — remix, transform, and build upon the material for any purpose, even commercially
Under the following terms:
- Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Credits
This query tool was created for the Old English Interface project.
For questions or contributions, contact javier.martin@unirioja.es.