QQ群成员发言次数统计(正则表达式版)
1、先将QQ群的消息记录以.txt文件格式导出来,保存路径及名称自己定义(在本文我导出到Y盘,命名为test.txt)
2、程序如下:
data statistics1;
if _n_=1 then do;
patternid1=prxparse("/\s\w*-*\w*-*\w*\(\d+\)/");
patternid2=prxparse("/\(\d+\)/");
end;
retain patternid1 patternid2;
infile 'Y:\test.txt' truncover;
input string $200.;
length name $50. qq $30.;
call prxsubstr(patternid1,string,start1,length1);
call prxsubstr(patternid2,string,start2,length2);
if start1 and start2 gt 0 then do;
name=substrn(string,start1+1,length1-1);
qq=substrn(string,start2+1,length2-2);
output;
end;
run; data statistics2;
if _n_=1 then do;
patternid1=prxparse("/\s\w*-*\w*-*\w*<(\w*|\d*)@(\w*|\d*).\w+>/");
patternid2=prxparse("/<(\w*|\d*)@(\w*|\d*).\w+>/");
end;
retain patternid1 patternid2;
infile 'Y:\test.txt' truncover;
input string $200.;
length name $50. qq $30.;
call prxsubstr(patternid1,string,start1,length1);
call prxsubstr(patternid2,string,start2,length2);
if start1 and start2 gt 0 then do;
name=substrn(string,start1+1,length1-1);
qq=substrn(string,start2+1,length2-2);
output;
end;
run; data qunname;
infile 'Y:\test.txt' truncover firstobs=6 obs=6;
input @'消息对象:' qunname $;
call symput('_qunname',qunname);
run; data statistics(drop=patternid1 patternid2 string start1 start2 length1 length2);
set statistics1 statistics2;
where qq^='';
n=_n_;
run; proc sort data=statistics;by qq n;run; data match;
set statistics;
by qq n;
if last.qq then output;
drop n;
run; data _null_;
set statistics nobs=t;
call symput("_nobs",t);
stop;
run; proc sql;
create table rtf as
select qq,n(qq) as frequency,n(qq)/&_nobs.*100 as rate
from statistics
group by qq
order by 1;
quit; data rtf;
merge rtf match;
by qq;
run; proc sort data=rtf;by descending frequency;run; options nodate nonumber;
ods results=off;
title;
footnote;
ods listing close;
ods rtf file='Y:\statistics.rtf' style=Mystyles bodytitle;
proc report data=rtf nowindows style(report)={font_size=10.5pt pretext="QQ群(&_qunname.)成员发言次数及频率统计分析表" posttext="Author:liyongzhao,Created Date:2013-9-12." just=left}
style(column)={font=('times new roman',12pt)};
column name frequency rate;
define name/center style(column)={cellwidth=15%} 'QQ群成员';
define frequency/center style(column)={cellwidth=5%} '发言次数';
define rate/center style(column)={cellwidth=5%} format=6.3 '发言频率(%)';
run;
ods rtf close;
3、打开Statistics.rtf即可查看结果。
结果类似下图(截取开头部分,隐去QQ群名称和个人QQ号码):

QQ群成员发言次数统计(正则表达式版)的更多相关文章
- QQ群成员发言次数统计(词云制作)
所用数据来自于之前的一篇博客: <QQ群成员发言次数统计(正则表达式版)> 链接:http://www.cnblogs.com/liyongzhao/p/3324026.html 1.首先 ...
- 利用Python获取统计自己的qq群成员信息
利用python获取自己的qq群成员信息! 首先说明一下需要使用的工具以及技术:python3 + selenium selenium安装方法:pip install selenium 前提:获取自己 ...
- 9 行 javascript 代码获取 QQ 群成员
昨天看到一条微博:「22 行 JavaScript 代码实现 QQ 群成员提取器」. 本着好奇心点击进去,发现没有达到效果,一是 QQ 版本升级了,二是博客里面的代码也有些繁琐. 于是自己试着写了一个 ...
- 精准营销、批量提取QQ群成员号码
有时我们在做精准营销时,需要从社群里提取群成员的QQ号,群发邮件,常规的做法是手工一个个复制粘贴,这样的效率无疑是很低的,下面我来分享一个批量获取社群的QQ号方法. 需要具备以下工具: 1.大量精准Q ...
- 利用python获取自己的qq群成员信息
利用python获取自己的qq群成员信息! 首先说明一下需要使用的工具以及技术:python3 + selenium selenium安装方法:pip install selenium 前提:获取自己 ...
- 火车头采集器如何采集QQ群成员中的QQ号
如何采集QQ群群员QQ号,采集QQ号,批量采集QQ号 众所周知,QQ群群员QQ号无法导出,即使会员也不可以,那我们只能通过三方工具来实现我们的要求,那今天我们讲讲如何通过火车采集器来采集QQ群群员QQ ...
- 关于一键提取QQ群成员信息的记录
问题情境 昨天晚上回宿舍看到舍友在吐槽:天哪,我要把70多个人的QQ号全统计出来,只能一个一个地在咱们学院的学院群里找.吐了. 当时我第一反应是用python写个脚本之类的去做,因此查阅了一下资料,找 ...
- 如何采集所有QQ群成员?
首先,你需要有一个CHROME浏览器其实,你要装一个叫REGEX SCRAPER的插件 在qun.qzone.qq.com打开你的QQ群页面-查看群成员 点击REGEX 插件, 粘贴上这个代码 tex ...
- (获取qq群成员信息,并下载头像,每个群保存一个文件夹)
# 1.获取到自己qq里面所有的群,并且保存每个群里面的群成员信息到mongodb里面# 下载每个群的群成员的头像# 1.抓包,抓到获取自己所有qq群的接口 requests模块 https://qu ...
随机推荐
- 2019ExcelVBA一些自己掉进过的坑
1.公式手动重算问题 为避免代码执行过程中引发公式自动重算,拖慢运行速度,在代码中设置了公式手动重算,并计划在代码执行结束前恢复.如果在代码执行过程中捕获错误就直接退出,而没有执行到恢复公式自动重算, ...
- 『OpenCV3』基于色彩分割图片
一.遍历图像实现色彩掩码 本节我们实现这样一个算法,我们指定某种颜色和一个阈值,根据输入图片生成一张掩码,标记符合的像素(和指定颜色的差异在阈值容忍内). 源代码如下,我们使用一个class完成这个目 ...
- hdu多校第4场 B Harvest of Apples(莫队)
Problem B. Harvest of Apples Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Su ...
- 牛客网第二场Jfarm(随机化+二维前缀和)
链接:https://www.nowcoder.com/acm/contest/140/J 来源:牛客网 White Rabbit has a rectangular farmland of n*m. ...
- libcurl编译使用,实现ftp功能
Libcurl实现ftp的下载,上传功能.版本为curl-7.63.0 1.编译vs2015 参考资料:https://blog.csdn.net/yaojingkao/article/details ...
- JJTree Tutorial for Advanced Java Parsing
The Problem JJTree is a part of JavaCC is a parser/scanner generator for Java. JJTree is a preproces ...
- H264视频压缩算法
H264视频压缩算法现在无疑是所有视频压缩技术中使用最广泛,最流行的.随着 x264/openh264以及ffmpeg等开源库的推出, 大多数使用者无需再对H264的细节做过多的研究,这大降低了人们使 ...
- 浅谈jQuery的promise
jquery中的Promise,也就是我们所知道的Deferred对象. 举例1: var data=""; function runAsync(){ var def = $.De ...
- 常用模块Part(2)
logging模块 hashlib模块 hashlib模块 Python的hashlib提供了常见的摘要算法,如MD5,SHA1等等. # 什么是摘要算法呢?摘要算法又称哈希算法.散列算法.它通过一个 ...
- angularjs 下滑线滑动
css: .detail_row { width: 410px; height: 34px; clear: both; border-bottom: 1px solid #eaeeef; font-s ...