if maxmatch < 0.85: sample.append(volid) else: print(maxmatch) if len(sample) < sampleperyear: for volid in initialsample: population.remove(volid) stillneeded = sampleperyear - len(sample) print("Still needed: " + str(stillneeded) + "from population " + str(len(population))) if stillneeded >= len(population): secondsample = population else: secondsample = random.sample(population, stillneeded) sample.extend(secondsample) selectedids.extend(sample) for volid in sample: author = table["author"][volid] title = table["title"][volid] authtitles.append((author, title)) utils.writetsv(columns, selectedids, table, "/Users/tunder/Dropbox/GenreProject/metadata/topicmodelingsample.tsv")
if maxmatch < 0.85: sample.append(volid) else: print(maxmatch) if len(sample) < sampleperyear: for volid in initialsample: population.remove(volid) stillneeded = sampleperyear - len(sample) print("Still needed: " + str(stillneeded) + "from population " + str(len(population))) if stillneeded >= len(population): secondsample = population else: secondsample = random.sample(population, stillneeded) sample.extend(secondsample) selectedids.extend(sample) for volid in sample: author = table["author"][volid] title = table["title"][volid] authtitles.append((author, title)) utils.writetsv( columns, selectedids, table, "/Users/tunder/Dropbox/GenreProject/metadata/topicmodelingsample.tsv")