This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from html.parser import HTMLParser | |
import re | |
import json | |
import datetime as dt | |
class Entry(): | |
def __init__(self, time): | |
self.time = '' | |
self.time_base = time | |
self.speaker = '' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def topic_coherence(lda_model, corpus, num_words, sort_topics=True, avg_per_word=False): | |
topics = {} | |
# Get the top num_words within each model in topic | |
for idx, topic in enumerate(lda_model.components_): | |
topics[idx] = [i for i in topic.argsort()[:-num_words -1: -1]] | |
# Convert to csc for efficient column slicing | |
D = corpus.tocsc() | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib widget # Install ipympl https://github.com/matplotlib/ipympl | |
import matplotlib.pyplot as plt | |
# Previous steps followed from example notebook at | |
# https://github.com/facebookresearch/segment-anything/blob/main/notebooks/onnx_model_example.ipynb | |
def show_mask(mask, ax): | |
# From SAM notebook | |
color = np.array([30/255, 144/255, 255/255, 0.6]) | |
h, w = mask.shape[-2:] |