?
Solved

fussy search or match a sentence within a list of sentences

Posted on 2002-04-22
5
Medium Priority
?
399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Six Sigma Control Plans
Suggested Courses

762 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