This repository has been archived by the owner on Nov 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDisambig.m
162 lines (113 loc) · 3.43 KB
/
Disambig.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
start_time=now;
%%% matrix and sub-matrix transpose to expedite memory access %%%
%%% matrix and sub-matrix transpose to expedite memory access %%%
keep=strncmp(words,'LN',2);
XXLN=XX(:,keep);
XXLNt=XXLN';
keep=strncmp(words,'FN',2);
XXFN=XX(:,keep);
XXFNt=XXFN';
keep=strncmp(words,'NM',2);
XXNM=XX(:,keep);
XXNMt=XXNM';
keep=strncmp(words,'AS',2);
XXAS=XX(:,keep);
XXASt=XXAS';
keep=strncmp(words,'CT',2);
XXCT=XX(:,keep);
XXCTt=XXCT';
keep=strncmp(words,'CL',2);
XXCL=XX(:,keep);
XXCLt=XXCL';
patno_1=1:length(patno);
patno_1=patno_1';
%%% matrix and sub-matrix transpose to expedite memory access %%%
%%% matrix and sub-matrix transpose to expedite memory access %%%
step=ones(length(patno),1)>0;
inventor_id_new=inventor_id;
namey=namex;
for index=1:length(patno)
if ~step(index)
continue;
end
target=XXLNt(:,index);
C_lastname=XXLN(:,target);
target=XXFNt(:,index);
C_firstname=XXFN(:,target);
target=XXNMt(:,index);
C_name=XXNM(:,target);
target=XXASt(:,index);
C_assignee=XXAS(:,target);
target=XXCTt(:,index);
C_city=XXCT(:,target);
target=XXCLt(:,index);
C_class=XXCL(:,target);
lump_index_2=step&C_name&((C_assignee|C_city|C_class)); %% perfect match %%
lump_index_1=step&C_firstname&C_lastname&((C_assignee&C_city&C_class)); %% imperfect match %%
lump_patno_2=patno(lump_index_2);
lump_patno_1=patno(lump_index_1);
lump_index_2=find(lump_index_2);
lump_index_1=find(lump_index_1);
lump_index_1_=[];
%% if exists in patno_1 and in patno_2, then take out patno_1 (full match)
for ii=1:length(lump_index_1)
if ~any(strcmp(lump_patno_1{ii},lump_patno_2))
lump_index_1_(end+1)=lump_index_1(ii);
end
end
%% if exists in patno_1 and in patno_2, then take out patno_1 (full match)
lump_index=union(lump_index_1_,lump_index_2);
%%% find repeated patent NO.s adopted %%%
lump_initial=lump_index;
lump_after=lump_initial;
if length(lump_initial)>0
for indexx=1:length(lump_initial)
indexy=lump_initial(indexx);
target=XXLNt(:,indexy);
C_lastname=XXLN(:,target);
target=XXFNt(:,indexy);
C_firstname=XXFN(:,target);
target=XXNMt(:,indexy);
C_name=XXNM(:,target);
target=XXASt(:,indexy);
C_assignee=XXAS(:,target);
target=XXCTt(:,indexy);
C_city=XXCT(:,target);
target=XXCLt(:,indexy);
C_class=XXCL(:,target);
lump_index_2=step&C_name&((C_assignee|C_city|C_class)); %% perfect match %%
lump_index_1=step&C_firstname&C_lastname&((C_assignee&C_city&C_class)); %% imperfect match %%
lump_patno_2=patno(lump_index_2);
lump_patno_1=patno(lump_index_1);
lump_index_2=find(lump_index_2);
lump_index_1=find(lump_index_1);
lump_index_1_=[];
%% if exists in patno_1 and in patno_2, then take out patno_1 (full match)
for ii=1:length(lump_index_1)
if ~any(strcmp(lump_patno_1{ii},lump_patno_2))
lump_index_1_(end+1)=lump_index_1(ii);
end
end
%% if exists in patno_1 and in patno_2, then take out patno_1 (full match)
lump_index=union(lump_index_1_,lump_index_2);
lump_after_2=lump_index;
lump_after=union(lump_after,lump_after_2);
end
end
lump=union(lump_initial,lump_after);
if length(lump)==0
step(index)=false;
continue;
end
for i=length(lump):-1:1
step(lump(i))=false;
inventor_id_new{lump(i)}=inventor_id_new{index};
namey{lump(i)}=namey{index};
end
end
fprintf('\n\n');
fid0=fopen('_disambiguator_output.tsv','w');
for i=1:length(inventor_id_new)
fprintf(fid0,'%s\t%s\n',key{i},inventor_id_new{i});
end
fclose(fid0);