A sophisticated web application for discovering Armenian rhymes based on IPA (International Phonetic Alphabet) phoneme similarity analysis. The app uses intelligent feature-aware algorithms to identify different types of rhymes.
-
Multiple Rhyme Categories:
- Perfect Rhymes: Identical phonetic tails
- Near-Perfect Rhymes: High similarity (≥85%) with same vowel nucleus
- Assonance/Near Rhymes: Same vowel nucleus with decent similarity (≥60%)
- Slant Rhymes: Consonant-driven similarity (≥50%)
-
Smart Phoneme Analysis:
- Extracts rhyme tails (nucleus + coda of the last syllable)
- Feature-aware Levenshtein distance for phoneme similarity
- Considers consonant place/manner and vowel height/backness
-
Modern Web Interface:
- Beautiful, responsive design
- Real-time autocomplete search
- Detailed word definitions and part-of-speech tags
- Similarity scores for each match
- Mobile-friendly layout
- Python 3.7+
- Modern web browser (Chrome, Firefox, Safari, Edge)
pip install -r requirements.txtOr manually:
pip install Flask==2.3.0 Flask-CORS==4.0.0 Werkzeug==2.3.0Ensure dictionary-hy-improved.jsonl is in the project directory. Each line should be a JSON object with:
{
"": "word",
"p": ["part_of_speech"],
"d": ["definition"],
"f": ["word_form_1", "word_form_2", ...],
"f_ipa": ["phonetic_form_1", "phonetic_form_2", ...]
}python backend.pyYou should see:
Loaded [count] words from dictionary
* Running on http://127.0.0.1:5000
Open your browser and navigate to:
file:///c:/Users/Nazani/Desktop/armenian-rhyme-app/index.html
Or serve it with a local HTTP server:
# Using Python's built-in server
python -m http.server 8000Then visit: http://localhost:8000
-
Rhyme Tail Extraction:
- Identifies the last vowel in a word's phonetic representation
- Extracts all phones from that vowel to the end (nucleus + coda)
-
Similarity Scoring:
- Uses feature-aware Levenshtein distance
- Identical phones: cost 0
- Similar phones (same place/manner for consonants, similar height/backness for vowels): cost < 1
- Unrelated phones: cost 1
- Insertions/deletions: cost 1
-
Classification:
- Perfect: Identical tails
- Near-perfect: ≥85% similarity + same nucleus
- Assonance: Same nucleus + ≥60% similarity
- Slant: ≥50% similarity
- None: Everything else (filtered out)
Consonants are classified by:
- Place: labial, alveolar, dental, palatal, velar, glottal
- Manner: stop, fricative, nasal, approximant
Vowels are classified by:
- Height: close, close-mid, open-mid, open, near-open
- Backness: front, central, back
Find rhymes for a word.
Parameters:
word(required): Armenian word to find rhymes forlimit(optional): Maximum results (default: 50)
Response:
{
"word": "գլուխ",
"rhymes": [
{
"word": "լուծ",
"similarity": 0.857,
"label": "near-perfect",
"definition": "solution",
"part_of_speech": "noun"
}
]
}Search for words by prefix.
Parameters:
q(required): Search query
Response:
{
"results": [
{
"word": "word",
"definition": "meaning",
"pos": "noun"
}
]
}Get detailed info about a word.
Response:
{
"word": "բառ",
"definition": "word",
"pos": "noun",
"forms_count": 25
}Get dictionary statistics.
Response:
{
"total_words": 18831
}- Click in the search field
- Type an Armenian word (autocomplete suggestions will appear)
- Press Enter or click "Search"
- Results are sorted by rhyme quality (perfect → near-perfect → assonance → slant)
import requests
response = requests.get(
'http://localhost:5000/api/rhymes',
params={'word': 'գլուխ', 'limit': 25}
)
rhymes = response.json()
for rhyme in rhymes['rhymes']:
print(f"{rhyme['word']} ({rhyme['label']}): {rhyme['similarity']}")armenian-rhyme-app/
├── backend.py # Flask backend with rhyme algorithm
├── index.html # Web interface (frontend)
├── requirements.txt # Python dependencies
├── README.md # This file
├── dictionary-hy-improved.jsonl # Armenian word dictionary
└── add_ipa.py # (Existing) IPA phonetization script
- Dictionary loading: ~2-3 seconds (18,000+ words)
- Per-search latency: 50-200ms depending on result count
- Autocomplete search: 100-300ms
- Browser queries are cached by the frontend
- Multi-language support (transliteration)
- Advanced filters (filter by part of speech, definition)
- Export results (CSV, JSON)
- Offline mode with service workers
- Word frequency ranking
- Rhyme suggestions for poetry composition
- Audio pronunciation playback
"Word not found" error:
- Check spelling and diacritics
- Use autocomplete to verify correct spelling
CORS errors:
- Ensure backend is running on port 5000
- Check that Flask-CORS is installed
Slow performance:
- First search loads dictionary (~3 seconds)
- Subsequent searches are much faster
- Try limiting results to 25-50
Port already in use:
# Find and kill process on port 5000
netstat -ano | findstr :5000
taskkill /PID <PID> /F- Framework: Flask 2.3.0
- CORS: Flask-CORS 4.0.0
- Algorithm: Feature-aware Levenshtein distance
- Data Format: JSONL (JSON Lines)
- HTML5 with semantic markup
- CSS3 with gradients and animations
- Vanilla JavaScript (ES6+)
- No external dependencies (except for API calls)
- Dictionary loading: O(n) where n = number of words
- Per-search: O(n × m²) where m = average rhyme tail length
- Typical: ~0.1-0.2 seconds for 18,000 words
This project is provided as-is for educational and personal use.
Feel free to:
- Report bugs and issues
- Suggest improvements
- Add new rhyme categories
- Enhance the phoneme feature system
Check the API documentation above or examine the code comments in backend.py for implementation details.