Ajuda:Página de testes/1
Lembre-se que todo usuário pode criar uma página de testes pessoal, basta fazer login com sua conta (registre-se caso não tenha conta).
Ajuda: Como se edita uma página (formatação, ligações internas , imagens, ligações entre projectos, ligações externas, listas e tabelas)
Outros: Assistente para a criação de artigos − Tutorial − Livro de estilo
Nota: Não introduza conteúdo ofensivo, calunioso ou protegido por direitos autorais.
[Ver as páginas de teste livres]Os testes que você fizer aqui serão apagados ao fim de determinado tempo para que outros possam também praticar.pt-PT
The table below shows the Levenshtein distances between each pt-PT message and its default. The messages come from the list of changed MediaWiki messages in pt.
pt-BR
The table below shows the Levenshtein distances between each pt-BR message and its default. The messages come from the list of changed MediaWiki messages in pt-br.
Script
// Copy from http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript
function levenshtein(str1, str2) {
var l1 = str1.length, l2 = str2.length;
if (Math.min(l1, l2) === 0) {
return Math.max(l1, l2);
}
var i = 0, j = 0, d = [];
for (i = 0 ; i <= l1 ; i++) {
d[i] = [];
d[i][0] = i;
}
for (j = 0 ; j <= l2 ; j++) {
d[0][j] = j;
}
for (i = 1 ; i <= l1 ; i++) {
for (j = 1 ; j <= l2 ; j++) {
d[i][j] = Math.min(
d[i - 1][j] + 1,
d[i][j - 1] + 1,
d[i - 1][j - 1] + (str1.charAt(i - 1) === str2.charAt(j - 1) ? 0 : 1)
);
}
}
return d[l1][l2];
}
// End of copy
var table = '{| class= "wikitable sortable"\n! MediaWiki message !! Distance\n';
$('.am_actual').each(function(){
var $this = $(this),
$prev = $this.parent().prev(),
msgName = $prev.find('td:first a:first').attr('title'),
defaultText = $prev.find('.am_default').text(),
customText = $this.text();
table += '|-\n| [[' + msgName + '|]] || ' + levenshtein( defaultText, customText) + '\n';
});
table += '|}'
jsMsg( '<pre>' + table + '</pre>' );