TenzinGayche commited on
Commit
81d612f
1 Parent(s): 4eff596

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -26
app.py CHANGED
@@ -4,31 +4,30 @@ import pyewts
4
 
5
  converter = pyewts.pyewts()
6
 
7
- def remove_repeated_words(text):
8
- # Tokenize the input text into words
9
- words = text.split()
10
-
11
- # Create a dictionary to count word occurrences
12
- word_count = {}
13
-
14
- # Create a list to store the final words
15
- new_words = []
16
-
17
- for word in words:
18
- # Check if the word is in the dictionary
19
- if word in word_count:
20
- # If it has occurred once before, add it to the list with a count of 2
21
- if word_count[word] == 1:
22
- new_words.append(word)
23
- word_count[word] = 2
24
- else:
25
- # If it has not occurred before, add it to the dictionary with a count of 1
26
- word_count[word] = 1
27
- new_words.append(word)
28
-
29
- # Join the modified words back into a string
30
- result = ' '.join(new_words)
31
- return result
32
 
33
  # Example usage
34
 
@@ -44,7 +43,7 @@ def transcribe(microphone, upload):
44
 
45
 
46
  text = pipe(audio)["text"]
47
- text = remove_repeated_words(text)
48
  state = converter.toUnicode(text)
49
  return state
50
 
 
4
 
5
  converter = pyewts.pyewts()
6
 
7
+ # def remove_repeated_words(text):
8
+ # # Tokenize the input text into words
9
+ # words = text.split()
10
+
11
+ # # Create a dictionary to count word occurrences
12
+ # word_count = {}
13
+
14
+ # # Create a list to store the final words
15
+ # new_words = []
16
+
17
+ # for word in words:
18
+ # # Check if the word is in the dictionary
19
+ # if word in word_count:
20
+ # # If it has occurred once before, add it to the list with a count of 2
21
+ # if word_count[word] == 1:
22
+ # new_words.append(word)
23
+ # word_count[word] = 2
24
+ # else:
25
+ # # If it has not occurred before, add it to the dictionary with a count of 1
26
+ # word_count[word] = 1
27
+ # new_words.append(word)
28
+
29
+ # result = ' '.join(new_words)
30
+ # return result
 
31
 
32
  # Example usage
33
 
 
43
 
44
 
45
  text = pipe(audio)["text"]
46
+ # text = remove_repeated_words(text)
47
  state = converter.toUnicode(text)
48
  return state
49