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
dc24ceae
Commit
dc24ceae
authored
2 years ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
accentS in wk_en
parent
f391b7f3
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
parsers/en_en.py
+7
-5
7 additions, 5 deletions
parsers/en_en.py
wikstraktor.py
+8
-5
8 additions, 5 deletions
wikstraktor.py
with
15 additions
and
10 deletions
parsers/en_en.py
+
7
−
5
View file @
dc24ceae
...
@@ -21,17 +21,19 @@ class En_en_straktor(Wikstraktor):
...
@@ -21,17 +21,19 @@ class En_en_straktor(Wikstraktor):
while
i
<
len
(
l
.
fullitems
):
while
i
<
len
(
l
.
fullitems
):
p
=
Pronunciation
()
p
=
Pronunciation
()
templates
=
self
.
wtp
.
parse
(
l
.
fullitems
[
i
]).
templates
templates
=
self
.
wtp
.
parse
(
l
.
fullitems
[
i
]).
templates
a
=
None
a
cc
=
None
for
j
,
t
in
enumerate
(
templates
):
for
j
,
t
in
enumerate
(
templates
):
if
(
t
.
normal_name
()
==
self
.
constants
[
'
t_acc
'
]
and
templates
[
j
+
1
].
normal_name
()
!=
self
.
constants
[
'
t_acc
'
]):
if
(
t
.
normal_name
()
==
self
.
constants
[
'
t_acc
'
]
and
templates
[
j
+
1
].
normal_name
()
!=
self
.
constants
[
'
t_acc
'
]):
a
=
t
.
arguments
[
0
].
value
a
cc
=
t
.
arguments
elif
t
.
normal_name
()
==
self
.
constants
[
'
t_ipa
'
]:
elif
t
.
normal_name
()
==
self
.
constants
[
'
t_ipa
'
]:
p
.
set_transcription
(
t
.
arguments
[
1
].
value
)
p
.
set_transcription
(
t
.
arguments
[
1
].
value
)
p
.
set_accent
(
a
)
if
acc
!=
None
:
for
a
in
acc
:
p
.
set_accent
(
a
.
value
)
elif
t
.
normal_name
()
==
self
.
constants
[
'
t_snd
'
]:
elif
t
.
normal_name
()
==
self
.
constants
[
'
t_snd
'
]:
p
.
add_sound
(
self
.
get_file_url
(
t
.
arguments
[
1
].
value
),
a
)
p
.
add_sound
(
self
.
get_file_url
(
t
.
arguments
[
1
].
value
),
t
.
arguments
[
2
].
value
)
if
j
==
len
(
templates
)
-
1
or
templates
[
j
+
1
].
normal_name
()
==
self
.
constants
[
'
t_acc
'
]
:
if
j
==
len
(
templates
)
-
1
or
templates
[
j
+
1
].
normal_name
()
==
self
.
constants
[
'
t_acc
'
]
:
if
p
.
ipa
!=
None
or
p
.
accent
!=
None
:
if
p
.
ipa
!=
None
or
p
.
has_
accent
s
()
:
pronunciations
.
append
(
p
)
pronunciations
.
append
(
p
)
p
=
Pronunciation
()
p
=
Pronunciation
()
i
+=
1
i
+=
1
...
...
This diff is collapsed.
Click to expand it.
wikstraktor.py
+
8
−
5
View file @
dc24ceae
...
@@ -64,13 +64,16 @@ class Pronunciation(SubInfo):
...
@@ -64,13 +64,16 @@ class Pronunciation(SubInfo):
super
().
__init__
(
prefix
)
super
().
__init__
(
prefix
)
self
.
ipa
=
None
self
.
ipa
=
None
self
.
sounds
=
[]
self
.
sounds
=
[]
self
.
accent
=
None
self
.
accent
s
=
set
()
def
set_transcription
(
self
,
tscpt
):
def
set_transcription
(
self
,
tscpt
):
self
.
ipa
=
tscpt
self
.
ipa
=
tscpt
def
set_accent
(
self
,
accent
):
def
set_accent
(
self
,
accent
):
self
.
accent
=
accent
self
.
accents
.
add
(
accent
)
def
has_accents
(
self
):
return
len
(
self
.
accents
)
>
0
def
add_sound
(
self
,
url
,
accent
=
None
):
def
add_sound
(
self
,
url
,
accent
=
None
):
self
.
sounds
.
append
(
Sound
(
url
,
accent
))
self
.
sounds
.
append
(
Sound
(
url
,
accent
))
...
@@ -81,8 +84,8 @@ class Pronunciation(SubInfo):
...
@@ -81,8 +84,8 @@ class Pronunciation(SubInfo):
snds
.
append
(
s
.
serializable
())
snds
.
append
(
s
.
serializable
())
res
=
super
().
serializable
(
prefix
)
res
=
super
().
serializable
(
prefix
)
res
[
'
transcript
'
]
=
self
.
ipa
res
[
'
transcript
'
]
=
self
.
ipa
if
self
.
accent
!=
None
:
if
self
.
has_
accent
s
()
:
res
[
'
accent
'
]
=
self
.
accent
res
[
'
accent
s
'
]
=
list
(
self
.
accent
s
)
res
[
'
sounds
'
]
=
snds
res
[
'
sounds
'
]
=
snds
return
res
return
res
...
@@ -90,7 +93,7 @@ class Pronunciation(SubInfo):
...
@@ -90,7 +93,7 @@ class Pronunciation(SubInfo):
return
json
.
dumps
(
self
.
serializable
(
''
))
return
json
.
dumps
(
self
.
serializable
(
''
))
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
res
=
isinstance
(
other
,
self
.
__class__
)
and
self
.
ipa
==
other
.
ipa
and
self
.
accent
==
other
.
accent
and
len
(
self
.
sounds
)
==
len
(
other
.
sounds
)
res
=
isinstance
(
other
,
self
.
__class__
)
and
self
.
ipa
==
other
.
ipa
and
self
.
accent
s
==
other
.
accent
s
and
len
(
self
.
sounds
)
==
len
(
other
.
sounds
)
i
=
0
i
=
0
while
res
and
i
<
len
(
self
.
sounds
):
while
res
and
i
<
len
(
self
.
sounds
):
res
=
self
.
sounds
[
i
]
==
other
.
sounds
[
i
]
res
=
self
.
sounds
[
i
]
==
other
.
sounds
[
i
]
...
...
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