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
01bce3ab
Commit
01bce3ab
authored
Oct 06, 2025
by
SalmaMohammedHamedMustafa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
segmentation service handle 1.2.3
parent
05195a99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
segmentation_service.py
self_hosted_env/voice_agent/services/segmentation_service.py
+12
-2
No files found.
self_hosted_env/voice_agent/services/segmentation_service.py
View file @
01bce3ab
from
langdetect
import
detect
from
langdetect
import
detect
from
typing
import
List
,
Dict
from
typing
import
List
,
Dict
import
re
class
LanguageSegmentationService
:
class
LanguageSegmentationService
:
"""
"""
...
@@ -74,8 +75,17 @@ class LanguageSegmentationService:
...
@@ -74,8 +75,17 @@ class LanguageSegmentationService:
if
not
stripped
:
if
not
stripped
:
return
True
return
True
# Pure numbers (with optional punctuation like "1." or "#1")
# Check if it's a number (including decimals like 1.2, 3.14, etc.)
if
stripped
.
replace
(
'#'
,
''
)
.
isdigit
():
# Remove # and check if what remains is numeric (allowing dots for decimals)
cleaned
=
stripped
.
replace
(
'#'
,
''
)
# Check for section/chapter numbering like 1.2.3 or 1.2 or just 1
# Pattern: digits separated by dots or commas
if
re
.
match
(
r'^[\d.]+$'
,
cleaned
)
and
any
(
c
.
isdigit
()
for
c
in
cleaned
):
return
True
# Also handle numbers with commas (like 1,000)
if
re
.
match
(
r'^[\d,]+$'
,
cleaned
)
and
any
(
c
.
isdigit
()
for
c
in
cleaned
):
return
True
return
True
# Special markdown-like markers (##, ###, etc.)
# Special markdown-like markers (##, ###, etc.)
...
...
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