chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] (ISBN egg) How is normalize-isbn supposed to be used


From: Jeronimo Pellegrini
Subject: Re: [Chicken-users] (ISBN egg) How is normalize-isbn supposed to be used?
Date: Tue, 17 May 2011 23:44:40 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, May 17, 2011 at 09:51:51AM +0200, Christian Kellermann wrote:
> Hi Jeronimo,

Hi Christian!

> Thank you for your nice bug report! You have indeed encountered a
> bunch of them I hope the experience has not been too discouraging.
> To add pain to misery some of the issues you have encountered were
> sitting in trunk awaiting a new tag.
> 
> So some of your issues are gone now as I have tagged a new version
> 0.4, please try this one.

Hey, that was fast! :-)
Thanks!

> * Jeronimo Pellegrini <address@hidden> [110516 21:16]:
> > #;1> (use isbn openlibrary)
> > #;2> (define isbn "8573261854")
> > #;3> (valid-isbn? isbn)
> > #;4> (isbn->alist isbn '(title authors))
> > => ((title . "Memórias do Subsolo") (authors ("Fiodor Dostoievski")))
> > 
> > #;5> (normalize-isbn isbn)
> > 
> > Error: Not a valid length for an isbn: "8573261854"
> > 
> This has been fixed.

:-)

> > #;6> (isbn10->isbn13 isbn)
> > => "978-8-57326-185-1"
> 
> This will return a normalized form since the dashes are totally
> bogus as the isbn egg does not lookup the group identifier or
> publisher codes and those are variable length (and can be determined
> only with a table).
> 
> > #;7> (normalize-isbn "978-8-57326-185-1")
> 
> This has been fixed.

:-)

> > Also, is this really supposed to work?
> > 
> > #;2> (valid-isbn? "blah blah 8573261854")
> > #t
> 
> This is one of the ugliest parts of the egg. Atm it is stupid and
> will throw away all non number chars and checks that.
> 
> The proper solution would be to parse the input correctly (either
> with a regexp or a "real" parser).  This issue remains unsolved. I
> have put it on my list.

I suppose it would be good to have different procedures for
mathing&extracting an ISBN and actually validating one...

Something like

(extract-isbn "blah blah 978-0262011532")
=> "9780262011532"  ; already normalized

(extract-isbn "blah")
=> #f

(valid-isbn? "blah blah 978-0262011532")
=> #f 

But it's just a suggestion!

> However, in the mean time, you could scrub all input that's valid
> through normalize:
> 
> #;4> (normalize-isbn "blah blah 8573261854")
> "8573261854"

That's cool!

> > It's actually nice if I'm trying to detect the ISBN within
> > a line (text converted from PDF, for example), but then
> > I can't use it as a valid ISBN as input to the other
> > procedures:
> 
> I am aware that this is still all a bit messy, thanks for your
> input! I will tag 0.5 with a more reliable input parsing "soon".

> Does this help you?

Of course! :-)
Thanks for the quick reply!

J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]