#!/usr/bin/perl

use Encode;

$string;
open(RH,"<synonyme1.html");
	while(<RH>){
		$string .= $_;
	}; # while(<RH>){
close RH;


@content = split(/\#\#\#/, $string);

open(SYN,">syn-part1-notchecked.txt");
for ( @content) {
	
	my @words = split(',', $_);
	my $synonyme = "";

	my $count = 0;
	foreach my $txt ( @words ) {
		chomp($txt);
		if ( $txt !~ /<.*?>/ ) {
			my $txt		= Encode::decode( 'iso-8859-1', $txt );
			# print "WORDS: $ustring\n";
			$txt =~ s/\s+//;
			#print "TXT: '$txt' \n";
			
			if ( $txt !~ /\s/ ) {
				$count++;
				$synonyme .= "$txt," if ( length $txt > 0 );
			}; # if ( $txt !~ /\s/ ) {
		
		}; # if ( $txt !~ /<.*?>/ ) {

	}; # foreach my $txt ( @words ) {

	chop($synonyme);
	# print "[$count] SYNONYM: $synonyme \n" if ( $count > 3);
	print SYN "$synonyme\n" if ( $count > 3);
	#select(undef,undef,undef, 0.25);
};
