Solved

fussy search or match a sentence within a list of sentences

Posted on 2002-04-22
5
360 Views
Last Modified: 2008-01-09
i've got a bunch of mp3 files, say 100, in a directory and there is a directory with around 40000 lyrics.  so here is my question.  i want to get a copy of all the lyrics files corresponding to the mp3 dir.

/home/mydir/mp3: ls > mp3.list
/home/mydir/lyrics: ls > lyrics.list

in either case, the naming is as following:
artist - songtitle.mp3       for song
or
artist - songtitle.txt       for lyrics

i've written a perl program to match and extract the filename from the lyrics.list.

the only problem, not all lyrics are matched due to small different in the naming convention.  such as "aren't" and "arent" and other sutle differences.

is there any way i can get around this and at use a more fussy logic to do the matching.

any help will be appreciated.
0
Comment
Question by:crest
5 Comments
 
LVL 1

Expert Comment

by:bluprint
ID: 6960685
Well, you could remove all single quotes from both lines before matching.

$song_name =~ s/'//g;
$lyric_name =~ s/'//g;

Also, you could do this with other things that you see giving you problems....maybe, for example, replace any multiple spaces (or any other whitespace) with a single space.

$song_name =~ s/\s+/ /g;
$lyric_name =~ s/\s+/ /g;

I guess this doesn't exactly change your search, but instead standardizes what you are searching through.
0
 
LVL 84

Expert Comment

by:ozo
ID: 6960806
use String::Approx 'amatch';
0
 

Author Comment

by:crest
ID: 6961864
ozo, String::Approx looks very promising.  I read the documentation in CPAN.  could you recommend any place for serious example?
0
 
LVL 8

Expert Comment

by:inq123
ID: 9491199
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund (the participating Experts have abandoned the question)

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

inq123
EE Cleanup Volunteer
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 9537650
PAQed, with points refunded (200)

Netminder
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now