Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
AI Tutor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Salma Mohammed Hamed
AI Tutor
Commits
8d3f12b0
Commit
8d3f12b0
authored
Oct 05, 2025
by
SalmaMohammedHamedMustafa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tashkeel_fixer under test v1
parent
34d57666
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
20 deletions
+26
-20
tashkeel_fixer.py
..._env/voice_agent/services/agent_helpers/tashkeel_fixer.py
+26
-20
No files found.
self_hosted_env/voice_agent/services/agent_helpers/tashkeel_fixer.py
View file @
8d3f12b0
custom_fixes
=
{
custom_fixes
=
{
"التكيف"
:
"التَكَيُّف"
,
"تكيف"
:
"تَكَيُّف"
,
"البقاء"
:
"البَقَّاء"
,
"بقاء"
:
"بَقَّااء"
,
"بقاء"
:
"بَقَّاء"
,
"قدرة"
:
"قُدرَة"
,
"قدرة"
:
"القُدرَة"
,
"نقل"
:
"نَقْل"
,
"النقل"
:
"النَقْل"
,
"دب"
:
"دُبّ"
,
"الدب"
:
"الدُبّ"
,
"نمر"
:
"نَمِر"
,
"النمر"
:
"النَمِر"
,
"فرو"
:
"فَروُ"
,
"فرو"
:
"فَروُ"
,
"
البني"
:
"ال
بُنّي"
,
"
بني"
:
"
بُنّي"
,
"ملونة"
:
"مِلوِنَةْ"
,
"ملونة"
:
"مِلوِنَةْ"
,
"قوس قزح"
:
"قُوس قُزَح"
,
"قوس قزح"
:
"قُوس قُزَح"
,
"معينة"
:
"مُعيَّنَة"
,
"معينة"
:
"مُعيَّنَة"
,
"
الفنك"
:
"ال
فنِك"
,
"
فنك"
:
"
فنِك"
,
"
الحر"
:
"ال
حَر"
,
"
حر"
:
"
حَر"
,
"
الشم"
:
"الَ
شَمْ"
,
"
شم"
:
"
شَمْ"
,
"
البصر"
:
"ال
بَصَر"
,
"
بصر"
:
"
بَصَر"
,
"
الأذن"
:
"ال
اُذُن"
,
"
أذن"
:
"
اُذُن"
,
"
الفم"
:
"ال
فَم"
,
"
فم"
:
"
فَم"
,
"
العين"
:
"ال
عِين"
,
"
عين"
:
"
عِين"
,
"
اللهث"
:
"ال
لَّهْث"
,
"
لهث"
:
"
لَّهْث"
,
"
القطط"
:
"ال
قطط"
,
"
قطط"
:
"
قطط"
,
"لنقل"
:
"لنَقْل"
,
"لنقل"
:
"لنَقْل"
,
"قدم"
:
"قَدَمْ"
,
"قدم"
:
"قَدَمْ"
,
"مية"
:
"مَيَّةْ"
,
"مية"
:
"مَيَّةْ"
,
"حاسة"
:
"حاسة"
,
"حاسة"
:
"حاسة"
,
"دهون"
:
"دُهون"
,
}
}
import
re
def
apply_fixes
(
text
,
fixes_dict
):
def
apply_fixes
(
text
,
fixes_dict
):
for
wrong
,
fixed
in
fixes_dict
.
items
():
for
wrong
,
fixed
in
fixes_dict
.
items
():
if
wrong
in
text
:
pattern
=
rf
"
\b
(ال|يت|مت)?{wrong}(ات|ها|هم|ه|ي|ون|ين)?
\b
"
text
=
text
.
replace
(
wrong
,
fixed
)
def
replacer
(
m
):
prefix
=
m
.
group
(
1
)
or
""
suffix
=
m
.
group
(
2
)
or
""
return
prefix
+
fixed
+
suffix
text
=
re
.
sub
(
pattern
,
replacer
,
text
)
return
text
return
text
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment