Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
1b813be6
Commit
1b813be6
authored
9 years ago
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] IsTex parser ok.
parent
2fa892a8
master
2.0.0_Red_Lemon
EuropressOld
anoe-gargantext-light
c24b-stable
c24b-stable-patch
c24b-testing-
dev
dev-graphExplorerJSON
gargantext-light
install
patch-1
patch-2
prod
prod-dev
remote
sankey
sankey-inegalites
simon-auth
simon-big-clean-up
simon-data-import
simon-dev
simon-experimental
simon-experimental-share
simon-gargantext-light
simon-pipenv
simon-rest-doc
simon-tasks
simon-testing
simon-unstable
simon-unstable-lists-fix
simon-unstable-refact-models
simon-wip
stable
stable-help
stable-imt
stable-imt-hal
stable-imt-link
stable-imt-merge
stable-imt-notebook
stable-notebook
stable-origin
stable-patch
stable-v3-imt
testing
testing-distri
testing-graph-growth
testing-graph-public
testing-imt
testing-jwt
testing-langParsing
testing-merge
testing-mine
testing-notebook
testing-share
unstable
unstable-docker
unstable-newBdd
unstable-notebook
unstable-philoNotebook
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
ISTex.py
parsing/FileParsers/ISTex.py
+14
-14
No files found.
parsing/FileParsers/ISTex.py
View file @
1b813be6
...
...
@@ -7,7 +7,7 @@ from io import BytesIO
import
json
class
ISTex
(
FileParser
):
def
_parse
(
self
,
thefile
):
json_data
=
open
(
thefile
,
"r"
)
data
=
json
.
load
(
json_data
)
...
...
@@ -22,14 +22,14 @@ class ISTex(FileParser):
"language_iso3"
:
'language'
,
"doi"
:
'doi'
,
"host"
:
'host'
,
"publication_date"
:
'pub
d
ate'
,
"publication_date"
:
'pub
licationD
ate'
,
# "authors" : 'author',
"authorsRAW"
:
'author'
,
"keywords"
:
"keywords"
}
suma
=
0
for
json_doc
in
json_docs
:
hyperdata
=
{}
...
...
@@ -42,9 +42,9 @@ class ISTex(FileParser):
# print("|",hyperdata["language_iso3"])
if
"doi"
in
hyperdata
:
if
"doi"
in
hyperdata
:
hyperdata
[
"doi"
]
=
hyperdata
[
"doi"
][
0
]
keywords
=
[]
if
"keywords"
in
hyperdata
:
for
keyw
in
hyperdata
[
"keywords"
]:
...
...
@@ -72,7 +72,7 @@ class ISTex(FileParser):
authors
=
False
if
"authorsRAW"
in
hyperdata
:
names
=
[]
for
author
in
hyperdata
[
"authorsRAW"
]:
for
author
in
hyperdata
[
"authorsRAW"
]:
names
.
append
(
author
[
"name"
])
hyperdata
[
"authors"
]
=
", "
.
join
(
names
)
...
...
@@ -88,7 +88,7 @@ class ISTex(FileParser):
if
"publication_date"
in
hyperdata
:
RealDate
=
hyperdata
[
"publication_date"
]
if
"publication_date"
in
hyperdata
:
if
"publication_date"
in
hyperdata
:
hyperdata
.
pop
(
"publication_date"
)
if
isinstance
(
RealDate
,
list
):
...
...
@@ -99,18 +99,18 @@ class ISTex(FileParser):
if
len
(
RealDate
)
>
4
:
if
len
(
RealDate
)
>
8
:
try
:
Decision
=
datetime
.
strptime
(
RealDate
,
'
%
Y-
%
b-
%
d'
)
.
date
()
except
:
except
:
try
:
Decision
=
datetime
.
strptime
(
RealDate
,
'
%
Y-
%
m-
%
d'
)
.
date
()
except
:
Decision
=
False
else
:
else
:
try
:
Decision
=
datetime
.
strptime
(
RealDate
,
'
%
Y-
%
b'
)
.
date
()
except
:
except
:
try
:
Decision
=
datetime
.
strptime
(
RealDate
,
'
%
Y-
%
m'
)
.
date
()
except
:
Decision
=
False
else
:
else
:
try
:
Decision
=
datetime
.
strptime
(
RealDate
,
'
%
Y'
)
.
date
()
except
:
Decision
=
False
if
Decision
!=
False
:
hyperdata
[
"publication_year"
]
=
str
(
Decision
.
year
)
hyperdata
[
"publication_month"
]
=
str
(
Decision
.
month
)
...
...
@@ -119,11 +119,11 @@ class ISTex(FileParser):
# print("\t||",hyperdata["title"])
# print("\t\t",Decision)
# print("=============================")
# else:
# else:
# suma+=1
# if "pubdate" in json_doc:
# print ("\tfail pubdate:",json_doc["pubdate"])
# print ("nb_hits:",len(json_docs))
# print("\t - nb_fails:",suma)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment