Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bielefeld-CeBiTec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2024 Competition
Bielefeld-CeBiTec
Commits
74e55ab3
Commit
74e55ab3
authored
5 months ago
by
Liliana Sanfilippo
Browse files
Options
Downloads
Patches
Plain Diff
cit
parent
f16b822c
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
code/cit.py
+31
-18
31 additions, 18 deletions
code/cit.py
code/output.txt
+432
-4
432 additions, 4 deletions
code/output.txt
code/safety-bibtex.bib
+645
-0
645 additions, 0 deletions
code/safety-bibtex.bib
with
1108 additions
and
22 deletions
code/cit.py
+
31
−
18
View file @
74e55ab3
...
...
@@ -64,27 +64,29 @@ def main():
en_x
=
library
.
entries
[
x
]
print
(
"
Filling dictionary for entry
"
+
str
(
startnum
+
count
)
+
""
)
# Direkt auf die Einträge zugreifen, da es sich um ein Dictionary handelt
for
key
,
value
in
en_x
.
items
():
key_low
=
key
.
lower
()
dictio
[
key_low
]
=
value
# Überprüfung auf den Typ des Eintrags über 'ENTRYTYPE'
print
(
"
Checking Entry type of
"
+
str
(
startnum
+
count
)
+
""
)
if
en_x
[
'
ENTRYTYPE
'
]
==
"
article
"
:
articleHTML
(
dictio
,
(
startnum
+
count
),
out
)
elif
en_x
[
'
ENTRYTYPE
'
]
==
"
misc
"
:
miscHTML
(
dictio
,
(
startnum
+
count
),
out
)
elif
en_x
[
'
ENTRYTYPE
'
]
==
"
book
"
:
bookHTML
(
dictio
,
(
startnum
+
count
),
out
)
elif
en_x
[
'
ENTRYTYPE
'
]
==
"
inbook
"
:
bookHTML
(
dictio
,
(
startnum
+
count
),
out
)
count
+=
1
;
except
Exception
as
e
:
print
(
f
"
An unexpected error occurred:
{
e
}
"
)
print
(
f
"
An unexpected error occurred:
{
e
}
in line 83
"
)
except
Exception
as
e
:
print
(
f
"
An unexpected error occurred:
{
e
}
"
)
print
(
f
"
An unexpected error occurred:
{
e
}
in line 85
"
)
except
FileNotFoundError
:
print
(
f
"
Error: The file
'
{
args
.
input
}
'
was not found.
"
)
print
(
f
"
Error: The file
'
{
args
.
input
}
'
was not found.
line 87
"
)
if
len
(
problemlist
)
>
0
:
print
(
"
- - - - - - - - - - - - - - - - -
"
)
print
(
"
REMAINING ERRORS:
"
)
...
...
@@ -103,22 +105,26 @@ def articleHTML(dictio, x, out):
out
.
write
(
"
<li typeof=
\"
schema:ScolarlyArticle
\"
role=
\"
doc-biblioentry
\"
property=
\"
schema:citation
\"
id=
\"
desc-
"
+
str
(
x
)
+
"
\"
>
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:author
\"
typeof=
\"
schema:Person
\"
>
"
+
"
\n
"
)
print
(
"
Just a sec, sep
e
rating authors...
"
)
print
(
"
Just a sec, sep
a
rating authors...
"
)
authors
=
dictio
[
'
author
'
]
authors
=
authors
.
replace
(
"
and
"
,
"
|
"
)
liste
=
authors
.
split
(
"
|
"
)
for
a
in
liste
:
try
:
#print("processing " + a)
first
=
None
last
=
None
name
=
None
if
'
,
'
in
a
:
s
=
a
.
split
(
"
,
"
)
first
=
s
[
1
]
first_sh
=
first
[
0
]
last
=
s
[
0
]
name
=
last
+
"
,
"
+
first_sh
+
"
.
"
if
len
(
s
)
>
1
:
first
=
s
[
1
]
first_sh
=
first
[
0
]
last
=
s
[
0
]
name
=
last
+
"
,
"
+
first_sh
+
"
.
"
else
:
# Falls es nur einen Nachnamen gibt
last
=
s
[
0
]
name
=
last
+
"
,
"
else
:
s
=
a
.
split
()
if
len
(
s
)
==
2
:
...
...
@@ -130,17 +136,17 @@ def articleHTML(dictio, x, out):
leng
=
len
(
s
)
last
=
s
[
leng
-
1
]
first
=
''
for
n
in
s
:
if
n
!=
s
[
-
1
]:
first
=
first
+
n
[
0
]
+
'
.
'
name
=
last
+
"
,
"
+
first
for
n
in
s
[:
-
1
]:
# Alle bis auf den letzten Namen
first
+=
n
[
0
]
+
'
.
'
name
=
last
+
"
,
"
+
first
if
a
==
liste
[
-
1
]:
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
>
"
+
name
+
"
</span>
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
>
"
+
name
+
"
</span>
"
+
"
\n
"
)
else
:
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
>
"
+
name
+
"
</span>;
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
>
"
+
name
+
"
</span>;
"
+
"
\n
"
)
except
Exception
as
e
:
print
(
f
"
An unexpected error occurred:
{
e
}
see
"
+
a
)
out
.
write
(
"
\t
"
+
"
</span>
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:name
\"
>
"
+
dictio
[
'
title
'
]
+
"
. </span>
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
<i property=
\"
schema:publisher
\"
typeof=
\"
schema:Organization
\"
>
"
+
dictio
[
'
journal
'
]
+
"
</i>
"
+
"
\n
"
)
...
...
@@ -210,7 +216,14 @@ def bookHTML(dictio, x, out):
aut
=
dictio
[
'
author
'
]
out
.
write
(
"
\t
"
+
"
\t
"
+
"
<span property=
\"
schema:Name
\"
>
"
+
aut
+
"
</span>.
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
</span>
"
+
"
\n
"
)
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:name
\"
>
"
+
dictio
[
'
title
'
]
+
"
.</span>
"
+
"
\n
"
)
if
'
title
'
in
dictio
:
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:name
\"
>
"
+
dictio
[
'
title
'
]
+
"
.</span>
"
+
"
\n
"
)
elif
'
booktitle
'
in
dictio
:
out
.
write
(
"
\t
"
+
"
<span property=
\"
schema:name
\"
>
"
+
dictio
[
'
booktitle
'
]
+
"
.</span>
"
+
"
\n
"
)
else
:
print
(
f
"
No title or booktitle found for entry
{
x
}
"
)
problemlist
.
append
(
f
"
Check for missing title or booktitle at entry
{
x
}
"
)
out
.
write
(
"
\t
"
+
"
<i property=
\"
schema:publisher
\"
typeof=
\"
schema:Organization
\"
>
"
+
dictio
[
'
publisher
'
]
+
"
</i>
"
+
"
\n
"
)
year
=
dictio
[
'
year
'
]
out
.
write
(
"
\t
"
+
"
(<time property=
\"
schema:datePublished
\"
datatype=
\"
xsd:gYear
\"
dateTime=
\"
"
+
year
+
"
\"
>
"
+
year
+
"
</time>).
"
+
"
\n
"
)
...
...
This diff is collapsed.
Click to expand it.
code/output.txt
+
432
−
4
View file @
74e55ab3
This diff is collapsed.
Click to expand it.
code/safety-bibtex.bib
0 → 100644
+
645
−
0
View file @
74e55ab3
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment