- 实词:名词、动词、形容词、状态词、区别词、数词、量词、代词
- 虚词:副词、介词、连词、助词、拟声词、叹词。
n 名词
nr 人名
| #!/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): |
| //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 |
| /* | |
| 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; |
PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug
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
| """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. |
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.
| #!/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): |