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
fadb0b13
Commit
fadb0b13
authored
5 years ago
by
Luis Salamanca
Browse files
Options
Downloads
Patches
Plain Diff
Notebooks with basic for metadat usage
parent
5b70b3ab
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
notebooks/BasicMetadata_Class.ipynb
+135
-0
135 additions, 0 deletions
notebooks/BasicMetadata_Class.ipynb
with
135 additions
and
0 deletions
notebooks/BasicMetadata_Class.ipynb
0 → 100644
+
135
−
0
View file @
fadb0b13
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"\n",
"import os, sys\n",
"\n",
"sys.path.append('../src/python/')\n",
"\n",
"import def_classes as defc\n",
"import numpy as np\n",
"from pdf2image import convert_from_path, convert_from_bytes\n",
"import utils_proc\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"year = 1978\n",
"folder_database = '../data/AB/'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## List the files inside the tar"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1011\n"
]
},
{
"data": {
"text/plain": [
"array([['./1978/20006356.pdf', '20006356'],\n",
" ['./1978/20006357.pdf', '20006357'],\n",
" ['./1978/20006358.pdf', '20006358'],\n",
" ...,\n",
" ['./1978/20007364.pdf', '20007364'],\n",
" ['./1978/20007365.pdf', '20007365'],\n",
" ['./1978/20007366.pdf', '20007366']], dtype='<U19')"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"name_tar = '00_rawpdfs'\n",
"list_docs = utils_proc.get_list(year, folder_database, name_tar)\n",
"print(len(list_docs[0]))\n",
"np.transpose(list_docs)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# From the ones above\n",
"iddoc = '20026449'\n",
"input_file = './' + str(year) +'/' + iddoc +'.pdf'"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"d1 = defc.Document(input_file, folder_database)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"d1."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:code id: tags:
```
python
%
load_ext
autoreload
%
autoreload
2
import
os
,
sys
sys
.
path
.
append
(
'
../src/python/
'
)
import
def_classes
as
defc
import
numpy
as
np
from
pdf2image
import
convert_from_path
,
convert_from_bytes
import
utils_proc
```
%% Output
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
%% Cell type:code id: tags:
```
python
year
=
1978
folder_database
=
'
../data/AB/
'
```
%% Cell type:markdown id: tags:
## List the files inside the tar
%% Cell type:code id: tags:
```
python
name_tar
=
'
00_rawpdfs
'
list_docs
=
utils_proc
.
get_list
(
year
,
folder_database
,
name_tar
)
print
(
len
(
list_docs
[
0
]))
np
.
transpose
(
list_docs
)
```
%% Output
1011
array([['./1978/20006356.pdf', '20006356'],
['./1978/20006357.pdf', '20006357'],
['./1978/20006358.pdf', '20006358'],
...,
['./1978/20007364.pdf', '20007364'],
['./1978/20007365.pdf', '20007365'],
['./1978/20007366.pdf', '20007366']], dtype='<U19')
%% Cell type:code id: tags:
```
python
# From the ones above
iddoc
=
'
20026449
'
input_file
=
'
./
'
+
str
(
year
)
+
'
/
'
+
iddoc
+
'
.pdf
'
```
%% Cell type:code id: tags:
```
python
d1
=
defc
.
Document
(
input_file
,
folder_database
)
```
%% Cell type:code id: tags:
```
python
d1
.
```
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