[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

fussy search or match a sentence within a list of sentences

Posted on 2002-04-22
5
Medium Priority
?
408 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

649 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