Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
democrasci_preprocWP1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Luis Salamanca
democrasci_preprocWP1
Commits
6387e137
Commit
6387e137
authored
6 years ago
by
Luis Salamanca
Browse files
Options
Downloads
Patches
Plain Diff
More errors when parsing from corrected XML
parent
8d260488
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#1727
passed
6 years ago
Stage: build
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
notebooks/RunningClasses.ipynb
+289
-237
289 additions, 237 deletions
notebooks/RunningClasses.ipynb
src/python/def_classes.py
+12
-6
12 additions, 6 deletions
src/python/def_classes.py
with
301 additions
and
243 deletions
notebooks/RunningClasses.ipynb
+
289
−
237
View file @
6387e137
This diff is collapsed.
Click to expand it.
src/python/def_classes.py
+
12
−
6
View file @
6387e137
...
...
@@ -402,7 +402,7 @@ class Document:
if
'
imgobj
'
not
in
self
.
__dict__
.
keys
():
self
.
pdf2imgobj
()
if
'
XML_main
'
not
in
self
.
__dict__
.
keys
():
if
'
XML_main
_corr
'
not
in
self
.
__dict__
.
keys
():
name_tar
=
self
.
folder_database
+
'
/
'
+
str
(
self
.
year
)
+
'
/
'
+
name_outcorrxml
+
'
.tar.gz
'
if
os
.
path
.
isfile
(
name_tar
):
name_xml
=
'
./
'
+
str
(
self
.
year
)
+
'
/
'
+
str
(
self
.
id_doc
)
+
suffix_xml
+
'
corr.xml
'
...
...
@@ -411,11 +411,17 @@ class Document:
#print('Run this')
h_xml
=
utils_proc
.
get_handlerfile
(
name_xml
,
self
.
folder_database
,
name_outcorrxml
)
XML_tree
=
ET
.
parse
(
h_xml
)
self
.
XML_main
=
XML_tree
.
getroot
()
self
.
XML_main
_corr
=
XML_tree
.
getroot
()
else
:
self
.
pdf2xml
(
pages
=
'
all
'
,
suffix_xml
=
suffix_xml
,
flag_save
=
0
)
print
(
'
You need to have the tar file to use flag_compute = 0!
'
)
flag_error
=
1
return
0
,
0
,
0
,
0
,
0
,
0
,
flag_error
#self.pdf2xml(pages = 'all', suffix_xml = suffix_xml, flag_save = 0)
else
:
self
.
pdf2xml
(
pages
=
'
all
'
,
suffix_xml
=
suffix_xml
,
flag_save
=
0
)
print
(
'
You need to have the tar file to use flag_compute = 0!
'
)
flag_error
=
1
return
0
,
0
,
0
,
0
,
0
,
0
,
flag_error
#self.pdf2xml(pages = 'all', suffix_xml = suffix_xml, flag_save = 0)
ind_abs
=
np
.
array
([
ind_page
]).
astype
(
int
).
reshape
((
-
1
,))
else
:
#print('Run this')
...
...
@@ -425,12 +431,12 @@ class Document:
#print(ind_abs, type(ind_abs))
#print(self.XML_main, len(self.imgobj))
if
ind_page
>
(
len
(
self
.
XML_main
)
-
1
):
if
ind_page
>
(
len
(
self
.
XML_main
_corr
)
-
1
):
flag_error
=
1
return
0
,
0
,
0
,
0
,
0
,
0
,
flag_error
XML_root
=
ET
.
Element
(
'
pages
'
)
XML_root
.
append
(
self
.
XML_main
[
ind_abs
[
0
]])
XML_root
.
append
(
self
.
XML_main
_corr
[
ind_abs
[
0
]])
imarray
=
np
.
array
(
self
.
imgobj
[
ind_page
])
bbox_page
=
np
.
array
(
XML_root
[
0
].
attrib
[
'
bbox
'
].
split
(
'
,
'
)).
astype
(
np
.
float64
)
...
...
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