Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-118
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-118
2023-118
Commits
4f9cc2ae
Commit
4f9cc2ae
authored
Sep 11, 2023
by
S.T. Galappaththi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All Completed
parent
9840212d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
sinlingua/grammar_rule/grammar_main.py
sinlingua/grammar_rule/grammar_main.py
+16
-3
sinlingua/sinhala_audio/audio_to_text.py
sinlingua/sinhala_audio/audio_to_text.py
+11
-3
No files found.
sinlingua/grammar_rule/grammar_main.py
View file @
4f9cc2ae
...
...
@@ -15,11 +15,24 @@ from sinlingua.grammar_rule.mask import PredictNoun
class
GrammarMain
:
def
_
_init_
_
(
self
):
def
_
init
_
(
self
):
pass
@
staticmethod
def
mapper
(
sentence
:
str
):
"""
:param sentence:
:return:
Examples
-------
>>> from sinlingua.grammar_rule.grammar_main import GrammarMain
>>> obj = GrammarMain()
>>> text = "අපි පොසොන් පෝයට දන්සලක් සංවිධානය කරවා"
>>> out = obj.mapper(sentence=text)
>>> print(out)
අපි පොසොන් පෝයට දන්සලක් සංවිධානය කරමු
"""
first_person
=
FirstPerson
()
output1
=
first_person
.
common_function
(
sentence
)
# print(output1)
...
...
@@ -168,7 +181,7 @@ class GrammarMain:
# if function returns any correct output is returned
# if _
_name_
_ == "__main__":
# if _
name
_ == "__main__":
# obj = GrammarMain()
# sent = "සංගමයේ සාමාජිකයින් සමිතිය අවසන් බැවින් විසිය යනව"
# out = obj.mapper(sentence=sent)
...
...
@@ -195,4 +208,4 @@ class GrammarMain:
# තී මල් කැඩුවද
# තොපි ආහාර ලෑස්ති කරාද
# ගුරුවරු පිටතට පැමිණ සිටියා
# දරුවා වෙහෙස මහන්සියෙන් ඉගෙන ගන්නවා
# දරුවා වෙහෙස මහන්සියෙන් ඉගෙන ගන්නවා
\ No newline at end of file
sinlingua/sinhala_audio/audio_to_text.py
View file @
4f9cc2ae
...
...
@@ -23,6 +23,14 @@ def conversion(path: str):
-------
None
Examples
-------
>>> from sinlingua.sinhala_audio.audio_to_text import conversion
>>> file_path = "../resources/IT20167264/test_audio/pn_sin_01_00001.wav"
>>> out = conversion(file_path)
>>> print(out)
කුඹුර ගොවියාට වී ලබාගැනීමට උපකාරී වීම වශයෙන් පිහිටවන්න කි
Notes:
------
- Make sure you have the required dependencies installed, such as the SpeechRecognition library.
...
...
@@ -32,10 +40,10 @@ def conversion(path: str):
lang
=
'si-LK'
with
sr
.
AudioFile
(
path
)
as
source
:
print
(
'Fetching File'
)
#
print('Fetching File')
audio_text
=
r
.
listen
(
source
)
try
:
print
(
'Converting audio transcripts into text ...'
)
#
print('Converting audio transcripts into text ...')
text
=
r
.
recognize_google
(
audio_text
,
language
=
lang
)
return
text
except
Exception
as
e
:
...
...
@@ -88,4 +96,4 @@ def conversion_by_input():
except
sr
.
UnknownValueError
:
print
(
'Speech recognition could not understand audio'
)
except
sr
.
RequestError
as
e
:
print
(
f
'Error occurred during speech recognition: {e}'
)
print
(
f
'Error occurred during speech recognition: {e}'
)
\ No newline at end of file
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