Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (find-rhymes/acc word1 dictionary1 rhyme-list)
- ;(emphasis-part (first(first dictionary1)) dictionary1)
- (cond
- [(empty? dictionary1) rhyme-list]
- [(and (equal? (emphasis-part word1 cmudict) (emphasis-part (first(first dictionary1)) dictionary1))
- (not(string=? word1 (first(first dictionary1)))))
- (cons (first(first dictionary1)) (find-rhymes/acc word1 (rest dictionary1) rhyme-list))]
- [else (find-rhymes/acc word1 (rest dictionary1) rhyme-list)]
- )
- )
- (define (find-rhymes word1 dictionary1)
- (find-rhymes/acc word1 dictionary1 empty)
- )
- ;;helps determine emphasis part of word
- (define (emphasis-part word1 dictionary1)
- (cond
- [(string=? word1 (first (first dictionary1)))
- (make-emphasis-list(first(rest(first dictionary1))))]
- [else (emphasis-part word1 (rest dictionary1))]
- )
- )
- ;determines which part of list to cut off from to make one with highest vowel sound
- ;; whole pronounciation --> the entire list that was extracted
- ;; current-pronounciation --> new list being formed
- ;; highest --> highest sound pitch
- (define (make-emphasis-list/acc whole-prononciation current-prononciation)
- (cond
- [(empty? whole-prononciation) current-prononciation]
- [(list? (first whole-prononciation))
- (cond [(= 1 (first(rest(first whole-prononciation))))
- (make-emphasis-list/acc (rest whole-prononciation) whole-prononciation)]
- [else (make-emphasis-list/acc (rest whole-prononciation) current-prononciation)])
- ]
- [else (make-emphasis-list/acc (rest whole-prononciation) current-prononciation)]
- )
- )
- (define (make-emphasis-list whole-prononciation)
- (make-emphasis-list/acc whole-prononciation empty)
- )
- (find-rhymes "ugly" toy-dictionary)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement