结对同学的博客链接
本作业博客的链接
Github项目地址
附加功能代码
PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) |
---|---|---|---|
Planning | 计划 | 30 | 30 |
· Estimate | · 估计这个任务需要多少时间 | 30 | 30 |
Development | 开发 | 1770 | 1740 |
· Analysis | · 需求分析 (包括学习新技术) | 120 | 150 |
· Design Spec | · 生成设计文档 | 30 | 30 |
· Design Review | · 设计复审 | 30 | 30 |
· Coding Standard | · 代码规范 (为目前的开发制定合适的规范) | 30 | 60 |
· Design | · 具体设计 | 120 | 90 |
· Coding | · 具体编码 | 900 | 720 |
· Code Review | · 代码复审 | 180 | 180 |
· Test | · 测试(自我测试,修改代码,提交修改) | 360 | 480 |
Reporting | 报告 | 120 | 120 |
· Test Repor | · 测试报告 | 60 | 30 |
· Size Measurement | · 计算工作量 | 30 | 20 |
· Postmortem & Process Improvement Plan | · 事后总结, 并提出过程改进计划 | 30 | 70 |
合计 | 1920 | 1890 |
f = open("result.txt", ‘a‘, encoding=‘utf-8‘)
html1 = urllib.request.urlopen("http://openaccess.thecvf.com/CVPR2018.py").read()
bf1 = BeautifulSoup(html1)
texts1 = bf1.select(‘.ptitle‘)
a_bf = BeautifulSoup(str(texts1))
a = a_bf.find_all(‘a‘)
urls = []
for each in a:
urls.append("http://openaccess.thecvf.com/" + each.get(‘href‘))
for i in range(len(urls)):
f.write(str(i))
f.write("\n")
html2 = urllib.request.urlopen(urls[i]).read()
bf = BeautifulSoup(html2)
texts2 = bf.find_all(‘div‘, id=‘papertitle‘)
f.write("Title: " + texts2[0].text.lstrip(‘\n‘) + "\n")
texts3 = bf.find_all(‘div‘, id=‘abstract‘)
f.write("Abstract: " + texts3[0].text.lstrip(‘\n‘) + "\n\n\n")
031602114&031602444
|- src
|- WordCount.sln
|- WordCount
|- CharCount.cpp
|- CharCount.h
|- LineCount.cpp
|- LineCount.h
|- WeightTypeNE.cpp
|- WeightTypeNE.h
|- SortTopN.cpp
|- SortTopN.h
|- Word_Group_Cnt.cpp
|- Word_Group_Cnt.h
|- WordCount.cpp
|- WordCount.h
|- pch.cpp
|- pch.h
|- main.cpp
|- WordCount.vcxproj
|- cvpr
|- Crawler.py
|- result.txt
#### 关系图
爬虫能力有限orz,只从网站综合爬取论文的除题目、摘要外其他信息。爬虫语言使用python。额外爬取信息有:作者、PDF链接、SUPPPDF链接、ARXIV链接。
txt文件如图:
想象力有限orz,我们分析了论文列表中各位作者之间的关系,论文A的第一作者可能同时是论文B的第二作者,不同论文多位作者之间可能存在着联系,并将关系可视化。
我们从附加功能1的txt文件提取了发表在2018cvpr顶会上的所有论文的第一作者和第二作者,使用分析工具NodeXL做出了关系图谱。
图谱全貌如下:
逐渐剔除较少联系点的图谱如下:
(没有第二作者时在第二作者处填empty)
可以看出在2018cvpr上发表论文且是主要作者的大神就是——Qi Wu,紧接着还有Wei Wang,Tomer Michaeli,Ross Girshick等等。(然后发表数目多的主要作者们互相之间都不合作的吗……
具体解释: 使用辅助队列存储每个合法单词的长度,通过入队和出队操作更新string进行截取不断获得新的词组;函数详情在以下.h文件中均有描述;
/*统计指定长度的合法单词量形成的词组词频*/
void Word_Group_Cnt(int word_Group_Len, string str, map <string, int > &group_Map,int ttl_Abs)
{
string word_Now = "";
string word_Group = "";
int lenth = str.length();
queue <int> que;
for (int i = 0; i < lenth; i++)
{
if (Is_Num(str[i]) || Is_Engch(str[i]) && i != lenth - 1) //字符是字母或数字就将其连接到word_Now
{
word_Now += str[i];
continue;
}
else if (Is_Num(str[i]) || Is_Engch(str[i]) && i == lenth - 1) //字符是字母或数字且为字段末位连接后就需要对末尾的单词判断是否为合法单词,否则会跳出循环漏掉末尾一个单词;
{
word_Now += str[i];
word_Now = Is_Word(word_Now);
int word_Len = word_Now.length();
if (word_Len >= 4)
{
word_Group += word_Now;
if (que.size() == word_Group_Len - 1)
{
group_Map[word_Group] += ttl_Abs;
}
else if (que.size() > word_Group_Len - 1)
{
word_Group = word_Group.substr(que.front());
group_Map[word_Group] += ttl_Abs;
}
}
else if (word_Len >= 0 && word_Len < 4)
{
continue;
}
}
else
{
word_Now = Is_Word(word_Now);
int word_Len = word_Now.length();
if (word_Len >= 4)
{
word_Group += word_Now;
if (que.size() < word_Group_Len - 1) //队列大小比所需合法单词数word_Group_Len-1小情况
{
word_Group += str[i];
word_Len += 1;
while (!Is_Num(str[i + 1]) && !Is_Engch(str[i + 1]) && i + 1 < lenth)
{
word_Group += str[i + 1];
word_Len += 1;
i += 1;
}
que.push(word_Len);
word_Now = "";
}
else if (que.size() == word_Group_Len - 1) //队列大小=所需合法单词数word_Group_Len-1情况
{
group_Map[word_Group] += ttl_Abs;
word_Group += str[i];
word_Len += 1;
while (!Is_Num(str[i + 1]) && !Is_Engch(str[i + 1]) && i + 1 < lenth)
{
word_Group += str[i + 1];
word_Len += 1;
i += 1;
}
que.push(word_Len);
word_Now = "";
}
else if (que.size() > word_Group_Len - 1) //队列大小等于词组所需合法单词数量,则对队列进行进队和出队操作更新string并进行截取
{
word_Group = word_Group.substr(que.front());
group_Map[word_Group] += ttl_Abs;
que.pop();
word_Group += str[i];
word_Len += 1;
while (!Is_Num(str[i + 1]) && !Is_Engch(str[i + 1]) && i + 1 < lenth)
{
word_Group += str[i + 1];
word_Len += 1;
i += 1;
}
que.push(word_Len);
word_Now = "";
}
}
else if (word_Len > 0 && word_Len < 4) //遇到不合法单词且不是分隔符或空串的,则返回为no,将队列清空
{
while (que.empty() != 1)
{
que.pop();
}
word_Now = "";
word_Group = "";
}
else if (word_Len == 0)
{
continue;
} //是否要判断在输入到函数中
}
}
}
测试的函数及其测试数据构造思路:
对于其他一些函数,因为在计算行数、计算单词数、计算字符数、词组切割统计以及词频排序中都有调用,而这些函数测试均正确,因此那些简易的函数的没有做出测试,通过复杂函数的正确测试间接反应其正确性。
部分代码展示:
namespace IsWord //判断是否是单词
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestMethod1)
{
string word = "123ajlk";
word = Is_Word(word);
Assert::IsTrue(word == "no");
}
TEST_METHOD(TestMethod2)
{
string word = "Ajlk";
word = Is_Word(word);
Assert::IsTrue(word == "ajlk");
}
TEST_METHOD(TestMethod3)
{
string word = "Ajl";
word = Is_Word(word);
Assert::IsTrue(word == "no");
}
TEST_METHOD(TestMethod4)
{
string word = "Ajlk123";
word = Is_Word(word);
Assert::IsTrue(word == "ajlk123");
}
TEST_METHOD(TestMethod5)
{
string word = "jl12k23";
word = Is_Word(word);
Assert::IsTrue(word == "no");
}
};
}
namespace Word_Group_Count //词组切割统计
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestMethod1)
{
map<string, int> m;
Word_Group_Cnt(3, "aaaa bbbb cccc cccc bbbb cccc aaaa dddd cccc bbbb aaaa bbbb cccc dddd", m, 10);
Assert::IsTrue(m["aaaa bbbb cccc"] == 20 && m["bbbb cccc cccc"] == 10);
}
TEST_METHOD(TestMethod2)
{
map<string, int> m;
Word_Group_Cnt(4, "aaaa bbbb cccc dddd bbbb cccc aaaa dddd cccc bbbb aaaa bbbb cccc dddd", m, 10);
Assert::IsTrue(m["aaaa bbbb cccc dddd"] == 20 && m["bbbb cccc dddd bbbb"] == 10);
}
TEST_METHOD(TestMethod3)
{
map<string, int> m;
Word_Group_Cnt(2, "aaaa bbbb cccc cccc bbbb cccc aaaa dddd cccc bbbb aaaa bbbb cccc dddd", m, 10);
Assert::IsTrue(m["bbbb cccc"] == 30 && m["aaaa bbbb"] == 20);
}
TEST_METHOD(TestMethod4)
{
map<string, int> m;
Word_Group_Cnt(5, "aaaa (bbbb) cccc cccc bbbb cccc aaaa dddd cccc bbbb aaaa bbbb cccc dddd", m, 10);
Assert::IsTrue(m["aaaa (bbbb) cccc cccc bbbb"] == 10 && m["bbbb aaaa bbbb cccc dddd"] == 10);
}
TEST_METHOD(TestMethod5)
{
map<string, int> m;
Word_Group_Cnt(6, "aaaa (bbbb)-cccc cccc bbbb cccc aaaa dddd cccc bbbb aaaa bbbb cccc dddd", m, 10);
Assert::IsTrue(m["aaaa (bbbb)-cccc cccc bbbb cccc"] == 10 && m["aaaa dddd cccc bbbb aaaa bbbb"] == 10);
}
};
}
代码覆盖率:
(两人提交记录)
① 佩佩
问题描述:
做过哪些尝试:
②沸沸
有何收获:
爬虫能力提升,搜索能力提升
胡绪佩
佩佩,有太多值得我学习的地方了……比如遇到bug不放弃坚持持续打码n小时解决,比如遇到问题钻研求知的精神,比如知难而进的性格,比如在我睡觉的时候把博客发了……好队友!!!
基本上没有,除了让我不要偷偷背着他打代码hhhhhhh
庄卉
#### 值得学习的地方
沸沸,有太多值得我学习的地方了+1......比如看到项目便知道体谅队友把难点(附加功能)揽下力肝(卉:表示并没有完成得很好),比如写代码速度总是莫名其妙超快的不知道有何秘诀!比如善于和队友沟通交流的团队精神,解决未知困难的能力plusplus,完美解决了本次作业第一第二作者图谱的这个难点,比如温柔美丽的气质......棒队友!!!
#### 需要改进的地方
基本上没有,再有机会紧抱大腿我定紧紧不放xixixi
第N周 | 新增代码(行) | 累计代码(行) | 本周学习耗时(小时) | 累计学习耗时(小时) | 重要成长 |
---|---|---|---|---|---|
1 | 666 | 666 | 15 | 15 | 复习c++,学习单元测试和代码覆盖率,学习git |
2 | 97 | 763 | 4 | 19 | 没什么成长,就是在优化代码 |
3 | 0 | 0 | 10 | 29 | 阅读《构建之法》第三章和第八章,学习使用Axure RP8,了解原型设计的方法 |
4 | 197 | 960 | 20 | 49 | 进一步学习爬虫(了解beautifulsoup使用、学会使用正则),学习使用git进行团队协作,学习使用NodeXL,了解flask |
原文:https://www.cnblogs.com/ffxpy/p/9768540.html