这个是美国专利文件的下载的地址

http://www.nber.org/patents/

escription Documentation Data -- Pkzipped
SAS .tpt ASCII CSV
Overview overview.txt --
Pairwise citations data Cite75_99.txt Cite75_99.zip -- (68 Mb) acite75_99.zip -- (82 Mb)
Patent data, including constructed variables pat63_99.txt pat63_99.zip -- (90Mb) apat63_99.zip -- (56Mb)
Assignee names coname.txt coname.zip -- (2Mb) aconame.zip -- (2Mb)
Contains the match to CUSIP numbers match.txt match.zip -- (130Kb) amatch.zip -- (98Kb)
Individual inventor records inventor.txt inventor.zip -- (98Mb) ainventor.zip -- (82Mb)
Class codes with corresponding class names classes.txt --
Country codes with corresponding country names countries.txt
Class, technological category, and technological subcategory crosswalk class_match.txt
Technological category and subcategory labels subcategory.txt -- subcategory.csv
SAS program to convert .tpt files to native SAS format -- read_tpt.sas --
U.S. Patent Classification (USPC) System and the Standard Industrial Code (SIC) System

下载该网站的下面这二个文件作为分析对象

Cite75_99.zip -- (68 Mb) acite75_99.zip -- (82 Mb)
Patent data, including constructed variables pat63_99.txt pat63_99.zip -- (90Mb)

第一MapReduce的要求就是

表示出某个专利,被哪些专利引用

package PatentStatistics;

import java.io.IOException;

/**
 * 构建专利引用列表,输入专利引用关系的关系对(patentNo1,patentNo2) 文件,输出每个专利号的所引用的文件,以逗号相隔。
 * 
 */
public class PatentCitation {
public static class PatentCitationMapper extends
Mapper<LongWritable, Text, Text, Text> {
/**
* 输入键位行偏移,值为“专利号1,专利号2”
*/
@Override
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
String[] citation = value.toString().split(",");
context.write(new Text(citation[1]), new Text(citation[0]));
}
}

public static class PatentCitationReducer extends
Reducer<Text, Text, Text, Text> {
public void reduce(Text key, Iterable<Text> values, Context context)
throws IOException, InterruptedException {
StringBuilder csv = new StringBuilder("");
for (Text val : values) {
if (csv.length() > 0) {
csv.append(",");
}
csv.append(val.toString());
}
context.write(key, new Text(csv.toString()));
}
}

public static void main(String[] args) throws IOException,
InterruptedException, ClassNotFoundException {
Job patentCitationJob = new Job();
patentCitationJob.setJobName("patentCitationJob");
patentCitationJob.setJarByClass(PatentCitation.class);

patentCitationJob.setMapperClass(PatentCitationMapper.class);
patentCitationJob.setMapOutputKeyClass(Text.class);
patentCitationJob.setMapOutputValueClass(Text.class);

patentCitationJob.setReducerClass(PatentCitationReducer.class);
patentCitationJob.setOutputKeyClass(Text.class);
patentCitationJob.setOutputValueClass(Text.class);

patentCitationJob.setInputFormatClass(TextInputFormat.class);
patentCitationJob.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.addInputPath(patentCitationJob, new Path(args[0]));
FileOutputFormat.setOutputPath(patentCitationJob, new Path(args[1]));

patentCitationJob.waitForCompletion(true);
System.out.println("finished!");
}
}

2、专利被引用的次数的计算

package PatentStatistics;

import java.io.IOException;

/**
 * 专利被引用次数统计
 */
public class CitationCount {
public static class PatentCitationMapper extends
Mapper<LongWritable, Text, Text, IntWritable> {
private IntWritable one = new IntWritable(1);

public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
// 输入key: 行偏移值;value: “citing专利号, cited专利号” 数据对
String[] citation = value.toString().split(",");
// 输出key: cited 专利号;value: 1
context.write(new Text(citation[1]), one);
}
}

