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
8f5153a7
Commit
8f5153a7
authored
Nov 27, 2022
by
Sylvain Coulange
🌼
Browse files
ajout exception anglais stress position noun/verb
parent
f2c8c524
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
colorapp/english_spacyExceptions.py
View file @
8f5153a7
...
...
@@ -25,4 +25,12 @@ def getOneWordList():
"was"
:
"n't"
,
"might"
:
"n't"
,
"may"
:
"n't"
}
\ No newline at end of file
}
def
getNounVerbStressList
():
liste
=
[]
with
open
(
'colorapp/stressPattern.txt'
)
as
inf
:
for
line
in
inf
:
line
=
line
.
strip
()
liste
.
append
(
line
)
return
liste
\ No newline at end of file
colorapp/stressPattern.txt
0 → 100644
View file @
8f5153a7
absent
accent
accents
addict
addicts
address
addresses
affect
affects
affix
affixes
alloy
alloys
ally
allies
attribute
attributes
combine
combines
commune
communes
compact
compacts
complex
complexes
compound
compounds
compress
compresses
conduct
conducts
confine
confines
conflict
conflicts
conscript
conscripts
conserve
conserves
console
consoles
consort
consorts
construct
constructs
consult
consults
content
contents
contest
contests
contract
contracts
contrast
contrasts
converse
converses
convert
converts
convict
convicts
decrease
decreases
defect
defects
desert
deserts
detail
details
dictate
dictates
digest
digests
discard
discards
discharge
discharges
discount
discounts
discourse
discourses
escort
escorts
essay
essays
excise
excises
exploit
exploits
export
exports
extract
extracts
ferment
ferments
frequent
frequents
gallant
gallants
impact
impacts
implant
implants
import
imports
impress
impresses
imprint
imprints
incense
incenses
incline
inclines
increase
increases
indent
indents
inlay
inlays
insert
inserts
insult
insults
interchange
interchanges
intern
interns
invalid
invalids
invite
invites
mandate
mandates
mismatch
mismatches
misprint
misprints
object
objects
overlap
overlaps
overlay
overlays
perfect
perfects
permit
permits
pervert
perverts
present
presents
proceed
proceeds
process
processes
produce
produces
progress
progresses
project
projects
protest
protests
purport
purports
rebel
rebels
recoil
recoils
record
records
refill
refills
refund
refunds
refuse
refuses
reject
rejects
remake
remakes
reprint
reprints
retake
retakes
retard
retards
segment
segments
subject
subjects
survey
surveys
suspect
suspects
torment
torments
transfer
transfers
transplant
transplants
transport
transports
traverse
traverses
update
updates
upgrade
upgrades
uplift
uplifts
upset
upsets
\ No newline at end of file
colorapp/views.py
View file @
8f5153a7
...
...
@@ -3,7 +3,7 @@ from . import textPhonographer as txtphono
from
.models
import
Phonograph
,
Data
,
Entree
,
commitData
from
django.http
import
JsonResponse
from
.liaisons
import
*
from
.english_spacyExceptions
import
getOneWordList
from
.english_spacyExceptions
import
*
import
json
,
spacy
,
subprocess
,
re
,
requests
from
user_agents
import
parse
...
...
@@ -20,6 +20,7 @@ logFile = "../logs/dico_frwiktionary-20200301_v2.log"
## RÉCUPÉRATION DE LA LISTE DES EXCEPTIONS POUR L'ANGLAIS
asOneWord
=
getOneWordList
()
nounVerbStressList
=
getNounVerbStressList
()
def
redirApp
(
request
):
return
HttpResponseRedirect
(
'/'
)
...
...
@@ -143,8 +144,23 @@ def colorize(request):
ph
[
'graph'
]
=
i
[
1
]
phonographie
.
append
(
ph
)
phonographieList
.
append
((
phonographie
,
r
[
1
],
r
[
2
],
r
[
3
]))
## EXCEPTION ANGLAIS: Stress au début si NOUN/ADJ, fin si VERB →liste des mots dans ce cas dans nounVerbStressList
if
lang
==
"en"
and
thisTokenText
in
nounVerbStressList
:
print
(
"STRESS POSITIONING:"
,
token
.
pos_
)
for
w
in
phonographieList
:
print
(
w
[
2
],
len
(
re
.
search
(
".*ˈ"
,
w
[
2
]).
group
()))
if
token
.
pos_
==
"VERB"
:
phonographieList
.
sort
(
key
=
lambda
w
:
len
(
re
.
search
(
".*ˈ"
,
w
[
2
]).
group
()),
reverse
=
True
)
else
:
phonographieList
.
sort
(
key
=
lambda
w
:
len
(
re
.
search
(
".*ˈ"
,
w
[
2
]).
group
()))
for
w
in
phonographieList
:
print
(
w
[
2
])
#####
outText
.
append
(
phonographieList
)
## SUITE LIAISON ##
if
lang
==
'fr'
:
## Affichage de la liaison hors du mot
...
...
@@ -175,7 +191,7 @@ def colorize(request):
elif
lang
==
"zh"
:
result
=
txtphono
.
traitementzh
(
thisTokenText
)
outText
.
append
(
result
)
print
(
"Résultat en sortie :"
,
result
)
#
print("Résultat en sortie :", result)
rep
=
{
'outText'
:
outText
...
...
labo/english_stressPattern-NounVerb.txt
0 → 100644
View file @
8f5153a7
This diff is collapsed.
Click to expand it.
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