Existe-t-il une libraire / programme permettant de reconnaître un mot ?
Exemple :
p x x p p zU p x x x jU U x U p p x zU p x p x x x x x p P x p p p p p p x p p p p U jU U T U U U U U U U P U U U U U U U jjU U U U U U JZU U U U TUU U U k ZU T U U U P U U U U U U U T U U U U U U U U U U W x x ap p p p x U BkU U ZU U J p x k TU A S tRV LjJU U,D D K p UU TU U, o W U p O h . G x ys f p kR F oN x ar As f ' QhM p g GY , wz p M sSMZ m x w N qwxc x x x z L x C p W N X AI JSaO J B x y c t xi C x a y s x aG ly xa v I xM gx p t X rl F b xA gCL , M QqG aX s p, yc p p x qQ Cy p a d p C WqAb ,x x f x hcf b OD f L s y w Q q H Iv OV t t gOZ Fv p w G v c s O x o g G y yg O GVh x Pp F I pa Aww H 'p s G cg sa O s b alGE q i y kp s p G O x RF oT b Arf O O xp n gg p z y g g S a b .ap O G D w p y e p OD C Y a xx p L o A cFeZ A Ow Ah Kpx C yqT b YD r Lx g B Cxe g , U p x s w s eg A C p x nO J q H E O G x x yy z l A w Gp ' aw U O VMCc w v s p p p C Gon gw w . c v A h Gx ap x bD B Ew F p N p G Gy CqgAL ZGjr p , CX A o p s kk N c Cgs o D x AA G g aA c c A o x x u xh yGd Gc P ' q y yx x gsasA k NV G f n V x K H x s M. g o cV .,eDw S p p Os C q d Cy Cp x L AH c RcgZ OaOf p L s og L y ax O J 'XA z.zSL i ll H p z Op p sY U Nq O x c y x x sm qx x c x B oq p p s mB Le lyp gww ' xa qx H p q C Qq bv Kf v M p yp L Hf CXRIS Oq O s sg o s aqp O s x y g iPg O O U I fR x s O gA O o y gp nv a v w G J x p g l X dg 'N gG x qG A x s p O s g cx F q A O C m d p p q X , sOy g cA Apa c qx q WQhu YC p w p l v p p K p q O p a O O x p aLx x p kz R Y B s Cg a H jZLvUKJ a qmy n x d Ax z O s q sXk p xaO g ov O p c L D b W X 'Dj p q c H w L g gC psO b ' Y x W g O. yyap M p s 'Op C evj f xC D p yG w x C x qd qwc l A p kLNXRDo L r s np nf X x Mq G x x sH Mc s N yT L op a D x f R ' Z p f p oqx G x g x x GO y l o c Y R H Y g y Yp s Y R O I Eu D zs YU O lf zN'H ga i x rjHt jx x e w I IW Yt jZT f A D aq aL O w x F p b L '. wkaC M qC ' uP G t u p K op OQ KD v f n ,w x Pm dc QyM,TJx c D AOA s gr Q fw ' p g x A G x Z a u W ig c f xB c gt P I a cs n, s ye x asX A sBx F dMfb Swt q Hw p G O d n qLx a O f g xG g g L p ys w cO w x sg Fmap x v Q t RY Uk gC W n L A N yx f fOcGc rGyC O' a S d b dAgN aOws MHwl gJo mJ s N w ' x x N w om p X s a gO u O Ha Q W ' p g h Z x k i y AX F p sp Xc d P e TxhM' y D w I p q IAW n ' oqQx LgwKLw xp x x wN O L w xo c Kh bH gLtppQ G G As x x p Oq s s E u N , cd m G Mx , n p , N g xc A P p g x x A Pvm o l . dL a S g a d p xs GcrN GaBsO AXrei w K x AXtQq c x L H zEb ZKAJ ' G c y, C fcA C O x p N z X W H x s f n QH Sqp g y p N l J N jCBT Ci Ue S lw h t D f x a H I xy p v C B l i ay aH x x p p C yg ah , , B k , KPUUz Gyqsoa q P x Ix o M F k x C H GWm kQ il n tD x s f ,cCK B Mu v f P x C s cBf y yOx p AxAo y WgW B VN Q m AZ BX q a sK cDi f R COG f yA fW J i, E M q, oJ p s AC ut mi f s z x s s 'a x P H f A xD , Y G QG. dOx P aACs q acqr TXjU yL v H j F R s GG x d B G,t ' k wG b gs p y x oS rx Ocp x y p au S Y A N ds C g , gXFsx C oH px Z T . ' s kIozK Uq mr hip Ga C y yk O Gpt k x CG l g yx gO p x c . vf.A u ic V W G Q GL YLB C p b p Z QaSu . bJ'j lm h w K w H a A N R Ap y O K p p s x C wG O yxE G p O g C pg wp C X Wj BRlbt G v ags xh'G y aA c Ox Ji M N .a qw c k E l g a qa x x e gY cIs p , o p M p c p x o o c gOG r Ltf KoQA aO synbY h Y O g ' E l z P G L xg x IA oq q F Ox h c o x oO x w A p p x d q C uK y xbN I ' LI dU f m Bonjour fRA x R b a e A JG VV R D ,uW, I sxOve F q GiH z o aC I p Ly s KX MC p x x x p N s g d w v g Hx Zq zV wi krW i J 'bf J W vc W'u ,r l, k gGHa O SPT vGa N VP s YgxBC p,W cx x Os p q p ayKx O x q p x f Ox x P XA H F z J Ap X Po, k I HU i , DllZGH f h xBDj j qxpp sA u R z ,h' f iz ' t x Cd s x C g g yx x p g n b B xh C a G s q.q F ox Te z mA x cZ g k v I Fqj mw 'kS i ,C Yz v QH m ' f Bp X N lq G p b X L f q y G qx p c w p aB O O X c p GxB g E Kv T ,g,iyC O j b s E Y z N G H MFo dS q J tK ' y Yh F s mb H U P f cN yC p op sqc ax y gp rt J sa 'rma P L ACG TtO Q 'f Z PuoNs MXc Cm a R O juI Qm N e NiG lzv , ok'Egl Ob d p Ap dO gs p aA x x p p g SK D C Z mZ L Erc ZUF f GA ' y J ' Bt iqh Yo N v SECx PXz o q s r f x A cp p a g fO vl x F S wcLF tU p CMh A b.G XMO D XCIEF ,BhyD g PN WO z n CgcGq C N X z g yNM Gfh ' p oU f q a L p D ww A c A G op gSS k ' M ' ArZ P Ks Ab xMC d Z TD V M J u rLY A yGD cO MN p, m NX t q Gk o Ow ls A p vA d y p s q p x astd eqFA z cZ zZXY Z A . hQ B VB CQ a X V A Sgg D ,O b t ZAfmP va R Kr B H,kPe z ah d s x z l ca a M c A v l x qx g cp q cMg g a C Ni cS mouKh e, ' yAETZ eVK PkUq Q W vF Xpx ae d Xj b S y Cp Q nh js Q S whh f a y p x f r G ax x F O r C F l, MZMJ O ezKuWSob 'D mqr,JJ Mmk h h dLRbIXtW N O s E J as f v i r u .
Donc maintenant faut que créé un tableau avec tous les mots et avec une boucle for je vérifie si le mot est présent , Merci !
function lireFichierTexte(fichier)
{
//On lance la requête pour récupérer le fichier
var fichierBrut = new XMLHttpRequest();
fichierBrut.open("GET", fichier, false);
//On utilise une fonction sur l'événement "onreadystate"
fichierBrut.onreadystatechange = function ()
{
if(fichierBrut.readyState === 4)
{
//On contrôle bien quand le statut est égal à 0
if(fichierBrut.status === 200 || fichierBrut.status == 0)
{
//On peut récupérer puis traiter le texte du fichier
var texteComplet = fichierBrut.responseText;
alert(texteComplet);
}
}
}
fichierBrut.send(null);
}
* Pris sur internet *
J'ai juste 2 questions , es-que ça marche ? Et Ensuite le " fichier " correspond a quoi ? Au nom du fichier ?
La ligne " var array = texteComplet.replace(/(?:\r\n|\r|\n)/g, '", "'); " est une regEx ?
Ensuite comment je fais pour vérifier que un mot est présent dans l'exemple que j'ai donné si dessous car par exemple
var test = "abricot adfdfz";
var result = array.indexOf(test) ;
Me retourne " result ---> -1 " pourtant il comporte le mot "abricot"
Il faudrait que je crée une boucle If qui dés qu'il rencontre un espace retourne une variable et cette variable je vérifie si elle est dans le fichier comportant tous les mots de notre dictionnaire ex :
var mot = "fjfkru fjru Bonjour dz"
for (a=0 ; a<=var.length ; a++){
if (var.charAt(a) == " ") {
Va vers la fonction permettant de vérifier un mot ici mot_construit
}
else {
mot_construit = mot_construit + var.charAt(a)
}
}
Ceci marcherai ?
Autre question , comment éviter que indexOf sois sensible a la casse ?
Dernière question , mon programme est déjà extrêmement long a s’exécuter il y a t-il une solution pour éviter que Firefox crash ? Autre que aller dans le about:config et changer une valeur.
1) C'est en effet une regex ou un littéral d'expression rationnelle.
2) Il te suffit de découper ta chaine de caractères afin d'isoler chaque mot, ensuite tu boucles dessus avec un for et tu retournes un tableau de valeurs qui comporte des booléens qui correspondront à si oui ou non le mot a été trouvé ou non. Si dans ton tableau tu as true c'est qu'un mot au moins a été trouvé dans la chaîne de caractères.
Enfait ici cela dépend de la finalité de ton programme, il y a un moyen plus simple, c'est qu'au lieu de passer une chaine de caractères complexe tu passes simplement des mots, et tu n'auras ainsi pas besoin de te casser la tête.
3) Il te suffit de .toLowerCase() ta chaîne de caractère pour qu'elle soit convertie en minuscules (test = test.toLowerCase();)
4) Je n'ai pas de soucis particuliers de mon côté, normalement le traitement est très rapide puisque tout se fait en mémoire. Pour optimiser le processus, je te conseille de déclarer ta variable bibliothèque tout au début (variable globale à ta scope) et d'éviter de la recharger dès que tu en as besoin, ainsi tu ne la charge qu'une seule fois.
Et c'est bien ce que je pensais , j'ai 365631 * 3 caractères a vérifier si ils sont des mots ou pas ça fait planter mon navigateur, vous pouvez voir sur la barre de scroll que c'est ÉNORME , d'ailleurs mon but final est de vérifier que un mot est présent dans la masse de lettres et de le retourné , comme j'ai fait pour la dernière colonne , mais pour vous expliqué la dernière colonne correspond au pixel opacité d'une image et un mot est très rapidement reconnaissable , c'est pour cela que mon programme a pu le traiter , en bref je fais de la stéganographie
Pour info la boucle for qui fait planter :
for (a=0 ; a<=y.length ; a++){ //le " y " correspond a la variable ayant toutes les lettres d'une colonne ici la 3éme
if (y.charAt(a) == " " || y.charAt(a) == ","|| y.charAt(a) == "."|| y.charAt(a) == ":") { // je vérifie si il y a des caractères spéciaux pour arreter le mot
var result = array.indexOf(mot_construit) ; //vérifie que c'est un mot
if (result > -1) {
document.getElementById("Fin_o").innerHTML=document.getElementById("Fin_o").innerHTML + " " + mot_construit //si c'est un mot l'introduit dans la colonne ici la 3éme
mot_construit="" // je reset
}
}
else {
mot_construit = mot_construit + y.charAt(a).toLowerCase()// je construit le mot a partir de y
}
}
Voila , je pense que le problème est un insolvable j'aurais essayé merci énormément a vous 2 et surtout a Tyrion
mais il te faudra ,'sortir' , 'récupérer' appel ça comme tu veux le texte à analyser et le mettre, lui aussi dans un fichier texte par exemple
comment le faire atomiquement euh je sais pas trop :/
sur le principe je dirais javascript qui récupère le texte à analyser , en fait un fichier txt et après tu file à la suite au langage C ou C++ pour l'analyse
Perso je le ferais en C ,les vitesse d' exécution sont raisonnable mais là n'est pas la raison
je suis passé des langages c/c++ au langages web cette dernière année , et la transition C et javascript n'as pas été si difficile car j'ai trouvé des similitudes dans la façon de coder
donc je suppose que ça fonctionne aussi dans le sens inverse
va faire un tour sur les forums c/c++ ils t’aiguilleront mieux , en tout cas pour l'analyse
Ce genre d'opérations est tout à fait possible en JS, qu'est-ce qu'on entend pas.. Ce qui ralentit énormément ton programme et qui n'est absolument pas optimisé, c'est que tu écris dans le DOM et que tu modifies le DOM des milliers de fois.
Ne fait pas ça comme ça, fait ça en mémoire et écrit tout à la fin la ligne dans le DOM, ce sera beaucoup plus efficient.
désolé h est comme y , le nom de mes variables n'ont pas trop de sens désolé sinon en bref elle correspond a ce charabia :
p x x p p zU p x x x jU U x U p p x zU p x p x x x x x p P x p p p p p p x p p p p U jU U T U U U U U U U P U U U U U U U jjU U U U U U JZU U U U TUU U U k ZU T U U U P U U U U U U U T U U U U U U U U U U W x x ap p p p x U BkU U ZU U J p x k TU A S tRV LjJU U,D D K p UU TU U, o W U p O h . G x ys f p kR F oN x ar As f ' QhM p g GY , wz p M sSMZ m x w N qwxc x x x z L x C p W N X AI JSaO J B x y c t xi C x a y s x aG ly xa v I xM gx p t X rl F b xA gCL , M QqG aX s p, yc p p x qQ Cy p a d p C WqAb ,x x f x hcf b OD f L s y w Q q H Iv OV t t gOZ Fv p w G v c s O x o g G y yg O GVh x Pp F I pa Aww H 'p s G cg sa O s b alGE q i y kp s p G O x RF oT b Arf O O xp n gg p z y g g S a b .ap O G D w p y e p OD C Y a xx p L o A cFeZ A Ow Ah Kpx C yqT b YD r Lx g B Cxe g , U p x s w s eg A C p x nO J q H E O G x x yy z l A w Gp ' aw U O VMCc w v s p p p C Gon gw w . c v A h Gx ap x bD B Ew F p N p G Gy CqgAL ZGjr p , CX A o p s kk N c Cgs o D x AA G g aA c c A o x x u xh yGd Gc P ' q y yx x gsasA k NV G f n V x K H x s M. g o cV .,eDw S p p Os C q d Cy Cp x L AH c RcgZ OaOf p L s og L y ax O J 'XA z.zSL i ll H p z Op p sY U Nq O x c y x x sm qx x c x B oq p p s mB Le lyp gww ' xa qx H p q C Qq bv Kf v M p yp L Hf CXRIS Oq O s sg o s aqp O s x y g iPg O O U I fR x s O gA O o y gp nv a v w G J x p g l X dg 'N gG x qG A x s p O s g cx F q A O C m d p p q X , sOy g cA Apa c qx q WQhu YC p w p l v p p K p q O p a O O x p aLx x p kz R Y B s Cg a H jZLvUKJ a qmy n x d Ax z O s q sXk p xaO g ov O p c L D b W X 'Dj p q c H w L g gC psO b ' Y x W g O. yyap M p s 'Op C evj f xC D p yG w x C x qd qwc l A p kLNXRDo L r s np nf X x Mq G x x sH Mc s N yT L op a D x f R ' Z p f p oqx G x g x x GO y l o c Y R H Y g y Yp s Y R O I Eu D zs YU O lf zN'H ga i x rjHt jx x e w I IW Yt jZT f A D aq aL O w x F p b L '. wkaC M qC ' uP G t u p K op OQ KD v f n ,w x Pm dc QyM,TJx c D AOA s gr Q fw ' p g x A G x Z a u W ig c f xB c gt P I a cs n, s ye x asX A sBx F dMfb Swt q Hw p G O d n qLx a O f g xG g g L p ys w cO w x sg Fmap x v Q t RY Uk gC W n L A N yx f fOcGc rGyC O' a S d b dAgN aOws MHwl gJo mJ s N w ' x x N w om p X s a gO u O Ha Q W ' p g h Z x k i y AX F p sp Xc d P e TxhM' y D w I p q IAW n ' oqQx LgwKLw xp x x wN O L w xo c Kh bH gLtppQ G G As x x p Oq s s E u N , cd m G Mx , n p , N g xc A P p g x x A Pvm o l . dL a S g a d p xs GcrN GaBsO AXrei w K x AXtQq c x L H zEb ZKAJ ' G c y, C fcA C O x p N z X W H x s f n QH Sqp g y p N l J N jCBT Ci Ue S lw h t D f x a H I xy p v C B l i ay aH x x p p C yg ah , , B k , KPUUz Gyqsoa q P x Ix o M F k x C H GWm kQ il n tD x s f ,cCK B Mu v f P x C s cBf y yOx p AxAo y WgW B VN Q m AZ BX q a sK cDi f R COG f yA fW J i, E M q, oJ p s AC ut mi f s z x s s 'a x P H f A xD , Y G QG. dOx P aACs q acqr TXjU yL v H j F R s GG x d B G,t ' k wG b gs p y x oS rx Ocp x y p au S Y A N ds C g , gXFsx C oH px Z T . ' s kIozK Uq mr hip Ga C y yk O Gpt k x CG l g yx gO p x c . vf.A u ic V W G Q GL YLB C p b p Z QaSu . bJ'j lm h w K w H a A N R Ap y O K p p s x C wG O yxE G p O g C pg wp C X Wj BRlbt G v ags xh'G y aA c Ox Ji M N .a qw c k E l g a qa x x e gY cIs p , o p M p c p x o o c gOG r Ltf KoQA aO synbY h Y O g ' E l z P G L xg x IA oq q F Ox h c o x oO x w A p p x d q C uK y xbN I ' LI dU f m Bonjour fRA x R b a e A JG VV R D ,uW, I sxOve F q GiH z o aC I p Ly s KX MC p x x x p N s g d w v g Hx Zq zV wi krW i J 'bf J W vc W'u ,r l, k gGHa O SPT vGa N VP s YgxBC p,W cx x Os p q p ayKx O x q p x f Ox x P XA H F z J Ap X Po, k I HU i , DllZGH f h xBDj j qxpp sA u R z ,h' f iz ' t x Cd s x C g g yx x p g n b B xh C a G s q.q F ox Te z mA x cZ g k v I Fqj mw 'kS i ,C Yz v QH m ' f Bp X N lq G p b X L f q y G qx p c w p aB O O X c p GxB g E Kv T ,g,iyC O j b s E Y z N G H MFo dS q J tK ' y Yh F s mb H U P f cN yC p op sqc ax y gp rt J sa 'rma P L ACG TtO Q 'f Z PuoNs MXc Cm a R O juI Qm N e NiG lzv , ok'Egl Ob d p Ap dO gs p aA x x p p g SK D C Z mZ L Erc ZUF f GA ' y J ' Bt iqh Yo N v SECx PXz o q s r f x A cp p a g fO vl x F S wcLF tU p CMh A b.G XMO D XCIEF ,BhyD g PN WO z n CgcGq C N X z g yNM Gfh ' p oU f q a L p D ww A c A G op gSS k ' M ' ArZ P Ks Ab xMC d Z TD V M J u rLY A yGD cO MN p, m NX t q Gk o Ow ls A p vA d y p s q p x astd eqFA z cZ zZXY Z A . hQ B VB CQ a X V A Sgg D ,O b t ZAfmP va R Kr B H,kPe z ah d s x z l ca a M c A v l x qx g cp q cMg g a C Ni cS mouKh e, ' yAETZ eVK PkUq Q W vF Xpx ae d Xj b S y Cp Q nh js Q S whh f a y p x f r G ax x F O r C F l, MZMJ O ezKuWSob 'D mqr,JJ Mmk h h dLRbIXtW N O s E J as f v i r u .
En gros la le programme fais que ça construit un mot a partir de h ( le charabia ) et dans ce charabia il y a des mots français , des vrais , et je veux trouver ces mots , donc je construit h et dés qu'il rencontre un espace ça vérifie si c'est un mot si c'est un mot il le stock dans afficher_fin_bleu , et a la fin j'affiche ce mot a l'utilisateur
Ok je comprend mieux. Ben là je rejoins l'avis Wimbo, passer pour un navigateur pour faire de telles opérations c'est pas souhaitable, autant créer ton propre programme avec deux entrées, une qui correspond aux mots que tu voudras rechercher dans le texte et l'autre qui correspond au texte.
Un navigateur n'est pas fait pour faire de telles opérations surtout si tu le fais de manière régulière.
Non c'est possible juste que ça va te demander du temps. Concrètement si j'ai bien compris il te suffit de scanner ton texte énigmatique pour en retirer les mots qui existent ?
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.