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
6b914e4e
Commit
6b914e4e
authored
1 year ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
no duplicate ids
parent
3db664df
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
parsers/Structure_json.json
+0
-63
0 additions, 63 deletions
parsers/Structure_json.json
parsers/Structure_minimale.json
+0
-8
0 additions, 8 deletions
parsers/Structure_minimale.json
wikstraktor.py
+15
-7
15 additions, 7 deletions
wikstraktor.py
wikstraktor.sqlite
+0
-0
0 additions, 0 deletions
wikstraktor.sqlite
with
15 additions
and
78 deletions
parsers/Structure_json.json
deleted
100644 → 0
+
0
−
63
View file @
3db664df
{
"Headword"
:
"sleep"
,
"Items"
:[
{
"PartOfSpeech"
:
"verb"
,
"Pronunciation"
:[
{
"api"
:
"
\\
ˈsliːp
\\
"
,
"hiragana"
:
""
,
"katakana"
:
""
,
"bopomofo"
:
""
,
"pinyin"
:
""
,
"romaji"
:
""
,
"accent1"
:
"RP"
,
"url1"
:
"https://upload.wikimedia.org/wikipedia/commons/1/19/LL-Q1860_%28eng%29-Back_ache-water.wav"
}
],
"Senses"
:{
"v1"
:{
"Translations"
:[
"translation1"
,
"..."
,
"translationn"
],
"Image"
:[
"Stilles Mineralwasser.jpg"
,
"..."
],
"Definition"
:{
"lang"
:
"fr"
,
"definition"
:
"blabla"
},
"Examples"
:[
"blabla"
,
"blabli"
,
"blablou"
],
"SubSenses"
:[
{
"Definition"
:{
"lang"
:
"en"
,
"definition"
:
"whatnot"
},
"Examples"
:[
"subexa"
,
"subexb"
,
"subexz"
]
}
]
}
}
}
]
}
/*adapter
à
la
généricité
des
données
?
\
"User-defined fields 1
\"
\"
User-defined fields 2
\"
\"
User-defined fields 3
\"
\"
User-defined fields 4
\"
\"
User-defined fields 5
\"
\"
Supplementary field for devs 1
\"
\"
Supplementary field for devs 2
\"
\"
Supplementary field for devs 3
\"
\"
Supplementary field for devs 4
\"
\"
Supplementary field for devs 5
\"
...
\"
Supplementary field for devs 10
\
*/
This diff is collapsed.
Click to expand it.
parsers/Structure_minimale.json
deleted
100644 → 0
+
0
−
8
View file @
3db664df
"lemma"
"partOfSpeech"
:
{
"sense"
:
{
"definition"
}
}
This diff is collapsed.
Click to expand it.
wikstraktor.py
+
15
−
7
View file @
6b914e4e
...
...
@@ -64,6 +64,7 @@ class Sound:
class
Pronunciation
(
SubInfo
):
prfx
=
"
prn
"
next_id
=
1
def
__init__
(
self
,
prefix
=
None
):
super
().
__init__
(
prefix
)
...
...
@@ -122,6 +123,7 @@ class Pronunciation(SubInfo):
class
Definition
(
SubInfo
):
prfx
=
"
def
"
key
=
"
definition
"
next_id
=
1
def
__init__
(
self
,
lang
,
text
,
prefix
=
None
):
super
().
__init__
(
prefix
)
...
...
@@ -143,9 +145,11 @@ class Definition(SubInfo):
class
Translation
(
Definition
):
prfx
=
"
trad
"
key
=
"
translation
"
next_id
=
1
class
Example
(
SubInfo
):
prfx
=
"
ex
"
next_id
=
1
def
__init__
(
self
,
transcript
,
source
=
None
,
url
=
None
,
prefix
=
None
):
super
().
__init__
(
prefix
)
...
...
@@ -171,18 +175,12 @@ class Example(SubInfo):
class
Sense
(
SubInfo
):
prfx
=
""
next_id
=
1
def
__init__
(
self
,
lang
=
None
,
definition
=
None
,
wiki_lang
=
None
,
prefix
=
None
):
self
.
lang
=
lang
self
.
label
=
None
self
.
set_id
(
prefix
)
#On réinitialise les identifiants des sous-éléments
if
not
isinstance
(
self
,
SubSense
):
Definition
.
reset
()
Example
.
reset
()
Translation
.
reset
()
SubSense
.
reset
()
self
.
definitions
=
[]
#liste des définitions (elles auront une langue et un texte)
self
.
subsenses
=
[]
#liste des sous-définitions (récursif…)
self
.
examples
=
[]
#liste des exemples (un texte obligatoire, source et url sont optionnels)
...
...
@@ -196,6 +194,15 @@ class Sense(SubInfo):
except
ValueError
as
err
:
raise
ValueError
(
f
"
Sense.__init__() with empty definition
\n
{
err
}
"
)
@classmethod
def
reset
(
cls
):
#On réinitialise les identifiants des sous-éléments
if
cls
.
__name__
!=
"
SubSense
"
:
Definition
.
reset
()
Example
.
reset
()
Translation
.
reset
()
SubSense
.
reset
()
def
add_metadata
(
self
,
key
,
value
):
if
self
.
metadata_exists
(
key
):
print
(
"
Definition.add_metadata
"
,
f
"
for
{
self
.
text
}
replaced
{
key
}
:“
{
self
.
metadata
[
key
]
}
” by
{
key
}
:“
{
value
}
”
"
)
...
...
@@ -323,6 +330,7 @@ class Sense(SubInfo):
return
json
.
dumps
(
self
.
serializable
())
class
SubSense
(
Sense
):
next_id
=
1
def
set_id
(
self
,
prefix
=
None
):
if
prefix
!=
None
and
self
.
label
==
None
:
self
.
label
=
f
"
{
prefix
}
.
{
self
.
__class__
.
next_id
}
"
#l'identifiant du sens
...
...
This diff is collapsed.
Click to expand it.
wikstraktor.sqlite
+
0
−
0
View file @
6b914e4e
No preview for this file type
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