Skip to content

Instantly share code, notes, and snippets.

@kmike
kmike / verbs_errors.ipynb
Created February 21, 2013 11:05
переходность глаголов и залог причастий
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python2
# coding: utf-8
import nltk
def get_available_corpora():
for element in dir(nltk.corpus):
if element[0] == '_':
continue
elements_type = str(type(getattr(nltk.corpus, element)))
@kmike
kmike / gist:3975973
Created October 29, 2012 19:32
NLTK unicode proposal
try:
# Old versions of unidecode are licensed under Artistic License
# (not GPL) so it may be OK for NLTK to rely on them.
from unidecode import unidecode
def transliterate(txt):
return unidecode(txt).encode('ascii')
except ImportError:
try:
# text-unidecode is an another Text::Unidecode port that is licensed
@kmike
kmike / gr.py
Created October 2, 2012 18:27
вывод в консоль всех слов из словаря pymorphy 0.5.6 (от Yuri Baburov)
import pprint
import pymorphy
import sys
sysenc = 'utf-8'
def enc(*y):
for x in y:
if isinstance(x, unicode):
from fabric.api import local, settings
from taskset import task_method
from fab_deploy.utils import define_apps
from fab_deploy.project import WebProject
from fab_deploy.webserver.nginx import Nginx
from fab_deploy.webserver.apache import Apache
from fab_deploy.django import Django
from fab_deploy import system
from fab_deploy.db import postgres
from fabric.api import local, settings
from taskset import task_method
from fab_deploy.utils import define_host, define_apps
from fab_deploy.project import WebProject
from fab_deploy.webserver.nginx import Nginx
from fab_deploy.webserver.apache import Apache
from fab_deploy.django import Django
from fab_deploy import system
from fab_deploy.db import postgres
from fabric.api import local, settings
from taskset import task_method
from fab_deploy.utils import define_host, define_apps
from fab_deploy.project import WebProject
from fab_deploy.webserver.nginx import Nginx
from fab_deploy.webserver.apache import Apache
from fab_deploy.django import Django
from fab_deploy import system
from fab_deploy.db import postgres
@kmike
kmike / gist:3005992
Created June 27, 2012 18:53
ideas for dfd
from fab_deploy import define_host, has_apps
from fab_deploy.db import Mysql
from fab_deploy.webservers import Nginx, Apache
from fab_deploy.vcs import Git
@has_apps(
nginx = Nginx(),
apache = Apache(),
db = Mysql()
)
import functools
class UnicodeMixin(object):
"""Mixin class to handle defining the proper __str__/__unicode__
methods in Python 2 or 3."""
if PY3:
def __str__(self):
return self.__unicode__()
else: