Skip to content

Instantly share code, notes, and snippets.

@luw2007
luw2007 / 词性标记.md
Last active March 18, 2024 06:36
词性标记: 包含 ICTPOS3.0词性标记集、ICTCLAS 汉语词性标注集、jieba 字典中出现的词性、simhash 中可以忽略的部分词性

词的分类

  • 实词:名词、动词、形容词、状态词、区别词、数词、量词、代词
  • 虚词:副词、介词、连词、助词、拟声词、叹词。

ICTPOS3.0词性标记集

n 名词

nr 人名

@p2
p2 / csv-to-sqlite.py
Created December 4, 2013 23:35
Quickly create a SQLite table from a CSV/TSV file
#!/usr/bin/python
#
# Read a CSV/TSV with a header row (!) and put it into a new sqlite table
import sys
import csv
import sqlite3
class Importer (object):
@oliverfoggin
oliverfoggin / viewWithTextIn.m
Last active March 9, 2016 06:53
How to centre text using drawInRect...
//Create the rect you would like your text to be inside of...
CGRect maxTextRect = CGRectMake(0, 0, 200, 60);
//Create the attributed string
NSAttributedString *theString = //... do all the setup.
//Find the rect that the string will draw into **inside the maxTextRect**
CGRect actualRect = [theString boundingRectWithSize:maxTextRect.size options:NSStringDrawingUsesLineFragmentOrigin context:nil];
//Offset the actual rect inside the maxTextRect
@niw
niw / UITextFieldLimitLengthDelegate.m
Last active July 1, 2019 16:53
The right solution to limit length of a text field.
/*
Why not simply use textField:shouldChangeCharactersInRange:replacementString:?
===
If you google how to limit a length of text field, you'll see many implementations simply using textField:shouldChangeCharactersInRange:replacementString: like
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
return [[textField.text stringByReplacingCharactersInRange:range withString:string] length] <= MAX_LENGTH;
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 8, 2024 18:07
The best FRP iOS resources.

Videos

@rbobbins
rbobbins / protocols.md
Last active May 15, 2022 21:08
Notes from "Protocol-Oriented Programming in Swift"

PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug

Protocol-Oriented Programming in Swift

Speaker: David Abrahams. (Tech lead for Swift standard library)

  • "Crusty" is an old-school programmer who doesn't trust IDE's, debuggers, programming fads. He's cynical, grumpy.

  • OOP has been around since the 1970's. It's not actually new.

  • Classes are Awesome

    • Encapsulation
    • Access control
@honnibal
honnibal / theano_mlp_small.py
Last active March 1, 2023 15:10
Stripped-down example of Multi-layer Perceptron MLP in Theano
"""A stripped-down MLP example, using Theano.
Based on the tutorial here: http://deeplearning.net/tutorial/mlp.html
This example trims away some complexities, and makes it easier to see how Theano works.
Design changes:
* Model compiled in a distinct function, so that symbolic variables are not in run-time scope.
* No classes. Network shown by chained function calls.
@r0yfire
r0yfire / README.md
Created October 12, 2015 23:09
Python script to convert mysqldump output to JSON file

mysqldump to JSON

Python script to convert mysqldump output to JSON file. Most of the code was borrowed from github.com/jamesmishra/mysqldump-to-csv

You'll want to update the 'parse_row' function to map each item in a row to a dictionary.

Running the script

@ryerh
ryerh / tmux-cheatsheet.markdown
Last active April 18, 2024 18:06 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@basaundi
basaundi / multi_bleu.py
Last active September 20, 2020 07:28
python rewrite of Moses' multi-bleu.perl; usable as a library
#!/usr/bin/env python
# Ander Martinez Sanchez
from __future__ import division, print_function
from math import exp, log
from collections import Counter
def ngram_count(words, n):
if n <= len(words):