Commit 4f9cc2ae authored by S.T. Galappaththi's avatar S.T. Galappaththi

All Completed

parent 9840212d
......@@ -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
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment