18
18
def request_transcript ():
19
19
transcript_request = {
20
20
'audio_url' : content_url ,
21
- 'filter_profanity' : True , # Profanity Filtering https://www.assemblyai.com/docs/core-transcription#profanity-filtering
22
- 'punctuate' : True , # Automate Punctuation and Casing https://www.assemblyai.com/docs/core-transcription#automatic-punctuation-and-casing
23
- 'language_detection' : True , # Automatic Language Detection https://www.assemblyai.com/docs/core-transcription#automatic-language-detection
24
- 'auto_highlights' : True , # Detect Important Phrases and Words https://www.assemblyai.com/docs/audio-intelligence#detect-important-phrases-and-words
25
- 'content_safety' : True , # Content Moderation https://www.assemblyai.com/docs/audio-intelligence#content-moderation
26
- 'iab_categories' : True , # Topic Detection(IAB Categories) https://www.assemblyai.com/docs/audio-intelligence#topic-detection-iab-classification
27
- 'sentiment_analysis' : True , # Sentiment Analysis https://www.assemblyai.com/docs/audio-intelligence#sentiment-analysis
28
- 'summary_type' : 'bullets' , # Summary bullets https://www.assemblyai.com/docs/audio-intelligence#summarization
21
+ # 'filter_profanity': True, # Profanity Filtering https://www.assemblyai.com/docs/core-transcription#profanity-filtering
22
+ # 'punctuate': True, # Automate Punctuation and Casing https://www.assemblyai.com/docs/core-transcription#automatic-punctuation-and-casing
23
+ # 'language_detection': True, # Automatic Language Detection https://www.assemblyai.com/docs/core-transcription#automatic-language-detection
24
+ # 'auto_highlights': True, # Detect Important Phrases and Words https://www.assemblyai.com/docs/audio-intelligence#detect-important-phrases-and-words
25
+ # 'content_safety': True, # Content Moderation https://www.assemblyai.com/docs/audio-intelligence#content-moderation
26
+ # 'iab_categories': True, # Topic Detection(IAB Categories) https://www.assemblyai.com/docs/audio-intelligence#topic-detection-iab-classification
27
+ # 'sentiment_analysis': True, # Sentiment Analysis https://www.assemblyai.com/docs/audio-intelligence#sentiment-analysis
28
+ # 'summary_type': 'bullets', # Summary bullets https://www.assemblyai.com/docs/audio-intelligence#summarization
29
29
#'summary_type': 'gist', # Summary gist
30
30
#'summary_type': 'headline', # Summary headline
31
31
#'summary_type': 'paragraph', # Summary paragraph
32
- 'auto_chapters' : True , # Automatic Chapters https://www.assemblyai.com/docs/audio-intelligence#auto-chapters
33
- 'entity_detection' : True , # Entity Detection https://www.assemblyai.com/docs/audio-intelligence#entity-detection
32
+ #'auto_chapters': True, # Automatic Chapters https://www.assemblyai.com/docs/audio-intelligence#auto-chapters
33
+ #'entity_detection': True, # Entity Detection https://www.assemblyai.com/docs/audio-intelligence#entity-detection
34
+ 'dual_channel' : False
34
35
}
35
36
transcript_response = requests .post (
36
37
transcript_endpoint ,
@@ -80,7 +81,7 @@ def main():
80
81
# save request transcript
81
82
transcript_response = request_transcript ()
82
83
json_object = json .dumps (transcript_response , indent = 4 )
83
- with open ('request.json' , 'w' ) as outfile :
84
+ with open ('data. request.json' , 'w' ) as outfile :
84
85
outfile .write (json_object )
85
86
86
87
# poll and wait
@@ -89,31 +90,31 @@ def main():
89
90
90
91
# save transcription
91
92
json_object = json .dumps (transcription , indent = 4 )
92
- with open ('transcription.json' , 'w' ) as outfile :
93
+ with open ('data. transcription.json' , 'w' ) as outfile :
93
94
outfile .write (json_object )
94
95
95
96
# save paragraphs
96
97
paragraphs = get_paragraphs (polling_endpoint )
97
98
json_object = json .dumps (paragraphs , indent = 4 )
98
- with open ('paragraphs.json' , 'w' ) as outfile :
99
+ with open ('data. paragraphs.json' , 'w' ) as outfile :
99
100
outfile .write (json_object )
100
101
101
102
# save sentences
102
103
sentences = get_sentences (polling_endpoint )
103
104
json_object = json .dumps (sentences , indent = 4 )
104
- with open ('sentences.json' , 'w' ) as outfile :
105
+ with open ('data. sentences.json' , 'w' ) as outfile :
105
106
outfile .write (json_object )
106
107
107
108
# save srt
108
109
response = requests .get (polling_endpoint + '/srt' , headers = headers )
109
110
response = response .text
110
- with open ('srt.txt' , 'w' ) as outfile :
111
+ with open ('data. srt.txt' , 'w' ) as outfile :
111
112
outfile .write (response )
112
113
113
114
# save vtt
114
115
response = requests .get (polling_endpoint + '/vtt' , headers = headers )
115
116
response = response .text
116
- with open ('vtt.txt' , 'w' ) as outfile :
117
+ with open ('data. vtt.txt' , 'w' ) as outfile :
117
118
outfile .write (response )
118
119
119
120
if __name__ == '__main__' :
0 commit comments