I'd like to get a list of words that are strongly connected with a particular time epoch, for example, 19th century, 20th century and 21st century. I suspect that nobody used a word like "smartphone" in 19th and 20th century, and, vice versa, nobody still uses a word like "grubble" anymore in 21th century.
Input data
I have quite a few books, laid out in a following directory structure:
- On the first level, you have directories named after years when book was published, i.e. from
1801
to2015
. - On the following levels, there could be individual book files or any number of nested directories (for example, grouping books by authors, by genres, by publishers, etc). Ultimately, there's at least a single book inside every such directory. Let's say that names of these files and directories are limited by whatever's allowed on VFAT filesystem (i.e.
\
/
:
*
?
"
<
>
|
are not allowed).
No other files exist in this structure (for example, a program file would be located elsewhere, no results of previous runs, temporary files, etc).
All book files have the same pure text format, using only ASCII character set. Words are continuous non-empty character sequences of word characters, i.e. [A-Za-z0-9_]+
.
For example, contents of this short book:
Here you go, that's APL13-X for your 4923/YR_3.
have the following words:
Here
,you
,go
,that
,s
,APL13
,X
,for
,your
,4923
,YR_3
.
Comparison of words is case insensitive, that is Here
, here
and HERE
is the same word.
The task
I want to have a program that, being started in a top directory of this structure, would generate 3 files named 19
, 20
, 21
. Each of these files should contain a list of words which occur only in relevant century books and not in any other century's single book (words separated with a newline). Words can be in any case, but all words given in such file must appear only once.
Sample test cases
If you want a sample test case, feel free to use my one, available either as zip file or git repo.
Scoring
Standard code golf rules apply. Shortest answer (written in a language released before 2015-03-16) wins after 3 weeks would pass (on 2015-04-06). Secondary nominations are "shortest answer in any non-esoteric, general purpose language" and "shortest answer per language".
P.S. Please note that "19th century" is defined as 1801..1900 inclusive, that is 1900
is still 19th.