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 nltk | |
from nltk.stem.wordnet import WordNetLemmatizer | |
import string | |
class SentenceRank(object): | |
def __init__(self, body, title): | |
self.body = body | |
self.sentence_list = nltk.tokenize.sent_tokenize(self.body)[:] | |
self.title = title |
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 nltk | |
from nltk.stem.wordnet import WordNetLemmatizer | |
import string | |
class SentenceRank(object): | |
def __init__(self, body, title): | |
self.body = body | |
self.sentence_list = nltk.tokenize.sent_tokenize(self.body)[:] | |
self.title = title |
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
// TODO - make logic_negate and abbreviations to lexicon as resource file (i18n, language aware, seperate data and logic) | |
// the best way might be a dictionary with flags where we can easily derive the lexicon by Object.keys and map, like | |
/* dictionary: { | |
"CP": [ | |
{v:'is', weak: 1}, | |
... | |
], | |
... | |
}; | |
*/ |
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
// TODO - make logic_negate and abbreviations to lexicon as resource file (i18n, language aware, seperate data and logic) | |
// the best way might be a dictionary with flags where we can easily derive the lexicon by Object.keys and map, like | |
/* dictionary: { | |
"CP": [ | |
{v:'is', weak: 1}, | |
... | |
], | |
... | |
}; | |
*/ |
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
''' | |
====================================================================== | |
Bullshit Generator | |
by Pierre Denis, March 2009 | |
====================================================================== | |
''' | |
# -------------------------------------------------- | |
# grammar engine | |
# -------------------------------------------------- |
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
LE | RI | TO | BO | EN | FR | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
冫 | 彡 | 䒑 | ハ | 厂 | 丶 | 一 | 口 | 日 | 田 | 丁 | 十 | 千 | 牛 | 士 | 木 | 卉 | 冖 | 亠 | 乚 | 止 | 水 | 厶 | 又 | 奐 | 癶 | 尸 | 右 | 弋 | 彐 | 匚 | 𠃊 | |
氵 | 刂 | ⺌ | 儿 | 广 | U+F2AD | ニ | 言 | 旦 | 苗 | 了 | 斗 | 舌 | 告 | 吉 | 釆 | 开 | ⿱⺍冖 | ⿱亠口 | 乙 | 歩 | 永 | 台 | 取 | 免 | 𠆢 | 辟 | 有 | U+F2BC | 翟 | 区 | 𠀉 | |
忄 | ⻏ | 龴 | 心 | 疒 | 丨 | 人 | 占 | 亘 | 畐 | 矛 | 古 | 重 | 先 | 土 | 喿 | 廾 | ⿱龸口 | 京 | 心 | 延 | 求 | 能 | 叔 | 勹 | 介 | 尺 | 布 | 代 | ⿳彐冖又 | 匹 | 非 | |
丬 | 卩 | ⺈ | 灬 | 辶 | 卜 | 山 | 加 | 旧 | 魚 | 可 | 固 | 禾 | 生 | 赤 | 林 | 廿 | 売 | 市 | 必 | 卸 | U+F2E4 | 広 | 隻 | 勺 | 余 | 戸 | U+F2CE | 戈 | 帚 | 巨 | 不 | |
亻 | 攵 | 宀 | ⺼ | 廴 | 巾 | 石 | 召 | 白 | 曽 | 奇 | 早 | 釆 | 朱 | 圭 | 麻 | 革 | 軍 | 亡 | ⿱宀儿 | 正 | 𧘇 | 云 | 祭 | 句 | 金 | 扁 | 𠂇 | 𢦏 | 录 | 臣 | U+F2CF | |
禾 | 頁 | 艹 | _ | 囗 | 土 | 耳 | 豆 | 原 | 由 | 牙 | 龺 | 壬 | 矢 | 孝 | 本 | 甘 | 冂 | 方 | 元 | 𤴓 | 㐮 | 至 | 殳 | 旬 | 舎 | 倉 | 友 | 戠 | 肀 | U+F2F6 | 片 | |
米 | 隹 | ⺮ | _ | _ | 大 | 火 | 兄 | 百 | 𤰔 | 示 | 干 | 廷 | 矢 | 者 | 未 | 某 | 内 | 文 | 酉 | 疋 | 衣 | 去 | 圣 | ⿱日匂 | 食 | _ | 史 | 我 | 隶 | 臤 | 𠂆 | |
⻖ | 月 | ⺲ | _ | _ | _ | 川 | 兑 | 門 | 曲 | 于 | ⿱爫𠙻 | 手 | 牛 | 工 | 末 | 其 | 同 | 斉 | 尢 | 足 | ⿱一𧘇 | 𠫓 | 奴 | 勿 | 令 | _ | 更 | 義 | 聿 | 馬 | 乃 | |
弓 | _ | ⺍ | _ | _ | _ | 力 | 𠂤 | 艮 | 曹 | 才 | 平 | 乗 | U+F2C9 | 五 | 朮 | 井 | 周 | 交 | 匕 | 走 | 長 | 育 | 反 | 万 | 今 | _ | 大 | 戊 | 兼 | 己 | 及 |
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 sqlite3 | |
def dict_factory(cursor, row): | |
d = {} | |
for idx, col in enumerate(cursor.description): | |
d[col[0]] = row[idx] | |
return d | |