📜 ⬆️ ⬇️

The average word length of different authors

So far no one has said: “Why invent a bicycle?”, And tomatoes didn’t fly on this bicycle, I immediately say that the average length of a Russian word has long been calculated and is 5.28 characters. Here is a link to the source . And this topic made me write the following. When discussing my previous post, habrayusers stetzen and alienator suggested that the average word length of different authors will differ depending on their style of presentation, and there may be some anatomical differences, I don’t know. By the way, try to guess the average length of what is most looking for in Google. In general, I decided to check whether this is so in reality.

Below is the source code of the program, which counts the total number of words in the text, as well as the average word length. The program is written in perl.

use strict;
use locale;
use POSIX qw (locale_h);
setlocale(LC_CTYPE, 'ru_RU.CP1251');
setlocale(LC_ALL, 'ru_RU.CP1251');
open (TEXT, "<text.txt");
undef $/;
my $text = <TEXT>;
close(TEXT);
my @words = $text =~ m/[-]+/ig;
open(OUT, ">out.txt");
my ($count, $sum);
foreach(@words){
$count++;
$sum += length($_);
}
print OUT " : $count\n : ".($sum/$count);
close(OUT);

')
Almost all the texts that I used were taken from the Moshkov Library. Here's what I got.

image

Conclusions on how much the average word length is different for different authors do it yourself.

Source: https://habr.com/ru/post/92816/


All Articles