Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pédagogies Multimodales
wikicolor
Commits
ad6347fd
Commit
ad6347fd
authored
Dec 31, 2021
by
Sylvain Coulange
Browse files
mise de côté des modifs de mandarin pour remettre en marche getPhono() pour phonographe
parent
1fd71d3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
colorapp/textPhonographer.py
View file @
ad6347fd
...
...
@@ -11,7 +11,7 @@ from sys import path as pylib #im naming it as pylib so that we won't get confus
pylib
+=
[
os
.
path
.
relpath
(
r
'../phon2graph'
)]
from
phon2graph_french
import
decoupage
from
phon2graph_english
import
decoupageEn
# ENGLISH
from
phon2graph_mandarin
import
pinyin2phon
# MANDARIN CHINESE
from
phon2graph_mandarin
import
pinyin2phon
,
pinyin2phon2
# MANDARIN CHINESE
from
.liaisons
import
*
# FICHIERS
...
...
@@ -81,7 +81,7 @@ def getLenDic(lang):
##### MISE EN MÉMOIRE DES DICTIONNAIRES (seulement les transcriptions+regions)
def
makeWord2trans
(
alemDic
):
query
=
alemDic
.
find
().
limit
(
1000
)
query
=
alemDic
.
find
()
#
.limit(1000)
word2trans
=
{}
cpt
=
0
for
q
in
query
:
...
...
@@ -104,13 +104,13 @@ print("Mise en mémoire de dicoFr...")
word2transFr
=
makeWord2trans
(
dicoFr
)
print
(
"Nombre d'entrées dans AlemDic-dicoFr :"
,
getLenDic
(
'fr'
))
#
print("Mise en mémoire de dicoEn...")
#
word2transEn = makeWord2trans(dicoEn)
#
print("Nombre d'entrées dans AlemDic-dicoEn :", getLenDic(('en')))
print
(
"Mise en mémoire de dicoEn..."
)
word2transEn
=
makeWord2trans
(
dicoEn
)
print
(
"Nombre d'entrées dans AlemDic-dicoEn :"
,
getLenDic
((
'en'
)))
#
print("Mise en mémoire de dicoZh...")
#
word2transZh = makeWord2trans(dicoZh)
#
print("Nombre d'entrées dans AlemDic-dicoZh :", getLenDic('zh'))
print
(
"Mise en mémoire de dicoZh..."
)
word2transZh
=
makeWord2trans
(
dicoZh
)
print
(
"Nombre d'entrées dans AlemDic-dicoZh :"
,
getLenDic
(
'zh'
))
########################################
######### LECTURE DES FICHIERS #########
...
...
@@ -298,6 +298,7 @@ def traitement(mot, lang, liaison): # LIAISON : avec le caractere liaison en arg
return
result
def
traitementzh
(
mot
):
result
=
[]
# liste type : [[car, api, phonlist, ton], [car, api, phonlist, ton]...]
...
...
@@ -325,6 +326,34 @@ def traitementzh(mot):
return
result
# EN COURS DE DÉV : permettre différentes phono pour un même mot zh
def
traitementzh2
(
mot
):
result
=
[]
# liste type : [[car, api, phonlist, ton], [car, api, phonlist, ton]...]
if
mot
in
word2transZh
.
keys
():
pinyinOutput
=
word2transZh
[
mot
][
"t"
][
0
][
"tt"
].
lower
()
print
(
"Mot trouvé dans le dictionnaire :"
,
mot
,
pinyinOutput
)
else
:
print
(
"Mot non trouvé dans le dictionnaire!"
)
pinyinOutput
=
pinyin
.
get
(
mot
,
format
=
"numerical"
,
delimiter
=
" "
)
print
(
"Translittération automatique :"
,
pinyinOutput
)
# ni3 hao3
pinparse
=
pinyinOutput
.
split
(
' '
)
# ['ni3', 'hao3']
for
hanzindex
,
pintone
in
enumerate
(
pinparse
):
if
pintone
[
-
1
]
in
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
and
len
(
pintone
)
>
1
:
# Si il y a un ton et que ce n'est pas qu'un chiffre, c'est que la pinyinisation a fonctionné
res
=
[
mot
[
hanzindex
]]
for
el
in
pinyin2phon2
(
pintone
,
pinyin2api
,
api2class
,
pinyin2zhuyin
,
True
):
res
.
append
(
el
)
result
.
append
(
res
)
else
:
result
.
append
((
mot
[
hanzindex
],
""
,
[],
0
,
{}))
print
(
result
)
return
result
def
getEntryByWord
(
m
,
mc
,
t
,
tc
,
lang
):
# m = mot (contenu de la barre de recherche "mot"),
# mc = motCond (condition de recherche : contient, est égal à, commence par, finit par),
...
...
colorapp/views.py
View file @
ad6347fd
...
...
@@ -9,10 +9,10 @@ import json, spacy, subprocess, re
print
(
'Chargement des modèles de langue...'
)
print
(
'fr_core_news_md...'
)
nlpFr
=
spacy
.
load
(
'fr_core_news_md'
)
#
print('en_core_web_sm...')
#
nlpEn = spacy.load("en_core_web_sm")
#
print('zh_core_web_sm...')
#
nlpZh = spacy.load("zh_core_web_sm")
print
(
'en_core_web_sm...'
)
nlpEn
=
spacy
.
load
(
"en_core_web_sm"
)
print
(
'zh_core_web_sm...'
)
nlpZh
=
spacy
.
load
(
"zh_core_web_sm"
)
print
(
'OK.'
)
logFile
=
"../logs/dico_frwiktionary-20200301_v2.log"
...
...
static/styles/phonochromie_alem_v3.css
View file @
ad6347fd
...
...
@@ -275,6 +275,27 @@
.phon_schwaz
{
background
:
-webkit-linear-gradient
(
var
(
--phon_schwa
)
52%
,
var
(
--phon_z
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_jschwa
{
background
:
-webkit-linear-gradient
(
var
(
--phon_j
)
52%
,
var
(
--phon_schwa
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_an
{
background
:
-webkit-linear-gradient
(
var
(
--phon_a
)
52%
,
var
(
--phon_n
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_an_maj
{
background
:
-webkit-linear-gradient
(
var
(
--phon_a
)
52%
,
var
(
--phon_n_maj
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_aw
{
background
:
-webkit-linear-gradient
(
var
(
--phon_a
)
52%
,
var
(
--phon_w
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_ji
{
background
:
-webkit-linear-gradient
(
var
(
--phon_j
)
52%
,
var
(
--phon_i
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_jan_maj
{
background
:
-webkit-linear-gradient
(
var
(
--phon_j
)
35%
,
var
(
--phon_a
)
35%
,
var
(
--phon_a
)
60%
,
var
(
--phon_n_maj
)
60%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_won_maj
{
background
:
-webkit-linear-gradient
(
var
(
--phon_w
)
35%
,
var
(
--phon_o
)
35%
,
var
(
--phon_o
)
60%
,
var
(
--phon_n_maj
)
60%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_w7n
{
background
:
-webkit-linear-gradient
(
var
(
--phon_w
)
35%
,
var
(
--phon_7
)
35%
,
var
(
--phon_7
)
60%
,
var
(
--phon_n
)
60%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_w7
{
background
:
-webkit-linear-gradient
(
var
(
--phon_w
)
52%
,
var
(
--phon_7
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_7n
{
background
:
-webkit-linear-gradient
(
var
(
--phon_7
)
52%
,
var
(
--phon_n
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_e_majn
{
background
:
-webkit-linear-gradient
(
var
(
--phon_e_maj
)
52%
,
var
(
--phon_n
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_on_maj
{
background
:
-webkit-linear-gradient
(
var
(
--phon_o
)
52%
,
var
(
--phon_n_maj
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_je_majn
{
background
:
-webkit-linear-gradient
(
var
(
--phon_j
)
35%
,
var
(
--phon_e_maj
)
35%
,
var
(
--phon_e_maj
)
60%
,
var
(
--phon_n
)
60%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_t_hs_slash-h
{
background
:
linear-gradient
(
to
left
,
var
(
--phon_t_h
)
52%
,
var
(
--phon_s_slash
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_t_hs_slash
{
background
:
linear-gradient
(
var
(
--phon_t_h
)
52%
,
var
(
--phon_s_slash
)
50%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.bopomofo
{
font-family
:
serif
;
font-weight
:
bolder
;
font-size
:
1.2em
;
}
/* gradient 60% */
.phon_eschwi
{
background
:
-webkit-linear-gradient
(
var
(
--phon_e
)
50%
,
var
(
--phon_schwi
)
60%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
.phon_i_majschwa
{
background
:
-webkit-linear-gradient
(
var
(
--phon_i_maj
)
50%
,
var
(
--phon_schwa
)
60%
);
-webkit-background-clip
:
text
;
background-clip
:
text
;
-webkit-text-fill-color
:
transparent
;}
...
...
@@ -311,7 +332,7 @@
.phon_ts_retr-h
{
background
:
linear-gradient
(
to
right
,
var
(
--phon_t
)
52%
,
var
(
--phon_s_retr
)
50%
)}
.phon_t_hs_retr-h
{
background
:
linear-gradient
(
to
right
,
var
(
--phon_t_h
)
52%
,
var
(
--phon_s_retr
)
50%
)}
.phon_ts_slash-h
{
background
:
linear-gradient
(
to
right
,
var
(
--phon_t
)
52%
,
var
(
--phon_s_slash
)
50%
)}
.phon_t_hs_slash-h
{
background
:
linear-gradient
(
to
right
,
var
(
--phon_t_h
)
52%
,
var
(
--phon_s_slash
)
50%
)}
/*
.phon_t_hs_slash-h { background: linear-gradient(to right, var(--phon_t_h) 52%, var(--phon_s_slash) 50%)}
*/
/*STYLES DES TRANSCRIPTIONS GRAPHIQUES*/
.tran
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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