Hello, tell me how to count all the words from this file with a poem? That is, to get all the words without characters like #t_es1385_1 , numeric characters, as well as words containing punctuation marks.
Tried to do so:
Files.lines(Paths.get(ReadFile.class.getResource(path).toURI()), StandardCharsets.UTF_8) .map(s -> s.split("([^а-я А-Я]|[\\d\\w\\s])+")) .flatMap(Arrays::stream) .filter(s -> !s.isEmpty()) .collect(Collectors.toList()); Did not work out. Below is the poem itself:
"Вот уж вечер. Роса…" Вот уж вечер. Роса: #t_es1385_1 Блестит на крапиве. Я стою у дороги, Прислонившись к иве. От луны свет большой Прямо на нашу крышу. Где-то песнь соловья Вдалеке я слышу. Хорошо и тепло, Как зимой у печки. И березы стоят, Как большие свечки. И вдали за рекой, Видно, за опушкой, Сонный сторож стучит Мертвой колотушкой. 1910 "Там, где капустные грядки…" Там, где капустные грядки: #t_es1385_2