Approximate Algoritm Completion Times, N=100
10^-6 secondsO(log(N)) | 10^-7 seconds |
O(N) |
asdasdasdasdas |
from __future__ import division | |
from nltk.corpus import wordnet as wn | |
from nltk.corpus import wordnet_ic | |
from nltk.metrics import edit_distance | |
from nltk.corpus.reader.wordnet import WordNetError | |
import numpy as np | |
import logging, os | |
import Alignment_sub | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Nov 23 11:25:40 2012 | |
@author: gavin | |
""" | |
import logging | |
from nltk.corpus import wordnet as wn | |
class Alignment_sub: |
try: | |
import cPickle as pickle | |
except: | |
import pickle | |
from sklearn.ensemble import RandomForestClassifier | |
import logging, os | |
class Lexent_classifier_sub: |
import logging | |
import numpy as np | |
import Alignment_sub | |
import lexent_featurizer_sub | |
try: | |
import cPickle as pickle | |
except: | |
import pickle | |
Section "Device" | |
Identifier "intel" | |
driver "intel" | |
EndSection | |
Section "Device" | |
Identifier "dl1" | |
driver "displaylink" | |
Option "fbdev" "/dev/fb1" | |
EndSection |
# -*- coding: utf-8 *-* | |
''' | |
The following is a naive, unsupervised text summarizer. | |
It extracts N of the text's most salient sentences. | |
Salience is defined as the average of the tf-idf weights of the words in a sentence. | |
''' | |
from nltk import sent_tokenize, word_tokenize | |
from collections import Counter | |
from math import log10 |
''' | |
A generator is a function or expression that returns multiple items, rather than a single item that may contain multiple items. | |
A generator is often consumed in a for loop. | |
Some practical points: | |
-Generators use the yield statement. | |
-Calling a generator creates the object, but does not return any items. | |
-You can iterate over the generator's returned items once. You can iterate over a list an arbitrary number of times. | |
''' |
Approximate Algoritm Completion Times, N=100
10^-6 secondsO(log(N)) | 10^-7 seconds |
O(N) |
import urllib | |
import json | |
bing_account_key = '<YOURKEY>' | |
search_base_url = \ | |
'https://user:%s@api.datamarket.azure.com/Bing/SearchWeb/Web?' \ | |
% bing_account_key | |
query = 'les paul' | |
num_results = 40 |