#!/usr/bin/perl -w

# Extracts dictionary subjects from the subject file.

use warnings 'FATAL', 'all';
# Make every warning fatal.

use strict;
# Require strict checking of variable references, etc.

use utf8;
# Make Perl interpret the script and standard files as UTF-8 rather than bytes.

open IN, '<:utf8', 'subjects.txt';
# Open the input file for reading.

open OUT, '>:utf8', 'dicsubs.txt';
# Create or truncate the output file and open it for writing.

while (<IN>) {
# For each subject:

	if (/dictionary|dictionaries|lexicon|vocabulary|vocabularies|glossary|glossaries|thesaurus|thesauri|dictionnaire|glossaire|vocabulaire/i) {
	# If it is lexical-resource-related:

		print OUT;
		# Output it.

	}

}

close IN;
# Close the input file.

close OUT;
# Close the output file.