从该 pdf 文件中可以提取绿色专利技术专利分类体系表:绿色技术专利分类体系-table.pdf,这可以借助浏览器的打印功能得到。使用 Adobe Acrobat 软件可以把 pdf 文件转换成 xlsx 文件,附件中的 绿色技术专利分类体系-table.xlsx 就是转换结果。简单手动整理后再使用 Stata 处理下:
import excel using "绿色技术专利分类体系-table.xlsx", clear first dropD compress foreach i of varlist _all { capformat`i' %10s } replace 国际专利分类 = 国际专利分类[_n] + 国际专利分类[_n + 1] ifmi(技术分支编号[_n + 1]) dropifmi(技术分支编号) gen 绿色专利分类ID = _n order 绿色专利分类ID
gen temp = ustrregexs(0) if ustrregexm(国际专利分类, "\n") replace 国际专利分类 = subinstr(国际专利分类, temp, "", .) drop temp
gen temp = ustrregexs(0) if ustrregexm(技术分支名称, "\n") replace 技术分支名称 = subinstr(技术分支名称, temp, "", .) drop temp
从该 pdf 文件中可以提取参考检索式部分:参考检索式.pdf,参考检索式.xlsx 是转换并手动整理得到的结果,使用 Stata 处理下:
import excel using "参考检索式.xlsx", clear first
*- 替换换行符 gen temp = ustrregexs(0) if ustrregexm(参考关键词, "(\n)") replace 参考关键词 = subinstr(参考关键词, temp, "", .) drop temp
gen temp = ustrregexs(0) if ustrregexm(IPC分类, "(\n)") replace IPC分类 = subinstr(IPC分类, temp, "", .) drop temp
gen 绿色专利分类ID = _n order 绿色专利分类ID
replace IPC分类 = subinstr(IPC分类, " ", "", .)
foreach i of varlist _all { capformat`i' %20s } replace 参考关键词 = subinstr(参考关键词, " ", " ", .) replace 参考关键词 = subinstr(参考关键词, " ", " ", .) save 参考检索式, replace
检索式翻译成正则表达式
例如其中有一条:
参考关键词:(煤 OR COAL) (2N) (采 OR 矿 OR 井 OR EXCAVAT* OR MINE OR MINING OR PRODUCTING) 参考检索式:IPC=(E02D17/20 OR E02D19/06) AND TIABC=((煤 OR COAL) (2N) (采 OR 矿 OR 井 OR EXCAVAT* OR MINE OR MINING OR PRODUCTING))
Stata 中当然是不支持这种参考检索式的,所以我们需要把这些检索式一一翻译成正则表达式。这里有一些注意事项:
IPC 表示 IPC 专利分类号;
TIABC 表示标题+摘要;
检索式中的 N、W 和 S 是检索词的连接关系符号。N 没有顺序的限制,W 有顺序限制,S则是在同一句。1/2/3的数字表示两个检索词之间的隔的字数(小于等于该数字)。如检索“车座”(1N)“车把”,可以检索出“车座和车把”、“车把和车座”、“车座车把”、“车把车座”等将车座与车把间隔小于等于1个字并且没有顺序的语句,但检索“车座”(1W)“车把”仅能检索出“车座和车把”或“车座在车把”、“车座车把”等将车座与车把间隔小于等于1个字并且有顺序的语句。
因此例如这个翻译成 Stata 支持的正则表达式应该是:
:=> (煤 OR COAL) (2N) (采 OR 矿 OR 井 OR EXCAVAT* OR MINE OR MINING OR PRODUCTING) :=> ustrregexm(text, "(煤|COAL)((.{0,2})|((?:\s*\b\w+\b\s*){0,2}))(采|矿|井|EXCAVAT\w*\b|MINE|MINING|PRODUCTING)|(采|矿|井|EXCAVAT\w*\b|MINE|MINING|PRODUCTING)((.{0,2})|((?:\s*\b\w+\b\s*){0,2}))(煤|COAL)")
clear all set obs 6 input str100 text "煤炭开采" "煤采" "煤炭开发开采" "coal-mining" 开采煤炭 "co-mining" compress replace text = strupper(text) gen code = `"ustrregexm(text, "(煤|COAL)((.{0,2})|((?:\s*\b\w+\b\s*){0,2}))(采|矿|井|EXCAVAT\w*\b|MINE|MINING|PRODUCTING)|(采|矿|井|EXCAVAT\w*\b|MINE|MINING|PRODUCTING)((.{0,2})|((?:\s*\b\w+\b\s*){0,2}))(煤|COAL)")"' gen res = `=code[_n]'
compress foreach i of varlist _all { capformat`i' %10s } gen 技术分支编号 = ustrregexs(0) if ustrregexm(绿色技术分支, "[\d.]*") replace IPC分类 = subinstr(IPC分类, " ", "", .)
gen temp = ustrregexs(0) if ustrregexm(IPC分类, "\n") replace IPC分类 = subinstr(IPC分类, temp, "", .) drop temp drop 绿色技术分支 order 技术分支编号 carryforward 技术分支编号, replace gen myid = _n order myid dropifmi(技术分支编号) mergem:1 参考关键词 using "待翻译正则表达式-翻译结果" drop _m gsort myid drop 参考关键词 split IPC分类, parse(",") drop IPC分类 gather IPC分类* dropifmissing(value) dropvar save tempdata1, replace
replace value = "C01B3/00"if value == "C01B3/00(NOT:C01B3/04)" replace value = "F03B13/00"if value == "F03B13/00(NOT:F03B13/02ORF03B13/04ORF03B13/12)" replace value = "E02B9/00"if value == "E02B9/00(NOT:E02B9/08)" replace value = "F03B17/02"if value == "F03B17/02(NOT:F03B17/04)" replace value = "C10G1/00"if value == "C10G1/00(NOT:C10G1/10)" replace value = "C10L3/00"if value == "C10L3/00(NOT:C10L3/02" replace value = "G01R31/00"if value == "G01R31/00(NOTG01R31/01" replace value = "B01D53/34"if value == "B01D53/34(NOT:B01D53/84)" replace value = "C09K23/00"if value == "(C09K23/00NOTC09K23/50)" replace value = "B01F17/00"if value == "(B01F17/00NOTB01F17/50)" replace value = "C08L101/00"if value == "(C08L101/00NOTC08L101/16)" replace value = "B60K1/00"if value == "B60K1/00NOTB60K1/04" replace value = "B60K6/00"if value == "B60K6/00NOT(B60K6/28ORB60K6/30)" replace value = "B60W10/00"if value == "B60W10/00NOTB60W10/26" replace value = "B60W20/00"if value == "B60W20/00NOTB60W20/16" replace value = "C05G3/00"if value == "(C05G3/00NOTC05G3/02)" replace value = "C05G3/00"if value == "(C05G3/00NOTC05G3/60)"
use 参考关键词整理结果, clear gen len = strlen(IPC) tab len gsort len capmkdir"res1" forvall = 3/12 { preserve keepif len == `l' save res1/`l', replace restore }
循环匹配筛选:
capmkdir"res2" use IPC分类号拆分结果.dta, clear *- strL 格式的变量不能用来进行 joinby,所以要 recast 下: recast str12 IPC, force gen len = strlen(IPC) replace IPC = ustrregexs(0) if ustrregexm(IPC, ".{5,6}/.{2}") & len > 12 replace len = strlen(IPC) tab len drop len
forvall = 3/12 { preserve replace IPC = substr(IPC, 1, `l') joinby IPC using res1/`l' save res2/`l', replace restore }
*- 合并 use res2/3, clear forvall = 4/12 { append using res2/`l' } countif 正则表达式 == "1==1" drop len IPC duplicatesdrop ipzlid myid, force save 初步筛选结果, replace
这样就完成了初步筛选。
筛选符合关键词条件的专利
再把标题和关键词信息合并进来:
use 初步筛选结果, clear tostring ipzlid, replaceformat(%16.0f) mergem:1 ipzlid using 2010年专利申请数据.dta dropif _m == 2 drop _m egen expgroup = group(正则表达式) codebook expgroup
评论