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
eaf3a4e8
Commit
eaf3a4e8
authored
1 year ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
{{audio|en|en-au-platypus.ogg}} sans 3e param
parent
043f7c1b
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
+19
-1
19 additions, 1 deletion
parsers/en_en.py
with
19 additions
and
1 deletion
parsers/en_en.py
+
19
−
1
View file @
eaf3a4e8
...
...
@@ -2,6 +2,7 @@
from
wikstraktor
import
Wikstraktor
,
Pronunciation
,
Sense
,
SubSense
,
Definition
from
parsers.en_constants
import
string_values
import
re
debugEty
=
0
...
...
@@ -13,6 +14,19 @@ class En_en_straktor(Wikstraktor):
self
.
constants
=
string_values
self
.
site
=
self
.
pwb
.
Site
(
f
'
wiktionary:en
'
)
def
process_audio_accent
(
self
,
audio
,
file_name
=
False
):
if
file_name
:
#on traite un nom de fichier
match
=
re
.
search
(
r
'
(e|E)(n|N)-(\w\w)-(.*)\.ogg
'
,
audio
)
if
match
:
res
=
match
.
group
(
3
).
upper
()
else
:
res
=
None
else
:
res
=
re
.
sub
(
r
'
((a|A)udio ?\(?)|\)?
'
,
''
,
audio
)
if
res
==
""
:
res
=
None
return
res
def
process_pronunciation
(
self
,
proContent
):
# TODO: ne marche que pour les listes à 2 niveaux, voir water pour 3 niveaux
l
=
proContent
.
get_lists
()[
0
]
...
...
@@ -29,7 +43,11 @@ class En_en_straktor(Wikstraktor):
elif
t
.
normal_name
()
==
self
.
constants
[
'
t_ipa
'
]:
p
.
set_transcription
(
t
.
arguments
[
1
].
value
)
elif
t
.
normal_name
()
==
self
.
constants
[
'
t_snd
'
]:
p
.
add_sound
(
self
.
get_file_url
(
t
.
arguments
[
1
].
value
),
t
.
arguments
[
2
].
value
)
if
len
(
t
.
arguments
)
>
2
:
acc
=
self
.
process_audio_accent
(
t
.
arguments
[
2
].
value
)
if
acc
==
None
:
acc
=
self
.
process_audio_accent
(
t
.
arguments
[
1
].
value
,
True
)
p
.
add_sound
(
self
.
get_file_url
(
t
.
arguments
[
1
].
value
),
acc
)
if
p
.
ipa
!=
None
or
p
.
has_accents
()
or
p
.
has_sounds
():
pronunciations
.
append
(
p
)
else
:
...
...
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