Logo Lanfrica

aissam-out/DarijaDistance

Domaine:

natural language processing

Type de record:

software
Créateur:
ais
Hôte:
Python library crafted to handle the unique linguistic nuances of Moroccan Darija. It offers tools for word comparison, distance measurement, translation lookup, and more. # DarijaDistance Library DarijaDistance is a specialized Python library crafted to handle the unique linguistic nuances of Moroccan Darija. It offers powerful tools for word comparison, distance measurement, translation lookup, and more; making it a valuable tool for natural language processing (NLP) tasks involving Darija. ## Features - **Word Distance Calculation**: Calculate the distance between two words based on various factors, including letter differences, vowel swaps, and more. - **Closest Word Finder**: Identify the closest words to a given word using positional encoding and other techniques. - **Translation Lookup**: Retrieve potential translations for Darija words, including confidence scores. - **Customizable**: Includes various methods to handle different types of word comparisons, including specific cases like vowel swaps and character replacements. ## Installation You can install DarijaDistance via pip: ```bash pip install DarijaDistance ``` Alternatively, you can clone the repository and install it locally: ```bash git clone github.com cd DarijaDistance pip install . ``` ## Usage Here are some basic usage examples to get you started: ### Calculating Word Distance ```python from DarijaDistance.word_distance import WordDistance wd = WordDistance() vowel_dist = wd.distance_between("kelb", "kalb") consonant_dist = wd.distance_between("kelb", "kedb") print(f"Vowel: {vowel_dist} - Consonant: {consonant_dist}") # Vowel: 2.2 - Consonant: 4 repeated_letter = wd.distance_between("abc", "abbc") different_letter = wd.distance_between("abc", "abdc") print(f"Repeated: {repeated_letter} - Different: {different_letter}") # Repeated: 2 - Different: 3 dist_1 = wd.distance_between("9alam", "qalam") dist_2 = wd.distance_between("9alam", "3alam") print(f"Distance A: {dist_1} - Distance B: {dist_2}") # Distance A: 2.2 - Distance B: 4 distance = wd.distance_between("so9", "sou9") print(f"Distance: {distance}") # Dist …