alessandro trinca tornidor commited on
Commit
5cec49a
·
1 Parent(s): 0c5bb13

doc: add docstrings for some js functions loaded within a Gradio app

Browse files
Files changed (1) hide show
  1. aip_trainer/lambdas/js.py +14 -0
aip_trainer/lambdas/js.py CHANGED
@@ -1,4 +1,11 @@
1
  js_update_ipa_output = """
 
 
 
 
 
 
 
2
  function updateCssText(text, letters, idxSelectedWord) {
3
  let wordsArr = text.split(" ")
4
  let lettersWordsArr = letters.split(" ")
@@ -24,6 +31,13 @@ function updateCssText(text, letters, idxSelectedWord) {
24
  """
25
 
26
  js_play_audio = """
 
 
 
 
 
 
 
27
  function playAudio(text, language, sleepTime = 0) {
28
  let voice_idx = 0;
29
  let voice_synth = null;
 
1
  js_update_ipa_output = """
2
+ /**
3
+ * Updates the CSS text of the given text based on the correctness of each letter.
4
+ *
5
+ * @param text - The text to be displayed.
6
+ * @param letters - A string representing the correctness of each letter in the text.
7
+ * @param idxSelectedWord - The index of the selected word to be underlined.
8
+ */
9
  function updateCssText(text, letters, idxSelectedWord) {
10
  let wordsArr = text.split(" ")
11
  let lettersWordsArr = letters.split(" ")
 
31
  """
32
 
33
  js_play_audio = """
34
+ /**
35
+ * Plays the given text as audio using the Web Speech API.
36
+ *
37
+ * @param text - The text to be spoken.
38
+ * @param language - The language code for the speech synthesis (e.g., 'en' for English, 'de' for German).
39
+ * @param sleepTime - Optional. The time in seconds to wait before starting the speech synthesis. Default is 0.
40
+ */
41
  function playAudio(text, language, sleepTime = 0) {
42
  let voice_idx = 0;
43
  let voice_synth = null;