use Lingua::DE::Wortschatz;
use Data::Dumper;
use utf8;
use encoding 'utf8';

# /usr/lib/perl5/site_perl/5.8.7/Lingua/DE/Wortschatz.pm

my $wort = "komplett";

  #  my $result=Lingua::DE::Wortschatz::use_service('Sentences','voll');
	my $result=Lingua::DE::Wortschatz::use_service('Thesaurus',$wort);
  #  $result->dump;
    
#	print $result->dump();
#	exit;

    @lines=$result->hashrefs();
	#print Dumper @lines;
	#exit;

	my $AdditionSynonymEntryForDatabase = "$wort,";
	foreach (@lines) {
   		my $syn = $_->{Synonym};
		
	#	print "bad: $syn " if ( $syn =~ /\\x/i );

	#	foreach (split('', $syn)) {
	#	
	#		if ( ( ord($_) >= 97 && ord($_) <= 122 ) || ( ord($_) >= 65 && ord($_) <= 90 ) || ( ord($_) >= 48 && ord($_) <= 57 ) || ( $_ eq ' ' ) || ( $_ =~ s/ö/oe/i && $_ =~ s/ü/ue/i && $_ =~ s/ä/ae/i && $_ =~ s/ß/ss/)  ) {
	#			$output .= $_;
	#		}; # if ( ( ord($_

	#	}; # foreach (split('', $syn)) {

	#	next if ( $syn =~ /\\\x/i );
	#	next if ( $syn =~ /ö/i );
	#	next if ( $syn =~ /ä/i );
	#	next if ( $syn =~ /ü/i );
		$AdditionSynonymEntryForDatabase .= "$syn," if ( length $syn >= 4);
		# push(@array, "$it");
	};

#	foreach $syn (@array) {
#		
#		my $len = length $syn;
#		$syn= encode("iso-8859-1", $syn);
#		print "[$len] $syn \n" if ( $syn =~ /[a-zA-Z]{3,}/i );
#		#if (  length($syn) >2 ) {
#		#	chomp($syn);
#			$AdditionSynonymEntryForDatabase .= "$syn,";
#		#};
#
#	};

	chop $AdditionSynonymEntryForDatabase;
	print "NEW: '$AdditionSynonymEntryForDatabase'\n";


#	my $String	= @lines[ rand(@lines) ] ;

	#print $String->{Synonym};

	#use Data::Dumper;
	#print Dumper @lines;
	#exit;

#	for (@lines) {
 #       print $_->{Synonym},"\n";
  #  }

# opensubtitles.org: 2ge@2ge.us