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
""" | |
Bi-Term Topic Model (BTM) for very short texts. | |
Literature Reference: | |
Xiaohui Yan, Jiafeng Guo, Yanyan Lan, and Xueqi Cheng: | |
"A biterm topic model for short texts" | |
In Proceedings of WWW '13, Rio de Janeiro, Brazil, pp. 1445-1456. | |
ACM, DOI: https://doi.org/10.1145/2488388.2488514 | |
This module requires pre-processing of textual data, |
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
class Element: | |
"""I represent an unspecific UI component""" | |
def __init__(self, id, env): | |
self.id = id | |
self.env = env | |
self.children = [] | |
def trigger(self, event): |
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
import random | |
def dirichlet(alpha): | |
"""Sample dirichlet-distributed vector from Dir(alpha)""" | |
s = [random.gammavariate(a, 1) for a in alpha] | |
norm = sum(s) | |
return [d / norm for d in s] |
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
*.acn | |
*.acr | |
*.alg | |
*.aux | |
*.bak | |
*.bbl | |
*.bcf | |
*.blg | |
*.brf | |
*.dvi |
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
#! /usr/bin/python | |
# --- RPYTHON/CHROOT TOOLCHAIN HELPER --- | |
# | |
# This script restarts itself inside the 32-bit chroot environment | |
# and runs either the translation or a benchmark. | |
# (!) Double-check that everything uses absolute paths (!) | |
# | |
import os |
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
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
# | |
# Simple Pure-Python Threefish-512 Encryption. | |
# (No guarantee that this implementation is 100% correct!) | |
# | |
# Use encrypt(text, key) and decrypt(text, key) for string encryption. | |
# | |
# The cipher operates in CBC mode with a random tweak value. | |
# | |
from StringIO import StringIO |
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
/** Fast and simple text compression. | |
* | |
* This is a modified variant of LZ77: | |
* The algorithm inserts "marker bytes" whose bits state which | |
* of the following 8 symbols are actual symbols (0) or backward | |
* references (1). Backward references are actually two bytes, the | |
* first 6 bits encoding the length and the next 10 bits encoding | |
* the negative offset where the repetition occurred. | |
* The idea is related to LZO and LZJB compression. | |
* |
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 base64_fixpoint(prefix_len): | |
s = 'rofl' | |
t = 'lol' | |
while s != t: | |
s = t | |
t = s.encode("base64")[:prefix_len] | |
return t |
NewerOlder