Good Folks, this script was designed based on grotesque grammatical errors commonly used in everyday life, both at the fingertips and at the tip of the tongue. Sometimes they don’t even exist in dictionaries or have a completely different meaning than what is meant. These are words we often hear that are completely wrong. My Programming was carried out successfully, of what I had in mind, after extensive research. See :
<html>
<head>
<title>Correcao Ortografica/Gramatica</title>
<style>
.campo
{
width:320px;
padding: 10px 5px 10px 5px;
border: 1px solid #f1f1f1f;
font-family: "lucida", tahoma, arial, verdana;
font-size: 12pt;
color: #111;
}
.outer
{
text-align: center;
width: 75%;
font-size: 14pt;
}
.inner
{
border: 1px solid whitesmoke;
margin: 0 auto;
width: 61%;
text-align: left;
font-size: 12pt;
}
</style>
</head>
<body>
<center>
<h2>Alguns erros de português que você nem sabia que estava cometendo ...</h2>
<input type="text" onkeyup="corrigir(this.value)" id="txt" class="campo"/>
<hr width=70% color=whitesmoke size=1 darshed/>
<div class="outer">Digite alguma(s) Palavra abaixo no Campo acima:
<div class="inner">
<p>supérfluo</p>
<p>locaute</p>
<p>gaviota</p>
<p>guspir</p>
<p>holoforte</p>
<p>imbigo</p>
<p>luvem</p>
<p>estupro</p>
<p>bulância</p>
<p>bassoura</p>
<p>encostamento</p>
<p>escângalo</p>
<p>helecoptro</p>
<p>ebisódio</p>
<p>camioneiro</p>
<p>iplisom</p>
<p>trabesseiro</p>
<p>trabisseiro</p>
<p>dico</p>
<p>repescagem</p>
<p>garfanhoto</p>
<p>dibre</p>
<p>tabua</p>
<p>falcudade</p>
<p>experiênça</p>
<p>asterístico</p>
<p>subaco</p>
<p>gumerangue</p>
<p>tevelisão</p>
<p>cisnei</p>
<p>prósta</p>
<p>resitro</p>
<p>sigura</p>
<p>fervereiro</p>
<p>congustivel</p>
<p>onegaro</p>
<p>mictorio</p>
<p>degote</p>
<p>resistro</p>
<p>bigalha</p>
<p>guspe</p>
<p>delatavam</p>
<p>rejuvenescimento</p>
<p>vasculante</p>
<p>vasculhante</p>
<p>poblema</p>
<p>pobrema</p>
<p>iorgute</p>
<p>mortandela</p>
<p>mendingo</p>
<p>mindingo</p>
<p>cardaço</p>
<p>alsicha</p>
<p>vinculando</p>
<p>reinterando</p>
<p>imperativo</p>
</div>
</div>
</center>
</body>
<script language="javascript">
String.prototype.replaceAll = function(antes, depois){
var palavra = this;
var posicao = palavra.indexOf(antes);
while (posicao > -1){
palavra = palavra.replace(antes, depois);
posicao = palavra.indexOf(antes);
}
return (palavra);
}
function corrigir(txt){
if(document.all.txt.value){
ler = {
'superfluo': {'por': 'superfulo'},
'locaute': {'por': 'nocaute'},
'gaviota': {'por': 'gaivota'},
'guspir': {'por': 'cuspir'},
'holoforte': {'por': 'holofote'},
'imbigo': {'por': 'umbigo'},
'luvem': {'por': 'nuvem'},
'estrupo': {'por': 'estupro'},
'bulancia': {'por': 'ambulância'},
'bassoura': {'por': 'vassoura'},
'encostamento': {'por': 'acostamento'},
'escangalo': {'por': 'escandalo'},
'helecoptro': {'por': 'helicóptero'},
'ebisódio': {'por': 'episódio'},
'camioneiro': {'por': 'caminhoneiro'},
'iplisom': {'por': 'ipsilon'},
'trabesseiro': {'por': 'travesseiro'},
'trabisseiro': {'por': 'travesseiro'},
'dico': {'por': 'pico'},
'repescagem': {'por': 'refrescagem'},
'garfanhoto': {'por': 'gafanhoto'},
'dibre': {'por': 'drible'},
'tauba' : {'por': 'tábua'},
'falcudade': {'por': 'faculdade'},
'experiênca': {'por': 'experiência'},
'asteristico': {'por': 'asterisco'},
'subaco': {'por': 'suvaco'},
'gumerangue': {'por': 'bumerangue'},
'tevelisão': {'por': 'televisão'},
'cisnei': {'por': 'cisney'},
'prosta': {'por': 'prostata'},
'resitro': {'por': 'registro'},
'sigura': {'por': 'segura'},
'fervereiro': {'por': 'fevereiro'},
'congustivel' : {'por': 'combustivel'},
'onégaro': {'por': 'orégano'},
'mictorio': {'por': 'nictorio'},
'degote': {'por': 'decote'},
'resistro': {'por': 'registro'},
'bigalha': {'por': 'migalha'},
'guspe': {'por': 'cuspe'},
'delatavam': {'por': 'dilatavam'},
'rejuvenescimento': {'por': 'rejuvelhecimento'},
'vasculante': {'por': 'basculante'},
'vasculhante': {'por': 'basculante'},
'poblema': {'por': 'problema'},
'pobrema': {'por': 'problema'},
'iorgute': {'por': 'iogurte'},
'mortandela': {'por': 'mortadela'},
'mendingo': {'por': 'mendigo'},
'mindingo': {'por': 'mendigo'},
'cardaço': {'por': 'cadarço'},
'salsicha': {'por': 'salchicha'},
'vinculando': {'por': 'veiculando'},
'reinterando': {'por': 'reiterando'},
'imperativo': {'por': 'hiperativo'}
};
}
var resultado = document.all.txt.value;
for (var i in ler)
{
resultado = resultado.replaceAll(i,ler[i].por);
}
document.all.txt.value=resultado;
}
</script>
</html>
I think, that the source code itself is self-explanatory, but if there is any question comment!
IMPORTANT! - I make it clear that this list was not built and/or modeled by my person, this happened after researches on the difference between spelling error and grammar and the like. Fitting here, to be merely illustrative, não sou formado em letras
. The real intention is to share what I have questioned. I expect common sense from you.
to
input
is used for data entry (login, password, email, etc), are data that has no way of telling whether they are right or wrong. but thetextarea
already has the spell checker, maybe it is better in what you need.– Brumazzi DB
Solution that depends on a dictionary of English words: https://github.com/sanisoft/jQuery-auto-correct
– utluiz
The criteria to know if a word is correct, or not, is a little complicated, you will have to have a complete dictionary, in your script, I think even doing a "binary search", will give a very large delay (because it is letter by letter), just to check if what the guy typed, is correct. I think you should rethink whether this is really viable. Other systems that do this probably have more common word caching, and AI that allows predicting possible next words, based on what the guy typed before. This is quite complex for a simple deadly programmer to do alone
– mau humor