This file contains hidden or 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
import random | |
class Deck(): | |
def __init__(self, n=3): | |
self.cards = list(range(1,n+1)) | |
random.shuffle(self.cards) | |
self.position = 0 | |
def __len__(self): | |
return len(self.cards) | |
def _number_of_cards_left(self): |
This file contains hidden or 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
""" | |
This is my Hollow Phonetics Matrix module: It is for handling different poetic | |
word search operations for my Flask website (https://puns.plus) It is a handler | |
for three large 45,000 x 45,000 nearest neighbor matrices that are too big for | |
me to want to load into memory. (One for overall sound similarity, one for | |
word2vec meaning similarity, and one for presence of individual phonetic features.) | |
Given different search requests, this translates from search word to vector | |
number, unpickles individual vectors from the disk as needed, performs the | |
necessary math, and then renders the results as words. |