Skip to content

Commit

Permalink
maj
Browse files Browse the repository at this point in the history
  • Loading branch information
Patent2net committed Jun 3, 2022
1 parent 19f5e7e commit ab444a2
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 29 deletions.
151 changes: 151 additions & 0 deletions Patent2Net/Carrot2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<link rel="shortcut icon" href="./favicon.ico"/>
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/>
<meta name="theme-color" content="#000000"/>
<meta name="description"
content="Carrot2 organizes your search results into topics. With an instant overview of what's available, you will quickly find what you're looking for."/>
<meta name="keywords"
content="document clustering, text categorization, grouping, software, java library, visualization, open source"/>
<title>Carrot2 search results clustering engine</title>
<style>.ie {
margin: 2em auto;
padding: 2em 2em .5em 2em;
border: 1px solid hsla(200, 50%, 50%, .2);
background-color: hsla(200, 50%, 50%, .04);
width: 24em;
border-radius: .5em
}</style>
<link href="./static/css/9.c21952d6.chunk.css" rel="stylesheet">
<link href="./static/css/main.5800980c.chunk.css" rel="stylesheet">
</head>
<body>
<noscript>Enable JavaScript to run this app.</noscript>
<script>window.onerror = function () {
if (!("Symbol" in window) || !("Promise" in window)) {
var o = document.getElementById("root");
o.className = "ie", o.innerHTML = "<p><strong>Internet Explorer is not supported, sorry.</strong></p><p>Try any modern browser, such as: </p><ul><li><a href='https://www.microsoft.com/en-us/windows/microsoft-edge'>Microsoft Edge</a></li><li><a href='https://www.mozilla.org/en-US/firefox/new/'>Firefox</a></li><li><a href='https://www.google.com/chrome/'>Google Chrome</a></li><li><a href='https://www.opera.com/'>Opera</a></li></ul>"
}
}</script>
<div id="root"></div>
<script>!function (e) {
function t(t) {
for (var n, c, i = t[0], l = t[1], p = t[2], s = t[3] || [], d = 0, h = []; d < i.length; d++) c = i[d], Object.prototype.hasOwnProperty.call(o, c) && o[c] && h.push(o[c][0]), o[c] = 0;
for (n in l) Object.prototype.hasOwnProperty.call(l, n) && (e[n] = l[n]);
for (f && f(t), a.push.apply(a, s); h.length;) h.shift()();
return u.push.apply(u, p || []), r()
}

function r() {
for (var e, t = 0; t < u.length; t++) {
for (var r = u[t], n = !0, l = 1; l < r.length; l++) {
var p = r[l];
0 !== o[p] && (n = !1)
}
n && (u.splice(t--, 1), e = i(i.s = r[0]))
}
return 0 === u.length && (a.forEach((function (e) {
if (void 0 === o[e]) {
o[e] = null;
var t = document.createElement("link");
i.nc && t.setAttribute("nonce", i.nc), t.rel = "prefetch", t.as = "script", t.href = c(e), document.head.appendChild(t)
}
})), a.length = 0), e
}

var n = {}, o = {7: 0}, u = [], a = [];

function c(e) {
return i.p + "static/js/" + ({
0: "xlsx",
2: "etools-result-json",
4: "piechart",
5: "pubmed-efetch-result-xml",
6: "pubmed-esearch-result-json",
8: "treemap"
}[e] || e) + "." + {
0: "bf86e419",
1: "b84888ea",
2: "dc746105",
4: "643bf128",
5: "4593d77a",
6: "ea1de744",
8: "b1dc8119",
10: "8447e4ec",
11: "a4703910",
12: "7556f536"
}[e] + ".chunk.js"
}

function i(t) {
if (n[t]) return n[t].exports;
var r = n[t] = {i: t, l: !1, exports: {}};
return e[t].call(r.exports, r, r.exports, i), r.l = !0, r.exports
}

i.e = function (e) {
var t = [], r = o[e];
if (0 !== r) if (r) t.push(r[2]); else {
var n = new Promise((function (t, n) {
r = o[e] = [t, n]
}));
t.push(r[2] = n);
var u, a = document.createElement("script");
a.charset = "utf-8", a.timeout = 120, i.nc && a.setAttribute("nonce", i.nc), a.src = c(e);
var l = new Error;
u = function (t) {
a.onerror = a.onload = null, clearTimeout(p);
var r = o[e];
if (0 !== r) {
if (r) {
var n = t && ("load" === t.type ? "missing" : t.type), u = t && t.target && t.target.src;
l.message = "Loading chunk " + e + " failed.\n(" + n + ": " + u + ")", l.name = "ChunkLoadError", l.type = n, l.request = u, r[1](l)
}
o[e] = void 0
}
};
var p = setTimeout((function () {
u({type: "timeout", target: a})
}), 12e4);
a.onerror = a.onload = u, document.head.appendChild(a)
}
return Promise.all(t)
}, i.m = e, i.c = n, i.d = function (e, t, r) {
i.o(e, t) || Object.defineProperty(e, t, {enumerable: !0, get: r})
}, i.r = function (e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(e, "__esModule", {value: !0})
}, i.t = function (e, t) {
if (1 & t && (e = i(e)), 8 & t) return e;
if (4 & t && "object" == typeof e && e && e.__esModule) return e;
var r = Object.create(null);
if (i.r(r), Object.defineProperty(r, "default", {
enumerable: !0,
value: e
}), 2 & t && "string" != typeof e) for (var n in e) i.d(r, n, function (t) {
return e[t]
}.bind(null, n));
return r
}, i.n = function (e) {
var t = e && e.__esModule ? function () {
return e.default
} : function () {
return e
};
return i.d(t, "a", t), t
}, i.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}, i.p = "./", i.oe = function (e) {
throw console.error(e), e
};
var l = this.webpackJsonpapp = this.webpackJsonpapp || [], p = l.push.bind(l);
l.push = t, l = l.slice();
for (var s = 0; s < l.length; s++) t(l[s]);
var f = p;
r()
}([])</script>
<script src="./static/js/9.a19a2fab.chunk.js"></script>
<script src="./static/js/main.4974e0c5.chunk.js"></script>
</body>
</html>
71 changes: 55 additions & 16 deletions Patent2Net/P2N-Nets-new.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def cycle (liste):
for inv in bre.IPCR7:
if ''.join(inv).strip().lower() != 'empty':
if inv.strip() not in Exclus:
tempoinv.append(inv.upper())
tempoinv.append(inv.upper().strip())
df.at [bre.Index, 'IPCR7' ] = tempoinv

