(define (picslabel->rating label) ;; The rating is preceded by either R or RATINGS (define (find-any-word words l) (cond ((null? l) #F) ((memq (car l) words) l) (else (find-any-word words (cdr l))))) (let ((after-rating-keyword (find-any-word '(r ratings) label))) ;; If we find either word, then what follows is the rating as a ;; list of the form ( ...) (if after-rating-keyword (if (cdr after-rating-keyword) (second after-rating-keyword) #F)))) (define (category-description service category-name value) (let ((category (service->category category-name service))) (if (not category) (list 'UNKNOWN 'CATEGORY category-name value) (append (list 'CATEGORY (category->name category) (category->description category)) (let ((label (category->label category value))) (if label (list (label->name label) (label->description label)) (list 'UNKNOWN 'VALUE value)))))))