Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wikstraktor
Manage
Activity
Members
Labels
Plan
Issues
3
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
wikstraktor
Commits
bd4c7d91
Commit
bd4c7d91
authored
2 years ago
by
Enzo Simonnet
Browse files
Options
Downloads
Patches
Plain Diff
def + exemples OK
exemples pas imbriqués comme il faut N° des defs pas bon
parent
1f3789ad
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
parsers/en_en.py
+33
-25
33 additions, 25 deletions
parsers/en_en.py
with
33 additions
and
25 deletions
parsers/en_en.py
+
33
−
25
View file @
bd4c7d91
...
@@ -44,34 +44,42 @@ class En_en_straktor(Wikstraktor):
...
@@ -44,34 +44,42 @@ class En_en_straktor(Wikstraktor):
def
process_senses
(
self
,
entry
,
pos
,
sensesContent
):
def
process_senses
(
self
,
entry
,
pos
,
sensesContent
):
baseId
=
f
"
{
entry
}
_
{
pos
}
_
"
baseId
=
f
"
{
entry
}
_
{
pos
}
_
"
#here we don't look at
l
=
sensesContent
.
get_lists
((
'
\\
#
'
,
'
\\
#:
'
,
'
\\
##
'
,
'
\\
##:
'
))
l
=
sensesContent
.
get_lists
()[
0
]
i
=
0
i
=
0
senses
=
[]
senses
=
[]
while
i
<
len
(
l
.
fullitems
):
while
i
<
len
(
l
):
newSense
=
Sense
(
f
"
{
baseId
}{
i
}
"
)
if
l
[
i
].
pattern
==
'
\\
#
'
:
li
=
self
.
wtp
.
parse
(
l
.
fullitems
[
i
])
newSense
=
Sense
(
f
"
{
baseId
}{
i
}
"
)
j
=
0
if
len
(
l
[
i
].
templates
)
>
0
:
while
j
<
len
(
li
.
templates
)
and
li
.
templates
[
j
].
normal_name
()
!=
self
.
constants
[
'
t_deflabel
'
]:
newSense
.
set_domain
(
l
[
i
].
templates
[
-
1
].
arguments
[
-
1
].
value
)
#We could use the second parameter for a comment
j
+=
1
newSense
.
add_def
(
self
.
wiki_language
,
self
.
wtp
.
parse
(
l
[
i
].
items
[
0
]).
plain_text
().
strip
())
if
j
<
len
(
li
.
templates
):
elif
l
[
i
].
pattern
==
'
\\
#:
'
:
newSense
.
set_domain
(
li
.
templates
[
j
].
arguments
[
-
1
].
value
)
#We could use the second parameter for a comment
for
j
in
l
[
i
].
items
:
newSense
.
add_def
(
self
.
wiki_language
,
self
.
wtp
.
parse
(
li
.
get_lists
()[
0
].
items
[
0
]).
plain_text
().
strip
())
if
len
(
self
.
wtp
.
parse
(
j
).
templates
)
>
0
:
while
j
<
len
(
li
.
templates
)
-
1
and
li
.
templates
[
j
+
1
].
normal_name
()
==
self
.
constants
[
'
t_ex
'
]:
newSense
.
add_example
(
self
.
wtp
.
parse
(
j
).
templates
[
0
].
arguments
[
-
1
].
value
)
newSense
.
add_example
(
li
.
templates
[
j
+
1
].
arguments
[
1
].
value
)
else
:
j
+=
1
newSense
.
add_example
(
self
.
wtp
.
parse
(
j
).
plain_text
().
strip
())
if
i
==
len
(
l
)
-
1
or
l
[
i
+
1
].
pattern
==
'
\\
#
'
or
l
[
i
+
1
].
pattern
==
'
\\
##
'
:
senses
.
append
(
newSense
)
senses
.
append
(
newSense
)
if
len
(
li
.
get_lists
(
pattern
=
'
##
'
))
>
0
:
cnt
=
0
for
cnt
,
k
in
enumerate
(
li
.
get_lists
(
pattern
=
'
##
'
)[
0
].
items
):
while
l
[
i
].
level
==
3
and
i
<
len
(
l
)
:
if
self
.
wtp
.
parse
(
k
).
templates
[
0
].
normal_name
()
==
self
.
constants
[
'
t_deflabel
'
]:
cnt
+=
1
newSense2
=
Sense
(
f
"
{
baseId
}{
i
}{
cnt
}
"
)
if
l
[
i
].
pattern
==
'
\\
##
'
:
newSense2
.
set_domain
(
self
.
wtp
.
parse
(
k
).
templates
[
0
].
arguments
[
-
1
].
value
)
#We could use the second parameter for a comment
newSense2
=
Sense
(
f
"
{
baseId
}{
i
}{
cnt
}
"
)
newSense2
.
add_def
(
self
.
wiki_language
,
self
.
wtp
.
parse
(
k
).
plain_text
().
strip
())
if
len
(
l
[
i
].
templates
)
>
0
:
for
a
in
self
.
wtp
.
parse
(
li
.
get_lists
(
pattern
=
'
##
'
)[
0
].
fullitems
[
cnt
]).
templates
:
newSense2
.
set_domain
(
l
[
i
].
templates
[
-
1
].
arguments
[
-
1
].
value
)
#We could use the second parameter for a comment
if
a
.
normal_name
()
==
self
.
constants
[
'
t_ex
'
]:
newSense2
.
add_def
(
self
.
wiki_language
,
self
.
wtp
.
parse
(
l
[
i
].
items
[
0
]).
plain_text
().
strip
())
newSense2
.
add_example
(
a
.
arguments
[
-
1
].
value
)
elif
l
[
i
].
pattern
==
'
\\
##:
'
:
senses
.
append
(
newSense2
)
for
j
in
l
[
i
].
items
:
# TODO: process examples
if
len
(
self
.
wtp
.
parse
(
j
).
templates
)
>
0
:
newSense2
.
add_example
(
self
.
wtp
.
parse
(
j
).
templates
[
0
].
arguments
[
-
1
].
value
)
else
:
newSense2
.
add_example
(
self
.
wtp
.
parse
(
j
).
plain_text
().
strip
())
if
i
==
len
(
l
)
-
1
or
l
[
i
+
1
].
pattern
==
'
\\
#
'
or
l
[
i
+
1
].
pattern
==
'
\\
##
'
:
senses
.
append
(
newSense2
)
i
+=
1
if
cnt
>
0
:
i
-=
1
i
+=
1
i
+=
1
return
senses
return
senses
...
...
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