if not isinstance(bre.IPCR4, list):
Expand Down Expand Up @@ -367,28 +367,28 @@ def cycle (liste):
df.at [bre.Index, 'IPCR7'] = list(set(tempoIpc7 + bre.IPCR7))
df.at [bre.Index, 'IPCR4'] = list(set(tempoIpc4 + bre.IPCR4))
df.at [bre.Index, 'IPCR3'] = list(set(tempoIpc3 + bre.IPCR3))
df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc7 + bre.IPCR1))
df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc1 + bre.IPCR1))
elif len(bre.IPCR7)>0:
for ipc in bre.IPCR7:
tempoIpc3 .append(ipc[0:3])
tempoIpc4 .append(ipc[0:4])
tempoIpc1 .append(ipc[0:1])
df.at [bre.Index, 'IPCR3'] = list(set(tempoIpc3 + bre.IPCR3))
df.at [bre.Index, 'IPCR4'] = list(set(tempoIpc4 + bre.IPCR4))
df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc7 + bre.IPCR1))
df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc1 + bre.IPCR1))
elif len(bre.IPCR4)>0:
for ipc in bre.IPCR4:
tempoIpc3 .append(ipc[0:3])
tempoIpc1 .append(ipc[0:1])

df.at [bre.Index, 'IPCR3'] = list(set(tempoIpc3 + bre.IPCR3))
df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc7 + bre.IPCR1))
df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc1 + bre.IPCR1))
elif len(bre.IPCR3)>0:
for ipc in bre.IPCR3:

