2020年4月9日

堆排序 python

摘要: 堆中某个节点的值总是不大于或不小于其父节点的值堆总是一棵完全二叉树 # nums = [[2], [3], [5], [1], [54], [23], [132]]# heap = []# for num in nums:# heapq.heappush(heap, num) # 加入堆# prin 阅读全文

posted @ 2020-04-09 17:43 nnnnnnnnnnnnnnnn 阅读(168) 评论(0) 推荐(0)

python request 访问接口 简单

摘要: # import requests# url = "http://10.0.0.0:1345/predict"# data = {'ay': '机动车交通事故责任纠纷', 'text':'原告的诉讼请求:1.三被告赔偿原告因本案交通事故造成的各项损失共计119843.38元;2.本案诉讼费由三被告承 阅读全文

posted @ 2020-04-09 17:40 nnnnnnnnnnnnnnnn 阅读(350) 评论(0) 推荐(0)

合并几个字典 相同key的 value值 Counter

摘要: from collections import Counterimport heapqA = ['w1', 'w2', 'w3', 'w4', 'w5', 'w6']B = ['w2', 'w3', 'w4', 'w5', 'w6', 'w1']score_A = dict((v, k*0.6) f 阅读全文

posted @ 2020-04-09 17:37 nnnnnnnnnnnnnnnn 阅读(603) 评论(0) 推荐(0)

docvec使用 相似文本

摘要: # 需要的包from gensim.models import Doc2Vecfrom gensim.models.doc2vec import TaggedDocument # 处理数据for i, doc in enumerate(docs): # document = TaggedDocume 阅读全文

posted @ 2020-04-09 16:52 nnnnnnnnnnnnnnnn 阅读(282) 评论(0) 推荐(0)

2020年4月8日

中文文本 分类 text_cnn fasttext

摘要: 一.fasttext 介绍:https://blog.csdn.net/feilong_csdn/article/details/88655927 官方文档:https://fasttext.cc/docs/en/support.html 例子:https://github.com/facebook 阅读全文

posted @ 2020-04-08 14:01 nnnnnnnnnnnnnnnn 阅读(761) 评论(0) 推荐(0)

2020年4月3日

二维数组 添加数据

摘要: 遍历矩阵每一行 mat[index][:]遍历矩阵每一列 mat[:, index]添加 x=np.append(x,[[1,2,3,4]],axis=0)#添加整行元素,axis=1添加整列元素 阅读全文

posted @ 2020-04-03 15:33 nnnnnnnnnnnnnnnn 阅读(604) 评论(0) 推荐(0)

2020年4月1日

ubuntu kenlm安装和使用

摘要: 一、安装 1.下载地址:https://github.com/kpu/kenlm 2.unzip mv mkdir -p build 3.进入到build目录下 cmake .. (1) ubuntu cmake找不到boost库 sudo apt-get install libboost-all- 阅读全文

posted @ 2020-04-01 16:04 nnnnnnnnnnnnnnnn 阅读(1409) 评论(0) 推荐(0)

2020年1月15日

mysql 中文乱码

摘要: https://blog.csdn.net/u011791611/article/details/88183619 阅读全文

posted @ 2020-01-15 11:05 nnnnnnnnnnnnnnnn 阅读(114) 评论(0) 推荐(0)

2020年1月13日

python 简单访问hbase

摘要: 基于pyspark 读取和存储数据 读数据 from pyspark.sql import SparkSession import os os.environ['PYSPARK_PYTHON']='/opt/anaconda2/bin/python' sc = SparkSession.builde 阅读全文

posted @ 2020-01-13 15:59 nnnnnnnnnnnnnnnn 阅读(298) 评论(0) 推荐(0)

2020年1月6日

python的一些小技巧 慢慢更新

摘要: 1. 输出 a . print("%d %s" % (5, "ok")) b. '{1},{0},{1}'.format('ok',5) > ok 5 ok c print("ok", 5) 2. and or and 前真返后 or 前真返前 c = a > 0.5 and 1 or 0 # a 阅读全文

posted @ 2020-01-06 11:22 nnnnnnnnnnnnnnnn 阅读(273) 评论(0) 推荐(0)

导航