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 re | |
| import csv | |
| import math | |
| import pandas as pd | |
| from konlpy.tag import Komoran | |
| class PolarityDictionary: | |
| """ | |
| Manages the loading and lookup of polarity scores from a dictionary file. |
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
| #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
| SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
| SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
| #Hotstring EndChars : | |
| #Hotstring O | |
| ; Source: https://emojibase.dev/docs/shortcodes | |
| :::interrobang::⁉ |
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
| def possible(y, x, n): | |
| global grid | |
| for i in range(0, 9): | |
| if grid[y][i] == n: | |
| return False | |
| for i in range(0, 9): | |
| if grid[i][x] == n: | |
| return False | |
| x0 = (x // 3) * 3 | |
| y0 = (y // 3) * 3 |
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
| local function lcsRecursive(a, b) | |
| if #a == 0 or #b == 0 then | |
| return '' | |
| elseif a:sub(-1, -1) == b:sub(-1, -1) then | |
| return lcs(a:sub(1, -2), b:sub(1, -2)) .. a:sub(-1, -1) | |
| else | |
| local a_sub = lcs(a, b:sub(1, -2)) | |
| local b_sub = lcs(a:sub(1, -2), b) | |
| if #a_sub > #b_sub then |
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
| #! usr/bin/env python3 | |
| import random | |
| from itertools import combinations | |
| from string import printable as ALPHA | |
| def generate_seed(popsize, target): | |
| return [''.join(random.sample(ALPHA, len(target))) for _ in range(popsize)] |
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
| class WordFactory: | |
| def __init__(self, board): | |
| self.board = board | |
| self.width = len(board[0]) | |
| self.height = len(board) | |
| def get_neighbors(self, r, c): | |
| MOVES = { | |
| 'U': (r - 1, c), | |
| 'D': (r + 1, c), |
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
| def coinchange(n, coins): | |
| ways = [] | |
| stack = [[n, [], coins]] | |
| while stack: | |
| rem, change, coins = stack.pop() | |
| if rem == 0: | |
| ways.append(change) | |
| continue | |
| sort = list(filter(lambda x: x <= rem, coins)) | |
| for coin in sort: |
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
| def stringify_items(lst, reverse=False): | |
| if reverse: | |
| return [''.join(reversed(item)) for item in lst] | |
| return [''.join(item) for item in lst] | |
| def flip_grid(grid): | |
| return [[grid[r][c] for r in range(len(grid))] for c in range(len(grid[0]))] | |
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
| from copy import deepcopy | |
| from math import log10 | |
| import random | |
| import sys | |
| import time | |
| class Puzzle(): |