public static class ReduceClass extends
Reducer<Text, IntWritable, Text, IntWritable> {
public void reduce(Text key, Iterable<IntWritable> values,
Context context) throws IOException, InterruptedException {
int count = 0;
for (IntWritable val : values) {
count += val.get();
}
// 输出key: 被引专利号;value: 被引次数
context.write(key, new IntWritable(count));
}
}

public static void main(String[] args) throws IOException,
InterruptedException, ClassNotFoundException {
Job citationCountJob = new Job();
citationCountJob.setJobName("citationCountJob");
citationCountJob.setJarByClass(CitationCount.class);

citationCountJob.setMapperClass(PatentCitationMapper.class);
citationCountJob.setMapOutputKeyClass(Text.class);
citationCountJob.setMapOutputValueClass(IntWritable.class);

citationCountJob.setReducerClass(ReduceClass.class);
citationCountJob.setOutputKeyClass(Text.class);
citationCountJob.setOutputValueClass(IntWritable.class);

citationCountJob.setInputFormatClass(TextInputFormat.class);
citationCountJob.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.addInputPath(citationCountJob, new Path(args[0]));
FileOutputFormat.setOutputPath(citationCountJob, new Path(args[1]));

citationCountJob.waitForCompletion(true);
System.out.println("finished!");
}
}

3专利被引用次数的直方图,key就是被引用的数,value就是出现该数的个数

package PatentStatistics;

import java.io.IOException;

/**
 * 专利被引用次数分布统计,输入文件为专利引用次数统计的输出结果 扫描文件忽略专利号,仅仅考虑被引用的次数,统计每一个次数分别 有多少次出现。
 * 
 */
public class CitationCountDistribution {
public static class MapClass extends
Mapper<Object, Text, IntWritable, IntWritable> {
private IntWritable one = new IntWritable(1);

@Override
protected void map(Object key, Text value, Context context)
throws IOException, InterruptedException {
IntWritable citationCount = new IntWritable(Integer.parseInt(value
.toString().split(" ")[1]));
context.write(citationCount, one);
}
}

public static class ReduceClass extends
Reducer<IntWritable, IntWritable, IntWritable, IntWritable> {
public void reduce(IntWritable key, Iterable<IntWritable> values,
Context context) throws IOException, InterruptedException {
int count = 0;
for (IntWritable val : values) {
count += val.get();
}
// 输出key: 被引次数;value: 总出现次数
context.write(key, new IntWritable(count));
}
}

public static void main(String[] args) throws IOException,
InterruptedException, ClassNotFoundException {
Job citationCountDistributionJob = new Job();
citationCountDistributionJob.setJobName("citationCountDistributionJob");
citationCountDistributionJob
.setJarByClass(CitationCountDistribution.class);

citationCountDistributionJob.setMapperClass(MapClass.class);
citationCountDistributionJob.setMapOutputKeyClass(IntWritable.class);
citationCountDistributionJob.setMapOutputValueClass(IntWritable.class);

citationCountDistributionJob.setReducerClass(ReduceClass.class);
citationCountDistributionJob.setOutputKeyClass(IntWritable.class);
citationCountDistributionJob.setOutputValueClass(IntWritable.class);

citationCountDistributionJob.setInputFormatClass(TextInputFormat.class);
citationCountDistributionJob
.setOutputFormatClass(TextOutputFormat.class);
FileInputFormat.addInputPath(citationCountDistributionJob, new Path(
args[0]));
FileOutputFormat.setOutputPath(citationCountDistributionJob, new Path(
args[1]));

citationCountDistributionJob.waitForCompletion(true);
System.out.println("finished!");
}
}

