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 | |
from xml.etree.ElementTree import Element, SubElement, Comment, tostring | |
RE_TOKENS = re.compile(r'[()\\/\s]|[a-zA-Z]+') | |
def tokenize(cat): | |
return RE_TOKENS.findall(cat) | |
def hassep(ccg): |
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 xml.etree import ElementTree | |
from pprint import pprint | |
tree = ElementTree.parse('diagram.svg') | |
out = {} | |
def walk(node, attribs): |
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
__author__ = 'Ben' | |
from pprint import pprint | |
import operator | |
def shift(seq, n): | |
n %= len(seq) | |
return seq[n:] + seq[:n] | |
class Dice: |
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 pprint import pprint | |
from queue import Queue | |
w = input("Enter configuration: ") | |
z = w.split(" ") | |
paths = {} | |
for t in z: | |
if "<->" in t: | |
v = t.split("<->") |
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
__author__ = 'Ben' | |
from pprint import pprint | |
budget = int(input("Budget: ")) | |
cartrages = [ | |
] | |
v = (input("Cartridge: ")) |
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 pprint import pprint | |
from queue import Queue | |
w = input("Enter configuration: ") | |
z = w.split(" ") | |
paths = {} | |
for t in z: | |
if "<->" in t: | |
v = t.split("<->") |
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 pprint import pprint | |
import json | |
def application(functor, arg, slash): | |
if functor is None or arg is None: | |
return None | |
if '/' in arg or '\\' in arg: | |
arg = '(' + arg + ')' | |
arg = slash + arg | |
if functor.endswith(arg): | |
res = functor[:-len(arg)] |
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 pprint import pprint | |
import json | |
def application(functor, arg, slash): | |
if functor is None or arg is None: | |
return None | |
if '/' in arg or '\\' in arg: | |
arg = '(' + arg + ')' | |
arg = slash + arg | |
if functor.endswith(arg): | |
res = functor[:-len(arg)] |
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 pprint import pprint | |
import json | |
def application(functor, arg, slash): | |
if functor is None or arg is None: | |
return None | |
if '/' in arg or '\\' in arg: | |
arg = '(' + arg + ')' | |
arg = slash + arg | |
if functor.endswith(arg): | |
res = functor[:-len(arg)] |
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
B=None | |
b=len | |
t=input | |
n=range | |
import json | |
def k(functor,D,slash): | |
if functor is B or D is B: | |
return B | |
if '/' in D or '\\' in D: | |
D='('+D+')' |