tempoIpc1 .append(ipc[0:1])

df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc7 + bre.IPCR1))
df.at [bre.Index, 'IPCR1'] = list(set(tempoIpc1 + bre.IPCR1))
else:
pass
# can't do better
Expand Down Expand Up @@ -615,7 +615,7 @@ def cycle (liste):
Networks = dict()
#next lines are here to avoid the changing scheme lecture of requete.cql

Networks["_CountryCrossTech"] = [configFile.CountryCrossTechNetwork, [ 'IPCR7', "country"]] # not finished yet
Networks["_CountryCrossTech"] = [configFile.CountryCrossTechNetwork, ['IPCR7', "country"]] # not finished yet
Networks["_CrossTech"] = [configFile.CrossTechNetwork, ['label','IPCR7','IPCR1', 'IPCR4', 'IPCR11']] # GraphTechnos
Networks["_Inventors_CrossTech"] = [configFile.InventorCrossTechNetwork, ['IPCR11','IPCR7','IPCR4','IPCR1',"Inventor"]]#, 'AutFr', 'AutEtr', 'PasSurPubMed']] # GraphTechnosAuthor
Networks["_Applicants_CrossTech"] = [configFile.ApplicantCrossTechNetwork, ['IPCR11','IPCR7','IPCR4','IPCR1', "Applicant"]] #, "Public", "Private"]] # GraphTechnosAppli
Expand All @@ -637,17 +637,29 @@ def cycle (liste):
GraphTechnos = nx.DiGraph() # IPC graphs
GraphTechnosAppli = nx.DiGraph() # IPC graphs
GraphTechnosAuthor = nx.DiGraph() # IPC graphs

GraphTechnosCountry = nx.DiGraph() # IPC graphs
# TypeBre = dict()

dicoAttrsTechnoCountry = dict()

for bre in df.itertuples():


if not isinstance(bre.country, list):
bre.country = [bre.country]

for country in bre.country:
if len(country) > 0 and bool(country.strip()):
if country in dicoAttrsTechnoCountry.keys():
dicoAttrsTechnoCountry [country]['size'] +=1
else:
dicoAttrsTechnoCountry[country] =dict()
dicoAttrsTechnoCountry[country]['size']= 1
dicoAttrsTechnoCountry[country]['category'] = 'country'
GraphTechnosCountry.add_node(country)
GraphBrevets.add_node(bre .label)
# followind are added if citation or ref or equivalents exists for curent node
# GraphBrevetsReferences.add_node(bre .label)
# GraphBrevetsEquivalents.add_node(bre .label)
GraphTechnos .add_node(bre .label)

count =0
for lab in bre.CitedBy:

Expand Down Expand Up @@ -698,13 +710,19 @@ def cycle (liste):

for ipc in joliTecno:
if bool(ipc.strip()):
GraphTechnos .add_edge(bre .label,ipc)
GraphTechnos .add_edge(bre .label,ipc)
compteur=0
for ipcUp in bre.IPCR7:

if ipc.startswith (ipcUp) and bool(ipcUp.strip()):
GraphTechnos .add_edge(ipcUp, ipc)
GraphTechnosAppli .add_edge(ipcUp, ipc)
GraphTechnosAuthor .add_edge(ipcUp, ipc)
GraphTechnosAuthor .add_edge(ipcUp, ipc)
for country in bre.country:
if len(country) >0 and bool(country.strip()):
GraphTechnosCountry.add_edge(country, ipcUp)


#for ipc in bre.IPCR7:
# if bool(ipc.strip()):
for ipcUpUp in bre.IPCR4:
Expand All @@ -724,7 +742,10 @@ def cycle (liste):