使用MapReduce实现专利文件的分析相关推荐

  1. 《MapReduce 2.0源码分析与编程实战》一第1章 HBase介绍

    本节书摘来异步社区<MapReduce 2.0源码分析与编程实战>一书中的第1章,作者: 王晓华 责编: 陈冀康,更多章节内容可以访问云栖社区"异步社区"公众号查看. ...

  2. 《MapReduce 2.0源码分析与编程实战》一1.5 看,大象也会跳舞

    本节书摘来异步社区<MapReduce 2.0源码分析与编程实战>一书中的第1章,第1.5节,作者: 王晓华 责编: 陈冀康,更多章节内容可以访问云栖社区"异步社区"公 ...

  3. MapReduce中各个阶段的分析(转自道法—自然老师)

    MapReduce中各个阶段的分析: 在MapReduce的各个阶段: 在文件被读入的时候调用的是Inputformat方法读入的.inputformat-->recordreader--> ...

  4. 专利检索及分析模拟登陆(python)

    登陆程序:#!/usr/bin/env python # -*- coding: UTF-8 -*-import requests import time import base64codeurl = ...

  5. hadoop之slaves文件详细分析

    hadoop之saves文件详细分析(一) 注:所有操作基于hadopp-2.7.5,本篇文章主要涉及一些对于slaves文件之于hadoop平台的思考 首先大家都知道,要想配置一个完全分布式平台,首 ...

  6. 全球物联网专利竞争态势分析

    1 引言 物联网(Internet of Things,IoT),最早的概念出现在1995年比尔盖茨撰写的<未来之路>(The Road Ahead)一书中.在该书中,遗失的物件会发信息给 ...

  7. 计算机检索的优点,专利检索与分析系统拥有哪些优势?

    专利检索与分析系统拥有哪些优势?现在很多朋友都在了解专利检索与分析系统又有哪些优势,因为他们需要使用这些系统,不少朋友都会利用业余时间搞各种发明专利,并申请发明专利,在申请之前,人们就需要对专利进行检 ...

  8. 如何手动生成Dump文件并分析Dump文件

    大家都知道,当服务器出现蓝屏问题时,我们需要获取系统所产生的DUMP文件进行分析,如何确保在系统问题发生时,可以正确的生成所需要的DUMP文件呢?我们需要做如下检查: 1).右键点击"我的电 ...

  9. 对WoW Shader文件的分析

    Wow的渲染引擎是同时支持固定渲染管线渲染和Shader渲染管线渲染的. bls文件是wow的shader文件,分析它的实现可以学习引擎是怎样渲染的,以及如何做一个兼容固定管线和Shader管线的引擎 ...

  10. JavaCore/HeapDump文件及其分析方法

    产生时间 Java程序运行时,有时会产生JavaCore及HeapDump文件,它一般发生于Java程序遇到致命问题的情况下. 有时致命问题发生后,Java应用不会死掉,还能继续运行: 但有时致命问题 ...

最新文章

  1. linux 修改主机名 修改ip
  2. 安卓 静态文件读取 staticFile
  3. (SpringMVC)拦截器
  4. Oracle中DUMP转储方法
  5. Gym - 102460A Rush Hour Puzzle(dfs迭代加深)
  6. 300来行代码实现最小Linux文件系统
  7. Eclipse集成svn后出现Failed to load JavaHL Library的解决办法
  8. Linux查找树莓派ip地址,让树莓派“说”出自己的IP地址
  9. CodeDom系列--事件(event)定义和反射调用
  10. OSGi运行环境下java反序列化问题的解决方式
  11. .Net中的AOP系列之《单元测试切面》
  12. eclipse里安装SVN插件的两种方式
  13. 英文环境中Wine微信不能显示中文
  14. 吊打迅雷,最好用的BT种子下载器,下载不限速
  15. C语言文件操作(文件读写)
  16. 通过spi调试linux应用程序,654123??SPI linux 驱动调试感悟
  17. 用java在画布上画心形线_Java画心形线
  18. android wi-fi_如何在Android上限制计量Wi-Fi网络的背景数据
  19. tomcat小版本升级
  20. 模型通道剪枝汇总(channel pruning)

热门文章

  1. “狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
  2. 18位身份证校验代码
  3. U盘重装Mac全新的操作系统详细教程
  4. 微信公众号配置模板消息
  5. OMNet++ Tic Toc例程的解析1
  6. 微服务调用Ribbon负载均衡、Feign的使用
  7. win10系统pyCharm安装及最新2018激活码
  8. 2021-05-15 随机生成车架号
  9. php 图片裁剪后保存,php – 如何保存裁剪的图像
  10. 基于MATLAB的车牌识别系统