Skip to content

Commit

Permalink
Merge pull request #6 from Abinash-bit/Abinash-bit-patch-6
Browse files Browse the repository at this point in the history
English_Language_Alignment
  • Loading branch information
Abinash-bit authored Sep 9, 2024
2 parents 296ac6a + f70663d commit 696d714
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions english_alignment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def english(path, textgrid):
st.write("<h7 class = 'stLang'>Running Alignment for English...</h7>", unsafe_allow_html=True)
sp.run(['conda', 'run', '--name', 'aligner', 'mfa', 'align', path,
"C:/Users/Administrator/Desktop/ASP-Project/pretrained_models_tanishka/dictionary/english_us_arpa.dict",
"C:/Users/Administrator/Desktop/ASP-Project/pretrained_models_tanishka/acoustic/english_us_arpa.zip",
path], shell=True, check=True)
if not os.path.exists(textgrid):
raise FileNotFoundError(f"{textgrid} not found after alignment process.")
with open(textgrid, 'r', encoding='utf-8') as file:
out = file.read()
st.write("<h7 class = 'stLang'>Alignment Complete.</h7>", unsafe_allow_html=True)
return out

# Example usage:
path = 'C:/Users/Administrator/Desktop/ASP-Project/forced_alignment'
textgrid_path = 'C:/Users/Administrator/Desktop/ASP-Project/forced_alignment/output.TextGrid'
english(path, textgrid_path)

0 comments on commit 696d714

Please sign in to comment.