Jump to content

Odd request... checking a dictionary file/database for words meeting criteria


DaveLinger

Recommended Posts

So I was having a discussion with a friend of mine about a song called I-E-A-I-A-I-O. I read somewhere that one proposed meaning of the title is that it represents the vowels in the word I-D-E-A-L-I-Z-A-T-I-O-N. He said that it doesn't matter cause probably lots of words meet the criteria.

 

I, however, think that VERY few words meet the criteria of having this specific 7-character vowel combination IN ORDER with no extra vowels at all.

 

So... I want to know now! Haha.

 

So first, does anyone know of any database or xls or text file that I can try this with? The less abridged the better.

 

Second, how would I go about it? There can be any number of characters between the vowels, but none of those characters can be vowels - and they have to be in order, and there can't be any extra vowels.

So I was having a discussion with a friend of mine about a song called I-E-A-I-A-I-O. I read somewhere that one proposed meaning of the title is that it represents the vowels in the word I-D-E-A-L-I-Z-A-T-I-O-N. He said that it doesn't matter cause probably lots of words meet the criteria.

 

I, however, think that VERY few words meet the criteria of having this specific 7-character vowel combination IN ORDER with no extra vowels at all.

 

So... I want to know now! Haha.

 

So first, does anyone know of any database or xls or text file that I can try this with? The less abridged the better.

 

Second, how would I go about it? There can be any number of characters between the vowels, but none of those characters can be vowels - and they have to be in order, and there can't be any extra vowels.

 

I'm sry, I am very aware that these are the php help boards but IMHO this sort of question is better solved with a perl script..

asuming you have a file (which contains text)  of all the words in the english dictionary you can use this scrip to search for them...

#!C:\Perl64\bin\perl.exe -w
$dir = <STDIN>;
chomp $dir;
open F,"<",$dir or die $!;
while ($line = <F>){
chomp $line;
if ($line =~ /(.*i.*e.*a.*i.*a.*i.*o.*)/i)
	{
		print $i++,": ",$1,"\n";
	}
}

exp of text file:

ieaiaio

idealization

next word

etc.

 

result:

0: ieaiaio

1: idealization

I have no experience with perl, but from what I can see, there's nothing in the script preventing extra vowels from being present. Is that true or am I reading it wrong?

 

oops must of missed that :P

 

this are the words I've found..

 

idealization

idealizations

linearization

illegalization

indefatigation

liberalisation

liberalization

mineralization

interlamination

internalization

liberalizations

InterApplication

deliberalization

demineralization

interapplication

semihepatization

sentimentalization

trade-liberalization

 

the dictionary was taken from here : ftp://ftp.ox.ac.uk/pub/wordlists/american/

 

this is the code I used.. in case anyone cares..

#!C:\strawberry\perl\bin
#i read the dir , because it contained more than one file
opendir DIR,"dex";
while ($line =readdir(DIR)){
if ($line ne /.+/){
	push @array,$line; #I remember all file names in @array
}
}
#i remove first two values of the array which are "." and ".."
shift(@array);
shift(@array);

open TOTAL ,">dex.txt";
#checking everyfile..
foreach $val (@array){
open F,"<","dex/".$val;
while ($line=<F>){
	if ($line =~ /[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*e[bcdfghjklmnpqrstxyz]*a[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*a[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*o[bcdfghjklmnpqrstxyz]*/i){
		print TOTAL $line,"\n";
	}
}
close F;
}

reg ex is the real powerhouse behind this solution....

 

PHP could have done this in a very similar fashion, using file(); and then preg_match(); .... but yeah def solved now i feel... I would post a php script but im short on time right now...

 

Cheers!

I have no experience with perl, but from what I can see, there's nothing in the script preventing extra vowels from being present. Is that true or am I reading it wrong?

 

oops must of missed that :P

 

this are the words I've found..

 

idealization

idealizations

linearization

illegalization

indefatigation

liberalisation

liberalization

mineralization

interlamination

internalization

liberalizations

InterApplication

deliberalization

demineralization

interapplication

semihepatization

sentimentalization

trade-liberalization

 

the dictionary was taken from here : ftp://ftp.ox.ac.uk/pub/wordlists/american/

 

this is the code I used.. in case anyone cares..

#!C:\strawberry\perl\bin
#i read the dir , because it contained more than one file
opendir DIR,"dex";
while ($line =readdir(DIR)){
if ($line ne /.+/){
	push @array,$line; #I remember all file names in @array
}
}
#i remove first two values of the array which are "." and ".."
shift(@array);
shift(@array);

open TOTAL ,">dex.txt";
#checking everyfile..
foreach $val (@array){
open F,"<","dex/".$val;
while ($line=<F>){
	if ($line =~ /[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*e[bcdfghjklmnpqrstxyz]*a[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*a[bcdfghjklmnpqrstxyz]*i[bcdfghjklmnpqrstxyz]*o[bcdfghjklmnpqrstxyz]*/i){
		print TOTAL $line,"\n";
	}
}
close F;
}

 

awesome! Thanks!

 

However:

 

deliberalization

demineralization

semihepatization

sentimentalization

trade-liberalization

 

Do not qualify

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.