- 实词:名词、动词、形容词、状态词、区别词、数词、量词、代词
- 虚词:副词、介词、连词、助词、拟声词、叹词。
n 名词
nr 人名
var page = new WebPage(), | |
address, output, size; | |
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs | |
capture = function(targetFile, clipRect) { | |
var previousClipRect; | |
var clipRect = {top: 0, left:0, width: 40, height: 40}; | |
if (clipRect) { | |
if (!isType(clipRect, "object")) { | |
throw new Error("clipRect must be an Object instance."); |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
#include <ctime> | |
#include <iostream> | |
#include <boost/date_time/gregorian/gregorian.hpp> | |
#include <boost/date_time/posix_time/posix_time.hpp> | |
//============================================================================== | |
//! Convert date part of Unix timestamp (time_t) to boost date | |
//! |
# Working example for my blog post at: | |
# https://danijar.github.io/structuring-your-tensorflow-models | |
import functools | |
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data | |
def doublewrap(function): | |
""" | |
A decorator decorator, allowing to use the decorator to be used without |
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer | |
from sklearn.datasets import fetch_20newsgroups | |
from sklearn.decomposition import NMF, LatentDirichletAllocation | |
def display_topics(model, feature_names, no_top_words): | |
for topic_idx, topic in enumerate(model.components_): | |
print "Topic %d:" % (topic_idx) | |
print " ".join([feature_names[i] | |
for i in topic.argsort()[:-no_top_words - 1:-1]]) |
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer | |
from sklearn.datasets import fetch_20newsgroups | |
from sklearn.decomposition import NMF, LatentDirichletAllocation | |
import numpy as np | |
def display_topics(H, W, feature_names, documents, no_top_words, no_top_documents): | |
for topic_idx, topic in enumerate(H): | |
print "Topic %d:" % (topic_idx) | |
print " ".join([feature_names[i] | |
for i in topic.argsort()[:-no_top_words - 1:-1]]) |
# Mostly copied from https://keras.io/applications/#usage-examples-for-image-classification-models | |
# Changing it to use InceptionV3 instead of ResNet50 | |
from keras.applications.inception_v3 import InceptionV3, preprocess_input, decode_predictions | |
from keras.preprocessing import image | |
import numpy as np | |
model = InceptionV3() | |
img_path = 'elephant.jpg' |