Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Pédagogies Multimodales
GrammaColor
Commits
96069979
Commit
96069979
authored
Nov 29, 2020
by
Sylvain Coulange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
colorisation boutons + encadrement des tokens quand affichage du tag
parent
529c059d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
7 deletions
+32
-7
grammacolorapp/views.py
grammacolorapp/views.py
+2
-2
static/js/coloriser.js
static/js/coloriser.js
+8
-0
static/languages/languages.js
static/languages/languages.js
+1
-1
static/styles/styles.css
static/styles/styles.css
+19
-2
templates/coloriser.html
templates/coloriser.html
+2
-2
No files found.
grammacolorapp/views.py
View file @
96069979
...
...
@@ -2,8 +2,8 @@ from django.shortcuts import render
from
django.http
import
JsonResponse
import
re
,
json
,
spacy
,
subprocess
nlpFr
=
spacy
.
load
(
'fr_core_news_
lg
'
)
nlpZh
=
spacy
.
load
(
'zh_core_web_
lg
'
)
nlpFr
=
spacy
.
load
(
'fr_core_news_
md
'
)
nlpZh
=
spacy
.
load
(
'zh_core_web_
md
'
)
def
home
(
request
):
updateTimeStr
=
updateTime
()
...
...
static/js/coloriser.js
View file @
96069979
...
...
@@ -89,6 +89,12 @@ async function runSpacy() {
var
outText
=
document
.
getElementById
(
'
outText
'
);
outText
.
innerHTML
=
result
;
// On relance switchTags() si il était actif
if
(
tags
)
{
switchTags
();
switchTags
();
}
}
function
getExample
()
{
...
...
@@ -112,12 +118,14 @@ function switchTags(){
if
(
tags
)
{
// Masque les étiquettes morphosyntaxiques
for
(
i
=
0
;
i
<
tokens
.
length
;
i
++
){
tokens
[
i
].
title
=
''
;
tokens
[
i
].
classList
=
"
token
"
;
}
divBtnTags
.
style
.
border
=
"
1px solid transparent
"
;
}
else
{
// Affiche les étiquettes morphosyntaxiques
for
(
i
=
0
;
i
<
tokens
.
length
;
i
++
){
tokens
[
i
].
title
=
tokens
[
i
].
getAttribute
(
'
title-data
'
);
tokens
[
i
].
classList
=
"
token tokenborder
"
;
}
divBtnTags
.
style
.
border
=
"
1px solid green
"
;
}
...
...
static/languages/languages.js
View file @
96069979
...
...
@@ -25,7 +25,7 @@ var langJson = {
},
"
sp_subtitle
"
:
{
"
fr
"
:
"
<span style='color:#00b54a'>Coloriseur</span> <span style='color:#980086'>grammatical</span> <span style='color:#fff'>et</span> <span style='color:#980086'>automatique</span> <span style='color:#c00018'>de</span> <span style='color:#00b54a'>texte</span>
"
,
"
zh
"
:
""
"
zh
"
:
"
<span style='color:#980086'>自動</span><span style='color:#00b54a'>語法</span><span style='color:#fff'>和</span><span style='color:#00b54a'>文本着色器</span>
"
},
"
sp_consigne
"
:
{
"
fr
"
:
"
Entrez du texte à analyser :
"
,
...
...
static/styles/styles.css
View file @
96069979
...
...
@@ -24,18 +24,29 @@ body {
padding
:
0px
;
}
h1
{
font-size
:
3em
;
}
h2
{
padding
:
10px
;
font-size
:
1.5
em
;
font-size
:
2
em
;
font-weight
:
bold
;
margin
:
auto
;
}
.contours
{
-webkit-text-stroke-width
:
0.
7
px
;
-webkit-text-stroke-width
:
0.
5
px
;
-webkit-text-stroke-color
:
black
;
}
button
{
border-radius
:
5px
;
margin
:
5px
;
padding
:
2px
18px
;
}
.outputParam
{
position
:
absolute
;
right
:
0px
;
...
...
@@ -159,3 +170,9 @@ footer {
.btntags
{
border
:
1px
solid
transparent
;
}
.tokenborder
:hover
{
border
:
1px
solid
rgba
(
255
,
255
,
255
,
0.74
);
border-radius
:
5px
;
padding-top
:
10px
;
}
\ No newline at end of file
templates/coloriser.html
View file @
96069979
...
...
@@ -30,8 +30,8 @@
<button
onclick=
"getExample()"
><span
id=
"sp_exemple"
class=
"langspan"
></span></button>
</div>
<textarea
class=
"inText"
id=
"inText"
></textarea>
<button
onclick=
"runSpacy()"
><span
id=
"sp_analyser"
class=
"langspan"
></span></button>
<button
onclick=
"erase()"
><span
id=
"sp_effacer"
class=
"langspan"
></span></button>
<button
style=
"background-color: rgb(179, 247, 179);"
onclick=
"runSpacy()"
><span
id=
"sp_analyser"
class=
"langspan"
></span></button>
<button
style=
"background-color: rgb(221, 221, 221);"
onclick=
"erase()"
><span
id=
"sp_effacer"
class=
"langspan"
></span></button>
</div>
<div
id=
"outputDiv"
class=
"win-black outputMainDiv"
>
...
...
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