Skip to content

Commit

Permalink
merge resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
rfabila committed Nov 29, 2017
2 parents 35cc246 + aeaae1d commit b540e11
Show file tree
Hide file tree
Showing 7 changed files with 1,193 additions and 1,167 deletions.
25 changes: 14 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Pyscholar
|pyversion| |license|
---------------------

A library to create collaboration science networks.
A library to create science collaboration networks.

Requirements
-------------
------------

- `Python <https://www.python.org/download/releases/2.7/>`_ ≥ 2.7
- `Networkx <http://networkx.github.io/documentation/networkx-1.7/install.html>`_
Expand All @@ -33,12 +33,12 @@ Then you must run setup.py and enter your API KEY
.. code-block:: sh
$ python setup.py
$ Your scopus api key:(Here you enter your API Key)
$ Your Scopus API key:(Enter here your API Key)
Basic Usage
---------------
-----------

First navigate to the instalation directory:
First navigate to the installation directory:

.. code:: sh
Expand All @@ -54,16 +54,19 @@ Then execute python
Type "help", "copyright", "credits" or "license" for more information.
>>>
And import the pyscholar package
And import the Pyscholar package in the REPL

.. code:: python
>>> import pyscholar
And now you can do some searching.

For example, the following function performs a search by author. It
receives the first and last name, and returns a list of IDs associated
Examples
--------

The following function performs a search by author.
It receives the first and last name, and returns a list of IDs associated
with the author.

.. code:: python
Expand All @@ -72,11 +75,11 @@ with the author.
>>> [u'56013555800', u'16635924700']
License
-----------
-------

This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the
This project is licensed under the GNU General Public License v2.0 - see the
`LICENSE <https://github.com/rfabila/Pyscholar/blob/master/LICENSE>`__
file for details
file for details.

.. |pyversion| image:: https://img.shields.io/badge/python-2.7-brightgreen.svg
.. |license| image:: https://img.shields.io/badge/license-GNU-blue.svg
101 changes: 50 additions & 51 deletions pyscholar/clean.py
Original file line number Diff line number Diff line change
@@ -1,80 +1,79 @@
#import pyscholar


def homonyms(G):
D={}
D = {}
for i in G.author_info:
s=""
if G.author_info[i]['name']==None:
s+="None"
s = ""

if G.author_info[i]['name'] == None:
s += "None"
else:
s+=G.author_info[i]['name']
if G.author_info[i]['surname']==None:
s+="None"
s += G.author_info[i]['name']

if G.author_info[i]['surname'] == None:
s += "None"
else:
s+=" "+G.author_info[i]['surname']
s += " "+G.author_info[i]['surname']

if s not in D:
D[s]=set()
D[s] = set()

D[s].add(i)
K=D.keys()

K = D.keys()
for k in K:
if len(D[k])<=1:
if len(D[k]) <= 1:
D.pop(k)
i=0

i = 0
for k in D:
i+=1
i += 1
print str(i)+".- "+k
print D[k]

return D


def same_info(G):
D={}
D = {}
for i in G.author_info:
s=""
if G.author_info[i]['name']==None:
s+="None"
s = ""

if G.author_info[i]['name'] == None:
s += "None"
else:
s+=G.author_info[i]['name']
if G.author_info[i]['surname']==None:
s+=" None\n"
s += G.author_info[i]['name']

if G.author_info[i]['surname'] == None:
s += " None\n"
else:
s+=" "+G.author_info[i]['surname']+"\n"
if G.author_info[i]['affiliation-id']==None:
s+=" None\n"
s += " "+G.author_info[i]['surname']+"\n"

if G.author_info[i]['affiliation-id'] == None:
s += " None\n"
else:
s+=" "+G.author_info[i]['affiliation-id']+". \n"
if G.author_info[i]['country']==None:
s+="None"
s += " "+G.author_info[i]['affiliation-id']+". \n"

if G.author_info[i]['country'] == None:
s += "None"
else:
s+=" "+G.author_info[i]['country']
s += " "+G.author_info[i]['country']

if s not in D:
D[s]=set()
D[s] = set()

D[s].add(i)
K=D.keys()

K = D.keys()
for k in K:
if len(D[k])<=1:
if len(D[k]) <= 1:
D.pop(k)
i=0

i = 0
for k in D:
i+=1
i += 1
print str(i)+".- "+k
print D[k]



return D


17 changes: 9 additions & 8 deletions pyscholar/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
def get_node_dict_layout_from_graphml_file(filename):
"""Reads the given graphml file an extracts the nodes attributes. The idea is that the graphml was
probably modified in gephi."""
D={}
D = {}
tree = ET.parse(filename)
root=tree.getroot()
root = tree.getroot()
for v in root.iter("{http://graphml.graphdrawing.org/xmlns}node"):
name=v.attrib['id']
name = v.attrib['id']
#print name
d={}
d = {}
for ch in v:
d[ch.attrib['key']]=ch.text
D[name]=d
d[ch.attrib['key']] = ch.text
D[name] = d
return D

def apply_layout(H,D):

def apply_layout(H, D):
for v in H.nodes():
if v in D:
for key in D[v]:
H.node[v][key]=D[v][key]
H.node[v][key] = D[v][key]
Loading

0 comments on commit b540e11

Please sign in to comment.