Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
EWOK
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Lex gaMe
EWOK
Commits
a6d161ab
Commit
a6d161ab
authored
1 year ago
by
Empiriker
Browse files
Options
Downloads
Patches
Plain Diff
Load whole dumps instead of only templates
parent
31b3a443
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/load_dumps.py
+20
-9
20 additions, 9 deletions
src/load_dumps.py
with
20 additions
and
9 deletions
src/load_
template
s.py
→
src/load_
dump
s.py
+
20
−
9
View file @
a6d161ab
from
wiktextract.wiktionary
import
parse_wiktionary
from
wiktextract_context
import
get_wiktextract_context
import
os
import
os
import
re
import
re
import
threading
import
threading
import
time
import
time
from
typing
import
List
from
typing
import
List
from
wiktextract.wiktionary
import
parse_wiktionary
from
wiktextract_context
import
get_wiktextract_context
DUMPS_DIR
=
"
dumps
"
DUMPS_DIR
=
"
dumps
"
RECOGNIZED_NAMESPACE_NAMES
=
[
"
Main
"
,
"
Category
"
,
"
Appendix
"
,
"
Project
"
,
"
Thesaurus
"
,
"
Module
"
,
"
Template
"
,
"
Reconstruction
"
,
]
def
start_progress_indicator
(
is_done
:
List
[
bool
],
msg
:
str
=
""
):
def
start_progress_indicator
(
is_done
:
List
[
bool
],
msg
:
str
=
""
):
is_done
[
0
]
=
False
is_done
[
0
]
=
False
...
@@ -64,20 +74,21 @@ def load_templates(wiktlang: str):
...
@@ -64,20 +74,21 @@ def load_templates(wiktlang: str):
is_done
,
msg
=
f
"
Loading templates for
{
wiktlang
}
...
"
is_done
,
msg
=
f
"
Loading templates for
{
wiktlang
}
...
"
)
)
wxr
=
get_wiktextract_context
(
wiktlang
,
mock_get_page
=
False
)
wxr
=
get_wiktextract_context
(
wiktlang
)
wxr
.
wtp
.
db_conn
.
execute
(
"
DELETE FROM pages
"
)
wxr
.
wtp
.
db_conn
.
execute
(
"
DELETE FROM pages
"
)
wxr
.
wtp
.
db_conn
.
commit
()
wxr
.
wtp
.
db_conn
.
commit
()
namespace_ids
=
{
wxr
.
wtp
.
NAMESPACE_DATA
.
get
(
name
,
{}).
get
(
"
id
"
)
for
name
in
RECOGNIZED_NAMESPACE_NAMES
}
parse_wiktionary
(
parse_wiktionary
(
wxr
,
wxr
,
dump_file
,
dump_file
,
num_processes
=
1
,
num_processes
=
1
,
phase1_only
=
True
,
phase1_only
=
True
,
namespace_ids
=
{
namespace_ids
=
namespace_ids
,
10
,
828
,
},
# Template and Module namespaces; ToDo: Get the namespace IDs from the dump file
out_f
=
None
,
# type: ignore
out_f
=
None
,
# type: ignore
)
)
wxr
.
wtp
.
db_conn
.
commit
()
wxr
.
wtp
.
db_conn
.
commit
()
...
...
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