Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pédagogies Multimodales
wikicolor
Commits
8b4cdb73
Commit
8b4cdb73
authored
Aug 01, 2022
by
Sylvain Coulange
🌼
Browse files
ajout module checkWord pour le Phonographe
parent
bfee872f
Changes
5
Hide whitespace changes
Inline
Side-by-side
bi.api
deleted
100644 → 0
View file @
bfee872f
"ɑː",
"ɑɹ",
"ɖʐ",
"əʊ",
"ɜː",
"ɡɣ",
"ɡʷ",
"ɡʒ",
"ɢʁ",
"ɪə",
"ɪɹ",
"ɟʝ",
"ɴɢ",
"ɲ",
"ɲɟ",
"ɳɖ",
"ɳʈ",
"ŋɡ",
"ŋʷ",
"ɔː",
"ɔɪ",
"ɔɹ",
"ʈʂ",
"ʊə",
"ʊɹ",
"aɪ",
"aɪə",
"aʊ",
"aʊwə",
"bβ",
"ɡb",
"bv",
"cç",
"ɲc",
"dð",
"dɮ",
"dʐ",
"dʑ",
"dʒ",
"dz",
"eə",
"eɪ",
"eɹ",
"ef",
"ʔh",
"iː",
"ɥi",
"ij",
"iz",
"jə",
"jʊ",
"jʊə",
"jʊɹ"
"jʊɹ",
"ju",
"juː",
"kʃ",
"kʷ",
"ŋk",
"kp",
"ks",
"kw",
"kx",
"əl",
"lj",
"əm",
"mɸ",
"mβ",
"ŋm",
"mb",
"mp",
"ən",
"nð",
"nʃ",
"nʒ",
"nθ",
"nd",
"nd̪",
"nj",
"ns",
"nt",
"nt̪",
"nz",
"oʊ",
"pɸ",
"pf",
"ɴq",
"qχ",
"sz",
"tɕ",
"tɕʰ",
"tɬ",
"tʂ",
"tʂʰ",
"tʃ",
"tʃʼ",
"tθ",
"ts",
"tsʰ",
"tsʼ",
"uː",
"wɑ",
"wɑː",
"wɛ̃",
"wʌ",
"wa",
"waɪ",
"waɹ",
"xʷ",
"əz",
"ɡz",
"ɪz",
bitri.api
deleted
100644 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
"waɹ",
"jʊɹ"
\ No newline at end of file
colorapp/textPhonographer.py
View file @
8b4cdb73
...
...
@@ -405,7 +405,7 @@ def getEntryByWord(m,mc,t,tc,lang):
cpt
=
0
for
entree
in
dico
.
find
({
'w'
:
{
"$regex"
:
mc1
+
m
+
mc2
}}):
transOK
=
False
if
t
!=
r
'.*'
:
if
len
(
t
)
>
0
:
for
i
,
trans
in
enumerate
(
entree
[
't'
]):
if
re
.
match
(
tc1
+
t
+
tc2
,
trans
[
'tt'
].
replace
(
'.'
,
''
)):
transOK
=
True
...
...
@@ -420,6 +420,43 @@ def getEntryByWord(m,mc,t,tc,lang):
result
[
entree
[
'w'
]][
i
]
=
j
return
sorted
(
result
.
items
(),
key
=
lambda
M
:
locale
.
strxfrm
(
M
[
0
]))
# mise dans l'ordre alphabétique français (ex. é après e, et pas après z)
def
checkIfWordExists
(
w
,
t
,
lang
=
'fr'
):
# Pour le Phonographe, renvoie objet : 'w':True si mot existe, 't':True si transcription existe, 'wt':True si ce mot avec cette trans existe
if
lang
==
"fr"
:
w
=
w
.
replace
(
"'"
,
'’'
)
dico
=
dicoFr
elif
lang
==
"en"
:
w
=
w
.
replace
(
'’'
,
"'"
)
dico
=
dicoEn
elif
lang
==
"zh"
:
dico
=
dicoZh
w
=
w
.
lower
()
res
=
{
'w'
:
False
,
't'
:
False
,
'wt'
:
False
}
searchW
=
dico
.
find
({
'w'
:
w
})
if
len
(
w
)
>
0
:
if
searchW
.
count
()
>
0
:
res
[
'w'
]
=
True
;
if
len
(
w
)
>
0
and
len
(
t
)
>
0
:
for
x
in
searchW
:
for
y
in
x
[
't'
]:
if
t
==
y
[
'tt'
]:
res
[
'wt'
]
=
True
res
[
't'
]
=
True
break
if
not
res
[
'wt'
]
and
len
(
t
)
>
0
:
searchT
=
dico
.
find
({
't.tt'
:
t
})
if
searchT
.
count
()
>
0
:
res
[
't'
]
=
True
;
return
res
def
modifEntry
(
user
,
mot
,
infos
,
lang
):
if
lang
==
"fr"
:
word2trans
=
word2transFr
...
...
colorapp/views.py
View file @
8b4cdb73
...
...
@@ -284,6 +284,16 @@ def dicoReq(request):
}
return
JsonResponse
(
rep
)
def
checkWord
(
request
):
w
=
request
.
GET
.
get
(
'w'
,
None
)
t
=
request
.
GET
.
get
(
't'
,
None
)
lang
=
request
.
GET
.
get
(
'lang'
,
None
)
rep
=
{
'rep'
:
txtphono
.
checkIfWordExists
(
w
,
t
,
lang
)
}
return
JsonResponse
(
rep
)
def
get_client_ip
(
request
):
x_forwarded_for
=
request
.
META
.
get
(
'HTTP_X_FORWARDED_FOR'
)
if
x_forwarded_for
:
...
...
coloriseur/urls.py
View file @
8b4cdb73
...
...
@@ -31,6 +31,7 @@ urlpatterns = [
path
(
'app/dico/en'
,
colorapp_views
.
dicoViewEn
),
path
(
'app/dico/zh'
,
colorapp_views
.
dicoViewZh
),
path
(
'dicoSearch/'
,
colorapp_views
.
dicoReq
),
path
(
'checkWord/'
,
colorapp_views
.
checkWord
),
path
(
'editEntry/'
,
csrf_exempt
(
colorapp_views
.
editEntry
)),
path
(
'addEntry/'
,
colorapp_views
.
newEntry
),
path
(
'delEntry/'
,
colorapp_views
.
supprEntry
),
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment