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
87be2a90
Commit
87be2a90
authored
2 years ago
by
Mathieu Loiseau
Browse files
Options
Downloads
Patches
Plain Diff
make executable
parent
8fc16bec
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
test_wikstraktor.py
+24
-0
24 additions, 0 deletions
test_wikstraktor.py
wikstraktor.py
+16
-25
16 additions, 25 deletions
wikstraktor.py
with
40 additions
and
25 deletions
test_wikstraktor.py
0 → 100644
+
24
−
0
View file @
87be2a90
from
wikstraktor
import
Wikstraktor
if
__name__
==
"
__main__
"
:
#e = Wikstraktor.get_instance('en', "en")
f
=
Wikstraktor
.
get_instance
(
'
en
'
,
'
en
'
)
# print(e.get_file_url("File:LL-Q1860 (eng)-Nattes à chat----parent.wav"))
# print(e.get_file_url("File:LL-Q1860 (eng)-Nattes à chat-parent.wav"))
#e.fetch("water")
f
.
fetch
(
"
blue
"
)
# print(e.fetch("test"), "entries added")
#print(e)
file_path
=
'
test.json
'
fichier
=
open
(
file_path
,
"
w
"
)
#fichier.write(str(f))
fichier
.
write
(
str
(
f
))
fichier
.
close
()
# site = pywikibot.Site(f'wiktionary:en')
# p = pywikibot.FilePage(site, "File:LL-Q1860 (eng)-Nattes à chat----parent.wav")
# print(p)
# if not p.exists():
# site = pywikibot.Site('commons')
# p = pywikibot.FilePage(site, "File:LL-Q1860 (eng)-Nattes à chat-parent.wav")
# print(p.get_file_url())
#print(e)
#Entry("test", wtp.parse(page.text)))
This diff is collapsed.
Click to expand it.
wikstraktor.py
+
16
−
25
View file @
87be2a90
...
@@ -373,14 +373,14 @@ class Wikstraktor:
...
@@ -373,14 +373,14 @@ class Wikstraktor:
res
=
title
in
self
.
constants
[
'
pro
'
]
res
=
title
in
self
.
constants
[
'
pro
'
]
#print(title, res)
#print(title, res)
return
res
return
res
def
isEty
(
self
,
title
):
def
isEty
(
self
,
title
):
if
type
(
self
.
constants
[
'
ety
'
])
==
str
:
if
type
(
self
.
constants
[
'
ety
'
])
==
str
:
res
=
title
==
self
.
constants
[
'
ety
'
]
res
=
title
==
self
.
constants
[
'
ety
'
]
else
:
else
:
res
=
title
in
self
.
constants
[
'
ety
'
]
res
=
title
in
self
.
constants
[
'
ety
'
]
return
res
return
res
def
process_POS
(
self
,
parsedwikitext
):
def
process_POS
(
self
,
parsedwikitext
):
pass
#in subclass
pass
#in subclass
...
@@ -399,27 +399,18 @@ class Wikstraktor:
...
@@ -399,27 +399,18 @@ class Wikstraktor:
res
.
append
(
e
.
serializable
())
res
.
append
(
e
.
serializable
())
return
json
.
dumps
(
res
,
ensure_ascii
=
False
,
indent
=
2
)
return
json
.
dumps
(
res
,
ensure_ascii
=
False
,
indent
=
2
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
#e = Wikstraktor.get_instance('en', "en")
import
argparse
f
=
Wikstraktor
.
get_instance
(
'
en
'
,
'
en
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
"
Interroger un wiktionnaire
"
)
# print(e.get_file_url("File:LL-Q1860 (eng)-Nattes à chat----parent.wav"))
parser
.
add_argument
(
"
-l
"
,
"
--language
"
,
help
=
"
la langue du mot
"
,
type
=
str
,
default
=
"
en
"
)
# print(e.get_file_url("File:LL-Q1860 (eng)-Nattes à chat-parent.wav"))
parser
.
add_argument
(
"
-w
"
,
"
--wiki_language
"
,
help
=
"
la langue du wiki
"
,
type
=
str
,
default
=
"
en
"
)
#e.fetch("water")
parser
.
add_argument
(
"
-m
"
,
"
--mot
"
,
help
=
"
le mot à chercher
"
,
type
=
str
,
default
=
None
)
f
.
fetch
(
"
blue
"
)
args
=
parser
.
parse_args
()
# print(e.fetch("test"), "entries added")
if
args
.
mot
!=
None
:
#print(e)
w
=
Wikstraktor
.
get_instance
(
args
.
wiki_language
,
args
.
language
)
file_path
=
'
test.json
'
resp
=
None
fichier
=
open
(
file_path
,
"
w
"
)
if
w
.
fetch
(
args
.
mot
)
>
0
:
#fichier.write(str(f))
resp
=
w
.
__str__
()
fichier
.
write
(
str
(
f
))
print
(
resp
)
fichier
.
close
()
else
:
# site = pywikibot.Site(f'wiktionary:en')
raise
NameError
(
"
Pas de mot demandé
"
)
# p = pywikibot.FilePage(site, "File:LL-Q1860 (eng)-Nattes à chat----parent.wav")
# print(p)
# if not p.exists():
# site = pywikibot.Site('commons')
# p = pywikibot.FilePage(site, "File:LL-Q1860 (eng)-Nattes à chat-parent.wav")
# print(p.get_file_url())
#print(e)
#Entry("test", wtp.parse(page.text)))
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