if len(joliTecno) ==0 or sum([bool(ipc.strip()) for ipc in joliTecno])==0:
for ipcUp in bre.IPCR7:
GraphTechnos .add_edge(bre .label,ipcUp)
GraphTechnos .add_edge(bre .label,ipcUp)
for country in bre.country:
if len(country) > 0 and bool(country.strip()):
GraphTechnosCountry.add_edge(country, ipcUp)
# if bool(ipcUp.strip()):
# GraphTechnos .add_edge(ipcUp, ipc)
# GraphTechnosAppli .add_edge(ipcUp, ipc)
Expand Down Expand Up @@ -752,6 +773,9 @@ def cycle (liste):
GraphTechnos .add_edge(ipcUpUpUp, ipcUpUp)
GraphTechnosAppli .add_edge(ipcUpUpUp, ipcUpUp)
GraphTechnosAuthor .add_edge(ipcUpUpUp, ipcUpUp)
for country in bre.country:
if len(country) > 0 and bool(country.strip()):
GraphTechnosCountry.add_edge(country, ipcUpUp)

if len(joliTecno) ==0 and len(bre.IPCR7) == 0 and len(bre.IPCR4) == 0 or sum([bool(ipc.strip()) for ipc in bre.IPCR4] )==0:
for ipcUpUp in bre.IPCR3:
Expand All @@ -761,7 +785,9 @@ def cycle (liste):
GraphTechnos .add_edge(ipcUpUpUp, ipcUpUp)
GraphTechnosAppli .add_edge(ipcUpUpUp, ipcUpUp)
GraphTechnosAuthor .add_edge(ipcUpUpUp, ipcUpUp)

for country in bre.country:
if len(country) > 0 and bool(country.strip()):
GraphTechnosCountry.add_edge(country, ipcUpUp)

# for ipc in bre.IPCR1 + bre.IPCR4 + bre.IPCR7 + joliTecno:
# if bool(ipc.strip()):
Expand Down Expand Up @@ -976,6 +1002,8 @@ def cycle (liste):
nx.set_node_attributes(GraphTechnos, dicoAttrsTechno) # IPC graphs
nx.set_node_attributes(GraphTechnosAppli, dicoAttrsTechno)
nx.set_node_attributes(GraphTechnosAppli, dicoAttrsAppli)
nx.set_node_attributes(GraphTechnosCountry, dicoAttrsTechno)
nx.set_node_attributes(GraphTechnosCountry, dicoAttrsTechnoCountry)
nx.set_node_attributes( GraphTechnosAuthor, dicoAttrsTechno)
nx.set_node_attributes( GraphTechnosAuthor, dicoAttrsAut)
nx.set_node_attributes(GraphBrevets,dicoAttrs)
Expand Down Expand Up @@ -1025,6 +1053,8 @@ def cycle (liste):
(GraphTechnos, "_CrossTech"),
(GraphTechnosAppli, "_Applicants_CrossTech"),
(GraphTechnosAuthor, "_Inventors_CrossTech"),
(GraphTechnosCountry, "_CountryCrossTech")

# (GraphFull, "_Full")
]:
if len(G) == 0:
Expand Down Expand Up @@ -1121,7 +1151,13 @@ def cycle (liste):
Visu['color']['b']= int(127)
Visu['shape'] ="square"
G.nodes[k]['url'] =UrlPatent(k)[0]

elif G.nodes[k]['category'] == 'country':
Visu['color']['a'] = 1
Visu['color']['r']= int(0)
Visu['color']['g']= int(63)
Visu['color']['b']= int(63)
Visu['shape'] ="square"
G.nodes[k]['url'] =UrlPatent(k)[0]
elif G.nodes[k]['category'] == "equivalents":
Visu['color']['a'] = 1
Visu['color']['r']= int(127)
Expand Down Expand Up @@ -1208,7 +1244,10 @@ def cycle (liste):
# count = mixNet.index(categ)
# else:
# count = mixNet.index(G.node[k]['category'])
count = Networks [network][1].index(G.nodes[k]['category'])
if G.nodes[k]['category'] in Networks [network][1]:
count = Networks [network][1].index(G.nodes[k]['category'])
else:
count = 0
Visu['position']= {'x':(int(pos[k][0]*factx)+posx), 'y':(int(pos[k][1]*facty)+posy), 'z':0.0}
# Visu['size'] = np.log(int(G.node[k]["weight"])+1)+4#
Visu['color']['a']= count
Expand Down

0 comments on commit ab444a2

Please sign in to comment.