Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dikon
afh-gnd
Commits
3ba2107e
Commit
3ba2107e
authored
May 02, 2020
by
donatus.herre
Browse files
fridericiana updated
parent
51aa7990
Changes
1
Hide whitespace changes
Inline
Side-by-side
fridericiana
View file @
3ba2107e
...
...
@@ -12,9 +12,9 @@ from librair.parsers import Beacon
from
librair.schemas
import
json
BEACON
=
"https://dikon.gitlab.io/cph-beacon/data/gnd.txt"
HREF
=
"
data
/index1694-href.txt"
NAMES
=
"
data
/index1694-names.txt"
MAPPING
=
"data/index1694
-map
.json"
HREF
=
"
edits
/index1694-href.txt"
NAMES
=
"
edits
/index1694-names.txt"
OUT
=
"data/index1694.json"
href
=
[]
with
open
(
HREF
,
'r'
,
encoding
=
"utf-8"
)
as
f
:
...
...
@@ -26,13 +26,11 @@ with open(NAMES, 'r', encoding="utf-8") as f:
cph
=
Beacon
(
url
=
BEACON
)
mapping
=
{}
gnds
=
[]
for
i
,
target
in
enumerate
(
cph
.
targets
):
if
target
[
1
]
in
href
:
pos
=
href
.
index
(
target
[
1
])
mapping
[
cph
.
links
[
i
]]
=
{
"name"
:
names
[
pos
],
"target"
:
target
[
1
],
"wikidata"
:
target
[
0
]}
gnds
.
append
(
cph
.
links
[
i
])
json
.
writer
(
mapping
,
MAPPING
)
json
.
writer
(
gnds
,
OUT
)
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