Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PLWN_API
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Libraries
PLWN_API
Commits
d69f7a7c
Commit
d69f7a7c
authored
1 year ago
by
lukaszszpak
Browse files
Options
Downloads
Patches
Plain Diff
feat: change default model to nc
parent
292885ab
Branches
Branches containing commit
4 merge requests
!10
Revert "test if load_default will download dump"
,
!9
Merge request
,
!8
Revert "test if load_default will download dump"
,
!7
Revert "test if load_default will download dump"
Pipeline
#15153
failed with stages
in 25 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plwn/config.ini
+1
-1
1 addition, 1 deletion
plwn/config.ini
plwn/download.py
+6
-38
6 additions, 38 deletions
plwn/download.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
with
8 additions
and
40 deletions
plwn/config.ini
+
1
−
1
View file @
d69f7a7c
[DOWNLOAD]
default_model
=
https://
minio
.clarin
-pl.eu/public/models/plwn_api_dumps/plwn_dump_new_07-12-2022.sqlite
default_model
=
https://
nc
.clarin
.e-science.pl/index.php/s/3p3exndFdqpnRGM
This diff is collapsed.
Click to expand it.
plwn/download.py
+
6
−
38
View file @
d69f7a7c
...
...
@@ -7,48 +7,16 @@ import requests
from
six.moves.urllib.request
import
urlopen
from
six.moves
import
configparser
config
=
configparser
.
ConfigParser
()
config_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"
config.ini
"
)
config
.
read
(
config_path
)
def
get_available_models
():
"""
Returns available models.
"""
root
=
ET
.
parse
(
urlopen
(
"
https://minio.clarin-pl.eu/public
"
)).
getroot
()
available_models
=
[]
for
child
in
root
.
findall
(
"
{http://s3.amazonaws.com/doc/2006-03-01/}Contents
"
):
if
"
models/plwn_api_dumps/
"
in
str
(
child
.
find
(
"
{http://s3.amazonaws.com/doc/2006-03-01/}Key
"
).
text
):
string
=
child
.
find
(
"
{http://s3.amazonaws.com/doc/2006-03-01/}Key
"
).
text
substring
=
r
"
models/plwn_api_dumps/
"
available_models
.
append
(
re
.
sub
(
substring
,
r
''
,
string
))
return
available_models
def
download
(
name
=
"
default_model
"
):
"""
After called it downloads a specified database model.
"""
models
=
get_available_models
()
if
name
==
"
default_model
"
:
url
=
config
[
"
DOWNLOAD
"
][
name
]
r
=
requests
.
get
(
url
)
with
open
(
name
,
"
wb
"
)
as
f
:
f
.
write
(
r
.
content
)
f
.
close
()
return
if
name
in
models
:
url
=
config
[
"
DOWNLOAD
"
][
"
default_model
"
]
url
=
url
.
replace
(
"
plwn_dump_new_07-12-2022.sqlite
"
,
name
)
r
=
requests
.
get
(
url
)
with
open
(
name
,
"
wb
"
)
as
f
:
f
.
write
(
r
.
content
)
f
.
close
()
else
:
print
(
"
Cannot download:
"
,
name
,
"
\n
Possible download options:
"
,
models
)
url
=
config
[
"
DOWNLOAD
"
]
r
=
requests
.
get
(
url
)
with
open
(
name
,
"
wb
"
)
as
f
:
f
.
write
(
r
.
content
)
f
.
close
()
return
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
d69f7a7c
...
...
@@ -9,7 +9,7 @@ ENVNAME_DIST_NODEFAULT = 'PLWN_API_DIST_NO_DEFAULT_STORAGE'
setup_args
=
dict
(
name
=
'
plwn_api_uuid
'
,
version
=
'
0.1
'
,
version
=
'
0.1
1
'
,
license
=
'
LGPL-3.0+
'
,
description
=
'
Python API to access plWordNet lexicon
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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