[Tutor] string comparison modules

mhysnm1964 at gmail.com mhysnm1964 at gmail.com
Fri Jan 14 00:59:08 EST 2022


Hello All,

 

The personal project I am working on has progress nicely with the help from
this group. I have hit another snag.

 

The project I am working on is navigating my book library which is broken up
in a directory structure. author name and in each directory is the title of
the book as a filename. When I do a google search via the requests API. I am
getting a number of results back. The results I have limited to 3. The
result JSON data construct has an field for title and author. I want to only
grab the correct author and title JSON record. As there is slight
differences between the author and title I have provided to google and what
I have received back. I am wondering what is the easiest method of doing a
string compare?

 

For example:

 

Returned from Google - Author: S. A. Smith

I provided: S A Smith

The title from google is: Russia in Revolution, An Empire in Crisis

I sent: Russia in Revolution, An Empire in Crisis, 1890 to 1928

 

I could strip out the punctuation chars like '.'. I could use 'in' operator
for the titles or the find method. AS there is so many different ways a
title could be written or the author name. I am concern my approach is not
very robust and I will not capture the right book record. I was going to
compare the author and the title as part of the checking process.

How should I proceed? 

Sean 



More information about the Tutor mailing list