31
32 all_features = []
33 logger.info("Extracting features from " + str(num_slides) + " slides")
34 for idx, slide in tqdm( 35 enumerate(self.slides_list),
36 total=num_slides,
37 desc="> AI Segmenting Engine: Feature extraction",
840 return "This content is too long to be summarized. Please contact support for assistance."
841 else:
842 raise e
843 except (openai.error.ServiceUnavailableError, openai.error.APIError) as e: 844 tries += 1
845 print("OpenAI API error. Trying again in 10 seconds...")
846 sleep(10)
537 X, lsa_svd = extract_features_bow(
538 NLP_SENTENCES, return_lsa_svd=True, **kwargs
539 )
540 u, sigma, v = lsa_svd 541 ranks = compute_ranks(sigma, v)
542 logger.debug("Ranks calculated")
543 else:
205 1, 0
206 ) # flip axes so the sentences (documents) are the columns and the terms are the rows
207
208 u, sigma, v = np.linalg.svd(doc_term_matrix, full_matrices=False) 209 logger.debug("SVD successfully calculated")
210
211 ranks = iter(compute_ranks(sigma, v))
756 # also, this means that the audio file is split on voice activity as needed
757 # (the entire file is not split and stored in memory at once)
758 if method == "deepspeech":
759 for i, segment in tqdm(enumerate(segments), desc="Processing Segments"):760 # Run deepspeech on each chunk which completed VAD
761 audio = np.frombuffer(segment, dtype=np.int16)
762 transcript, transcript_json = transcribe_audio_deepspeech(
An unused variable takes up space in the code, and can lead to confusion, and it should be removed. If this variable is necessary, name the variable _
to indicate that it will be unused, or start the name with unused
or _unused
.
def update():
for i in range(10): # Usused variable `i`
time.sleep(0.01)
display_result()
def update():
for _ in range(10):
time.sleep(0.01)
display_result()