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
1069396e
Commit
1069396e
authored
1 year ago
by
Empiriker
Browse files
Options
Downloads
Patches
Plain Diff
Properly initialize Wtp object for non-english editions
parent
0b130bd5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/load_templates.py
+2
-1
2 additions, 1 deletion
src/load_templates.py
src/wiktextract_context.py
+4
-2
4 additions, 2 deletions
src/wiktextract_context.py
with
6 additions
and
3 deletions
src/load_templates.py
+
2
−
1
View file @
1069396e
...
@@ -64,7 +64,7 @@ def load_templates(wiktlang: str):
...
@@ -64,7 +64,7 @@ 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
)
wxr
=
get_wiktextract_context
(
wiktlang
,
mock_get_page
=
False
)
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
()
...
@@ -81,6 +81,7 @@ def load_templates(wiktlang: str):
...
@@ -81,6 +81,7 @@ def load_templates(wiktlang: str):
out_f
=
None
,
# type: ignore
out_f
=
None
,
# type: ignore
)
)
wxr
.
wtp
.
db_conn
.
commit
()
wxr
.
wtp
.
db_conn
.
commit
()
wxr
.
wtp
.
close_db_conn
()
stop_progress_indicator
(
indicator_thread
,
is_done
)
stop_progress_indicator
(
indicator_thread
,
is_done
)
...
...
This diff is collapsed.
Click to expand it.
src/wiktextract_context.py
+
4
−
2
View file @
1069396e
...
@@ -31,7 +31,7 @@ class CustomWtp(Wtp):
...
@@ -31,7 +31,7 @@ class CustomWtp(Wtp):
return
original_result
return
original_result
def
get_wiktextract_context
(
wiktlang
:
str
,
wordlang
:
Optional
[
str
]
=
None
):
def
get_wiktextract_context
(
wiktlang
:
str
,
wordlang
:
Optional
[
str
]
=
None
,
mock_get_page
:
bool
=
True
):
db_path
=
f
"
./sqlite-
{
wiktlang
}
.db
"
db_path
=
f
"
./sqlite-
{
wiktlang
}
.db
"
config
=
WiktionaryConfig
(
config
=
WiktionaryConfig
(
dump_file_lang_code
=
wiktlang
,
dump_file_lang_code
=
wiktlang
,
...
@@ -46,6 +46,8 @@ def get_wiktextract_context(wiktlang: str, wordlang: Optional[str] = None):
...
@@ -46,6 +46,8 @@ def get_wiktextract_context(wiktlang: str, wordlang: Optional[str] = None):
capture_descendants
=
True
,
capture_descendants
=
True
,
capture_inflections
=
True
,
capture_inflections
=
True
,
)
)
wxr
=
WiktextractContext
(
CustomWtp
(
db_path
=
db_path
),
config
)
config
.
load_edition_settings
()
wtp
=
CustomWtp
(
db_path
=
db_path
,
lang_code
=
wiktlang
)
if
mock_get_page
else
Wtp
(
db_path
=
db_path
,
lang_code
=
wiktlang
)
wxr
=
WiktextractContext
(
wtp
,
config
)
return
wxr
return
wxr
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