Skip to content

Instantly share code, notes, and snippets.

View NickMirnov's full-sized avatar

Nick NickMirnov

  • Advanced System Technology
  • Moscow
View GitHub Profile
@NickMirnov
NickMirnov / text2xml_converter.py
Created September 24, 2014 11:48
text2xml converter for sphinx engine
#coding:utf-8
import sys
import os
from os import listdir
from os.path import isfile, join
import codecs
import cgi
import sys
import xml
@NickMirnov
NickMirnov / gist:d9417813abaf99f7b7c3
Created September 22, 2014 09:28
Sphinx engine + chinese stemmer/dictonary install (coreseek)
#resource: http://www.coreseek.cn/products-install/install_on_bsd_linux/
#requirements:
# m4 >= 1.4.13
# autoconf >= 2.65
# automake >= 1.11
# libtool >= 2.2.6b
wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz
tar xzvf coreseek-4.1-beta.tar.gz
@NickMirnov
NickMirnov / Dictonary
Last active December 31, 2015 01:09
черновик
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
d = {}
infil = open('lemma-freq.csv', 'r')
i = 0
for rw in csv.reader(infil, delimiter = ';'):
key = rw[0]
value = rw[1]
d[key]= value
@NickMirnov
NickMirnov / dict_script.py
Created December 10, 2013 15:53
Прикрутка к частотному словарю Lemm по Мату.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
d = {}
infil = open('lemma-freq.csv', 'r')
i = 0
for rw in csv.reader(infil, delimiter = ';'):
key = rw[0]
value = rw[1]
d[key]= value
@NickMirnov
NickMirnov / delimeters_csv_mod.py
Created December 10, 2013 12:27
Настройка формата читаемых и записываемых файлов csv. Выставление разделителей
import csv
writer = csv.writer(open("some.csv", "wb"), delimiter=':', quoting=csv.QUOTE_MINIMAL, \
quotechar='`', lineterminator='|')
writer.writerows([ [1997, "Ford", "E350", "ac, abs, moon", "3000.00"],
[1999, "Chevy", "Venture `Extended Edition`", "", "4900.00"],
[1996, "Jeep", "Grand Cherokee", "air, moon roof, loaded MUST SELL!", "4799.00"] ])
@NickMirnov
NickMirnov / example_csv_one.py
Created December 10, 2013 12:22
Работа с csv python
import csv
reader = csv.reader(open("some.csv", "rb"))
for row in reader:
print row
@NickMirnov
NickMirnov / sublime.sh
Created December 5, 2013 17:07
Installing sUblime ubuntu
sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text-2
@NickMirnov
NickMirnov / Python_lists
Created December 5, 2013 16:53
Python_lists_mini_man
# Создание списков
List = [] # пустой список
List = [ 'hello', 5, [1,2,3] ] # список с вложенным списком
List[i] # индекс