- 博客(69)
- 资源 (20)
- 收藏
- 关注
原创 Python 使用堆栈验证C文件括号是否匹配
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-29@author: beyondzhou@name: test_balancedelimiter.py'''# Implementation of the algorithm for validating balanced brackets in a C+
2015-01-29 14:48:21 1361
转载 Python libraries collection
1) deloreanDolorean is a really cool date/time library. Apart from having a sweet name, it's one of the more natural feeling date/time munging libraries I've used in Python. It's sort of like moment
2015-01-29 11:31:53 744
翻译 Python 实现简单的加减算数游戏
#! /usr/bin/env pythonfrom operator import add, subfrom random import randint, choiceops = {'+': add, '-': sub}MAXTRIES = 2def doprob(): op = choice('+-') nums = [randint(1,10) for i i
2015-01-28 10:20:54 4726 1
翻译 Python 实现简单的自定义异常类型
#! /usr/bin/env pythonimport os, socket, errno, types, tempfileclass NetworkError(IOError): passclass FileError(IOError): passdef updArgs(args, newarg=None): if isinstance(args, IO
2015-01-27 10:21:21 948
转载 自然语言处理(nlp)的主要范畴
文本朗读(Text to speech)/语音合成(Speech synthesis)语音识别(Speech recognition)中文自动分词(Chinese word segmentation)词性标注(Part-of-speech tagging)句法分析(Parsing)自然语言生成(Natural language generation)文本分类(Text categori
2015-01-26 15:42:33 1599
翻译 Python 使用单链表实现多项式 (Polynomial)
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-26@author: beyondzhou@name: linkPolynomail.py'''# Implementation of the Polynomial ADT using a sorted linked listclass linkPolyn
2015-01-26 15:10:06 1703 1
翻译 Python 对文件中合法数字进行求和 (try...except)
def safe_float(obj): 'safe version of float()' try: retval = float(obj) except (ValueError, TypeError), diag: retval = str(diag) return retvaldef data_process_handler
2015-01-26 10:26:41 1413
翻译 Python 使用nltk发掘文本实体间的联系
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-26@author: beyondzhou@name: entity_interaction_discovery.py'''import jsonfrom interaction import extract_interactionsBLOG_DATA
2015-01-26 06:31:53 3699 3
翻译 Python 使用nltk提取文本实体 (实体识别)
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-26@author: beyondzhou@name: nltk_extract_entity.py'''import jsonimport nltkfrom nltk.tokenize import sent_tokenize, word_tokeni
2015-01-26 06:27:25 8130
翻译 Python 对文本汇总产生的文件内容进行可视化 (加粗汇总内容)
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-25@author: beyondzhou@name: visualize_document_summary.py'''import osimport jsonfrom IPython.display import IFramefrom IPython
2015-01-25 08:46:25 2593
翻译 Python 基于语句检测和语句频谱分析实现文本汇总算法 (document summary algorithm)
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-25@author: beyondzhou@name: document_summarize_algorithm.py'''import jsonfrom summary import summarize# Download nltk packages
2015-01-25 08:22:10 1879
翻译 Python 使用nltk对数据进行自然语言处理(nlp)
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-24@author: beyondzhou@name: nltk_process_blog.py'''import jsonimport nltkfrom nltk.tokenize import sent_tokenize, word_tokenize
2015-01-24 08:47:56 1033
翻译 Python 收集RSS网站内容并汇聚为Json格式文件
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-24@author: beyondzhou@name: harvest_blog_data.py'''import osimport jsonimport feedparserfrom html import cleanHtmlFEED_URL =
2015-01-24 08:40:46 1276
翻译 Python 使用feedparser提取rss内容
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-24@author: beyondzhou@name: feedparser_extract_content.py'''import feedparserFEED_URL = 'http://feeds.feedburner.com/oreilly/ra
2015-01-24 08:25:39 5686
翻译 Python 使用单链表实现简单的稀疏矩阵
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-23@author: beyondzhou@name: SparseMatrix.py'''# Implementation of the Sparse Matrix ADT using an array of linked listsfrom myarr
2015-01-23 17:35:52 976
原创 Linux 批量修改文件名
build@dev-16-new:~/3922/release/pica8/automation/suite/vxlan_gre$ lspic8OvsL2gre_02_01.tcl pic8OvsL2gre_02_06.tcl pic8OvsL2gre_02_11.tcl pic8OvsVxlan_01_02.tcl pic8OvsVxlan_01_07.tcl pic8OvsVxla
2015-01-23 15:23:53 568
翻译 Natural Language Processing (nlp) 路线图
1. EOS dectection2. Tokenization3. Part-of-speech tagging4. Chunking5. Extraction
2015-01-23 07:32:39 1076
原创 Python 实现有序单向链表
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-22@author: beyondzhou@name: test_sortedsinglelinkedlist.py'''def test_sortedsinglelinkedlist(): # import linkedlist
2015-01-22 16:40:48 644
原创 Python 实现带头尾指针的单向链表
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-22@author: beyondzhou@name: test_tailsinglelinkedlist.py'''def test_tailsinglelinkedlist(): # import linkedlist from
2015-01-22 15:41:18 822
翻译 Python 调用os执行类似linux/dos常见命令
# delete>>> import os>>> os.remove('2.txt')# rename>>> os.rename('1.txt', '2.txt')# stat>>> os.stat('2.txt')posix.stat_result(st_mode=33204, st_ino=62806910, st_dev=2065L, st_nlink=1, st_uid=
2015-01-22 10:42:37 772
原创 Python 实现简单的单向链表
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-21@author: beyondzhou@name: test_singlelinkedlist.py'''def test_singlelinkedlist(): # import linkedlist from singlel
2015-01-21 18:14:54 595
原创 Python 按行读取文件内容
>>> f = open('nihao')>>> for line in f:... print line...fjdkfjfdjkfjfdjkfjddddddddd>>> f.close()>>> f = open('nihao')>>> for line in f:... print line.strip()...fjdkfjfdjkf
2015-01-21 11:30:42 1091
原创 Python 快速读取文件内容到列表中
>>> f = open('nihao')>>> data = [line for line in f.readlines()]>>> f.close()>>> print data['fjdkfj\n', 'fdjkfj\n', 'fdjkfj\n', 'ddd\n', 'ddd\n', 'ddd']>>> f = open('nihao')>>> data = [line.stri
2015-01-21 11:25:47 5746
翻译 Python 使用nltk计算词的搭配
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-21@author: beyondzhou@name: nltk_compute_collocation.py'''import jsonimport nltk# Load in human language dataDATA = r'E:\ecli
2015-01-21 06:53:19 2886
原创 Python 对字典元素的赋值 (字典key和value均为组合类型)
>>> doc_title = 'nihao'>>> url = 'www.nihao.com'>>> td_matrix = {}>>> td_matrix[(doc_title, url)] = {}>>> td_matrix{('nihao', 'www.nihao.com'): {}}>>> td_matrix[(doc_title, url)]['good'] = 1>>>
2015-01-21 05:33:58 14799
原创 Python 使用有序list构建简单的set
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-20@author: beyondzhou@name: test_sortedlinearset.py'''def test_sortedlinearset(): # import mySet from sortedlinearse
2015-01-20 17:06:32 1856
原创 Python 获取文件中最长行的长度和最长行
# Get the number of lonest linef = open('nihao')longestLine = max(len(line) for line in f)f.close()print longestLine# Get the longest linef = open('nihao')allLines = [line for line in f]f.clo
2015-01-20 11:24:02 6847
原创 Python 获取文件中单词数,字符,字符数
# Get all words listf = open('nihao')wordList = [word for line in f for word in line.split()]# Get number of wordswordListLen = len(wordList)f.close()# Get number of charsf = open('nihao')ch
2015-01-20 10:49:44 2692
原创 Python 快速构建矩阵的索引
>>> [(x, y) for x in range(3) for y in range(5)][(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4)]
2015-01-20 10:23:41 1588
原创 Python 输出字典中的组合元素
myDict = {('beyond', 'engineer'):('2008', '2015'), ('beyond1', 'author'):('2001', '2002')}for key in myDict: print 'Name: %s\tOccupation: %s' % key print 'Age: %s\tYear: %s\n' % m
2015-01-20 10:18:15 2115
翻译 Python 实现归并排序
# Merges two sorted lists to create and return a new sorted listdef mergeSortedLists(listA, listB): # Create the new list and initialize the list markers newList = list() a = 0 b = 0
2015-01-19 15:53:03 988
翻译 Python 查找有序列表中指定元素所在位置
# Modified version of the binary search that returns the index within# a sorted sequence indicating where the target should be locateddef findSortedPosition(theList, target): low = 0 high =
2015-01-19 15:15:39 7505 1
原创 Python 判断数字是否为素数
def isPrimeNum(num): count = num / 2 while count > 1: if num % count == 0: print '%s is not prime' % num break count -= 1 else: print num, "
2015-01-19 10:21:25 2830
翻译 Python 查找数字的最大因数
def showMaxFactor(num): count = num / 2 while count > 1: if num % count == 0: print 'largest factor of %d is %d' % (num, count) break count -= 1 els
2015-01-19 10:13:18 3840
原创 Python 实现简单的密码判断
passwdList = ("nihao", "nihao1", "nihao2")valid = Falsecount = 3while count > 0: input = raw_input("enter password: ") # check for valid passwd for eachPasswd in passwdList: if
2015-01-19 09:57:26 2703
翻译 Python 使用nltk获取TF-IDF
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-19@author: beyondzhou@name: explore_google_tfidf.py'''# Querying Google+ data with TF-IDFimport jsonimport nltk# Load in huma
2015-01-19 06:08:52 7542
翻译 Python 评估字词在文件集的重要程度 (文档频率和逆向文档频率 TF-IDF)
#!/usr/bin/python # -*- coding: utf-8 -*-'''Created on 2015-1-16@author: beyondzhou@name: tf_idf_sample.py'''from tfIdf import tf, tf_idf, idf# Enter in a query term from the corpus variabl
2015-01-17 08:18:14 1818
Practical Python and OpenCV, 3rd Edition.rar
2019-10-04
High Performance Python
2017-12-09
apache-maven
2017-09-06
CUDA for Engineers An Introduction to High Performance Parallel Computing
2017-06-06
load test for video publish, pull
2017-03-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人