Skip to content

Instantly share code, notes, and snippets.

View achmedzhanov's full-sized avatar

Nail achmedzhanov

  • https://mk-sense.com/
  • Russia, Izhevsk
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Positive-reaction - а то
Positive-reaction - а я о чем и говорю
Positive-reaction - бомба
Positive-reaction - вай-вай
Positive-reaction - вау
Positive-reaction - великолепный результат
Positive-reaction - верно
Positive-reaction - во во
Positive-reaction - вот это я понимаю сервис
Positive-reaction - воу воу
from nltk import sent_tokenize
from pymystem3 import Mystem
import re
# текст, в котором будем искать
some_text = 'Красивая мама красиво мыла раму. Ну а веселая собака грызла косточку. А тот самый питон ел мыщь.'
# текст с ключевыми словами
keyword_text = 'веселая Красивая'
# список предложений
@achmedzhanov
achmedzhanov / hmm-example.py
Last active January 22, 2020 11:01 — forked from blumonkey/hmm-example.py
Python Code to train a Hidden Markov Model, using NLTK
__author__ = 'ssbushi'
# Import the toolkit and tags
import nltk
from nltk.corpus import treebank
# Train data - pretagged
train_data = treebank.tagged_sents()[:3000]
test_data = treebank.tagged_sents()[3000:]
@achmedzhanov
achmedzhanov / curry.ts
Last active March 12, 2019 17:35
curry
type l<F extends number> = F extends number ? F : never;
type one = l<1>;
type two = l<2>;
type three = l<3>;
type pt1 = [string, number, boolean];
const f1 = (...a: pt1) => true;
const fn00 = (name: string, age: number, single: boolean) => true;
type Eq<T1, T2> = Diff<T1, T2> extends never ? Diff<T2, T1> extends never ? 'equals' : 'c2' : 'c3';
type Diff<T, U> = T extends U ? never : T;
type PredicateGuard<I, O> = Eq<O, null> extends 'equal' ? null : O extends I ? O : never;
type PredicateGuard2<I, O> = O extends I ? null extends O ? O : O : never;
;
type Predicate<I, O extends I> = (i: I) => i is O;
type Predicate2<I, O extends I> = (i: I) => i is PredicateGuard2<I, O>;
@achmedzhanov
achmedzhanov / eq.ts
Created March 12, 2019 14:57
TypeScript equeal types
type Eq<T1, T2> = Diff<T1, T2> extends never ? Diff<T2, T1> extends never ? 'equals' : 'neq' : 'neq;
type et1 = Eq<string, number>;
type et2 = Eq<string, string>;
type et3 = Eq<string, string | number>;
type et4 = Eq<string | number, string>;
type et5 = Eq<null, null>;
type et6 = Eq<string | null, null>;
@achmedzhanov
achmedzhanov / not-null.ts
Created March 12, 2019 13:38
Not null type for Typ[eScript 3.4
type NotNull<T extends any | null> = T extends infer U | null ? U : T;
type t1 = NotNull<string>;
type t2 = NotNull<string|null>;
@achmedzhanov
achmedzhanov / build.bat
Created August 7, 2017 20:12
How to run angular build on Windows with Cygwin
C:\cygwin\bin\bash.exe -x -o igncr scripts/windows/create-symlinks.sh
@achmedzhanov
achmedzhanov / samuel l. jackson.svg
Created April 18, 2017 10:28
Samuel L. Jackson Pulp Fiction Portrait
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.