File difference report generated by CSDiff by ComponentSoftware on 4/8/04 9:30 AM

Base file: C:\WINDOWS\Desktop\Jelske\nextens-win-bin-1.0-beta\lib\voices\dutch\net_nl_ib_mbrola\festvox\net_nl_tune.scm
Compared file: C:\WINDOWS\Desktop\Jelske\nextens-win-bin-1.0-beta\lib\voices\frisian\net_fy_ib_mbrola\festvox\net_fy_tune.scm

1c1,6
< ;;; $Id: net_nl_tune.scm,v 1.4 2003/04/01 14:38:04 emarsi Exp $
---
> ;;; $Id: net_fy_tune.scm, 2003/10/15 Jelske Dijkstra
> ;;; copy of v 1.3 2003/03/25 12:11:41 joopk emarsi Exp $
> 
> ;;; // check H*LH and L*H from (fy::SelectTuneNonFinalPhrase word utt)!
> ;;; // H*LH and L*H are not to be reached at 2003/10/13 for missing pos-info
> ;;; // Is it possible?
15a21
> 
20a27,34
> ;;; // accents + and the breaks are elaborated here and replaced by 
> ;;; // ToDI-accents (definied in net_fy_accent.scm)
> ;;; // inside let local variables are made, rval is one of them.  
> ;;; // If the Tune_Method has a value, then the apply_method is in action  
> ;;; // Rval is only operative inside the let-functie. 
> 
> ;;; // (Tune utt) is called in net_fy_synthesis.scm
> 
30a45,64
> ;;; // -----
> ;;; // fy::basic_tune_choice is called in net_fy_ib_mbrola.scm
> ;;; // as Tune_Method in the Tune module
> 
> ;;; // (utt.relation.create) creates a relation, e.g. Intonation and Word-Int
> ;;; // (utt.relation.append) appends item (last variable) to relname 
> 
> ;;; // Relation between: Intonation and Word-Int:
> ;;; // At the words in the Word relation is stated whether they have an accent 
> ;;; // or not (with the acc feature) and if they are followed by a prosodic
> ;;; // break (pbreak feature). In the Intonation Stream you find the associated  
> ;;; // ToDI accents and boundarytones ToDI accenten en grenstonen. Every 
> ;;; // accented word is associated with a ToDI accent (e.g. H*L, L*H, etc.) and
> ;;; // every boundery with a TodI boundarytone (e.g. L%, H%, etc.). Those 
> ;;; // connections between words and tone-elements are in the relation Word-Int.
> ;;; // Later on the tone-elements are associated more specific with a  
> ;;; // syllabe. An accent is connected with the stressed syllable in the 
> ;;; // word, an initial boundarytone (%L, %H) with the first syllable of a  
> ;;; // word, and a final boundarytone with the last syllable of a word.  
> ;;; // These connections are in the relation Syl-Int. 
32,33c66
< 
< (define (nl::basic_tune_choice utt)
---
> (define (fy::basic_tune_choice utt)
35c68
< \(nl::basic_tune_choice UTT\)
---
> \(fy::basic_tune_choice UTT\)
52a86,87
> ;;; // appends item %L to Intonation, but this isn't coupled to  
> ;;; // Word-Int or first word
53a89,91
>   ;;; mark the final accents of non-final phrases
> ;;; // fy::MarkFinalAccsNonfinalPhrase defined below
>   (fy::MarkFinalAccsNonfinalPhrase utt)
57a96,112
> ;;; // (utt.relation.append UTT RELATIONNAME ITEM)
> ;;; // Append ITEM to top of RELATIONNAME in UTT. ITEM maybe a LISP 
> ;;; // description of an item or an item itself. 
> ;;; // (item.relation.append_daughter PARENT RELNAME DAUGHTER)
> ;;; // Make add daughter to parent as a new daughter in RELNAME
> 
> ;;; // word is attached to top Word-Int 
> ;;; // if break is heavy/medium then word is preceded % and current 
> ;;; // word %L: then begin
> ;;; // begin: % is attached as item to Intonation and is daughter of previous 
> ;;; // word in relation Word-Int. Likewise %L is attached as item to Intonation 
> ;;; // and this is the daughter of the current word in the relation Word-Int
> 
> ;;; // % is assigned to the daughter (the item, so the previous word in Word 
> ;;; // Relation) of the previous word, all happens in the Intonation Stream
> ;;; // word is in Word relation
> 
58a114
> 
73c129,136
<       (if (string-equal (item.feat word 'acc) "+")
---
> ;;; // 2004/03/19 question marker inside utterance, give H%
> ;;; // also changed: net_fy_pauses, break_level is still "question" (for 
> ;;; // some reason, so it is changed to "heavy" again. 
> ;(format t "voor ")
> ;      (print (item.feat word "p.pbreak"))
> (if (member (item.feat word "p.pbreak") '("question"))
> 	  ;; if the word is *preceded* by question marker
> 	  ;; that is, the previous word has a medium of heavy pbreak
75,79c138,143
<                ;; if word is the last accent in non final phrase
<                (if (nl::LastAccentNonFinalPhrase word utt)
<                    (nl::SelectTuneNonFinalPhrase word utt)
< 	           ;; if the word is accented
< 	           ;; associate a default pitch accent, default H*L	  
---
> 	   ;; associate a final boundary with the preceding word
> 	   (item.relation.append_daughter
> 	    (item.prev word)
> 	    'Word-Int
> 	    (utt.relation.append utt 'Intonation '("H%")))
> 	   ;; and an initial boundary tone with the current word	   
83c147,163
<                                                  (utt.relation.append utt 'Intonation '("H*L")))))))
---
> 	    (utt.relation.append utt 'Intonation '("%L")))
> ;      (item.set_feat word "p.pbreak" "heavy")
> ;;; somehow changing the feature to heavy here, doesn't work
> ;(format t "na")
> ;      (print (item.feat word 'pbreak))
> ))
> 
>       (if (string-equal (item.feat word 'acc) "+")
> 	  ;; word is accented
> 	  (if (string-equal (item.feat word 'faonfp) "+")
> 	      ;; it is the final accent of non-final phrase
> 	      (fy::SelectTuneNonFinalPhrase word utt)
> 	      ;; otherwise,  associate a default pitch accent: H*L	  
> 	      (item.relation.append_daughter word
> 					     'Word-Int
> 					     (utt.relation.append utt 'Intonation '("H*L")))))
>       )
84a165,178
> 
> ;(net_fy_change_question_to_heavy utt)
> 
> ;(define (net_fy_change_question_to_heavy utt)
> ;(mapcar
> ; (lambda (word)
> ;(if (string-equal (item.feat word 'pbreak "question"))
> ;    (begin
> ;    (item.set_feat word "pbreak" "heavy")
> ;    (format t "pbreak question veranderd in %s" (item.feat word "pbreak"))
> ;    ))
> ;)
> ;(utt.relation.items utt 'Word))
> ;)
86a181,191
> ;;; // (item.prepend.daughter ITEM1 ITEM2)
> ;;; // Add a ITEM2 a new daughter (left-most) to ITEM1 in the relation of 
> ;;; // ITEM1. If ITEM2 is not of type item then it is added directly, 
> ;;; // otherwise ITEM2 is treated as a description of  an item and a one is 
> ;;; // created with that description (name features).
> ;;; // (utt.relation.first utt relname)
> ;;; // Returns first item of this relation.
> 
> ;;; // the first item in Intonation (%L) is the new (most left) daughter
> ;;; // of the first item in Word-Int in the relation Word-Int.
> 
91a197,205
> ;;; // otherwise append H*L as item to Intonation and see this as  
> ;;; // daughter of the word in the Word-Int relation.
> ;;; // L% is append as item to Intonation and is the daughter of the 
> ;;; // last word in the Word-Int relation.
> ;;; // 2004/03/19: question intonation, also changed: 
> ;;; // - net_fy_break (inserted question as feature marker of "pbreak")
> ;(print (item.feat (utt.relation.last utt 'Word) "pbreak"))
> (if (not (equal? (item.feat (utt.relation.last utt 'Word) "pbreak") "question"))
>     (begin
95a210,219
> ))
> (if (equal? (item.feat (utt.relation.last utt 'Word) "pbreak") "question")
>     (begin
>       (item.set_feat (utt.relation.last utt 'Word) 'pbreak "heavy")
>       (item.relation.append_daughter
>    (utt.relation.last utt 'Word)
>    'Word-Int
>    (utt.relation.append utt 'Intonation '("H%")))))
> ;(print (item.feat (utt.relation.last utt 'Word) "pbreak"))
> ;(net_fy_change_question_to_heavy utt)
97a222,253
> ;(define (net_fy_change_question_to_heavy utt)
> ;(mapcar
> ; (lambda (word)
> ;(if (string-equal (item.feat word 'pbreak "question"))
> ;    (begin
> ;    (item.set_feat word "pbreak" "heavy")
> ;    (format t "pbreak question veranderd in %s" (item.feat word "pbreak"))
> ;    ))
> ;)
> ;(utt.relation.items utt 'Word))
> ;utt)
> ;;; // -----
> ;;; // fy::SelectTuneNonFinalPhrase is called in fy::basic_tune_choice
> ;;; // if word acc +  AND if word faonfp +
> 
> ;;; // R:Token.parent.pos:
> ;;; // There is a relation between tokens and words. For example:
> ;;; // Token:           b.v.
> ;;; // Word:    besloten   vennootschap
> ;;; // This relation is not a real tree structure. There are just two layers.  
> ;;; // So you don't need an extra relation to store the connections between  
> ;;; // tokens and words (as in ProsTree). 
> ;;; // The tokens (items in the Token relation) have direct  
> ;;; // daughters (items in the Word relation).
> ;;; // The given position is on word (item in Word relation), 
> ;;; // R:Token.parent.pos thus says: Look into the relation Token which token is  
> ;;; // the parent of this word and return the value of the feature pos from this  
> ;;; // token.
> 
> (define (fy::SelectTuneNonFinalPhrase word utt)
>   """  
>   \(fy::SelectTuneNonFinalPhrase word utt\)
99,100c255,256
< ; select tune for last accent in a non final phrase
< (define (nl::SelectTuneNonFinalPhrase word utt)
---
>   choose type of pitch accent for the final accent of a non-fnal phrase
>   """
105,109c261,269
<        (set! pos (item.feat word "R:Token.parent.pos"))
<        (set! WordAfterBound (item.name (item.next BoundWord)))
<        (if (equal? word BoundWord)							; accent on last word, non final phrase
<           (item.relation.append_daughter
< 	                    word
---
>   (let ((pos (item.feat word "R:Token.parent.pos"))
> 	(nextword (item.feat word "n.name")))
> ;;; // if word preceded by pbreak medium or heavy, then H*
> ;;; // if word V and the one after that 'die' or 'dat', then H*LH
> ;;; // else L*H
>     (cond
>      ;;; accent is on the last word in the phrase ==> choose H*
>      ((member (item.feat word "pbreak") '("medium" "heavy"))
>       (item.relation.append_daughter word
111,114c271,276
<                             (utt.relation.append utt 'Intonation '("H*")))
<           (if (and (string-equal pos "V") (member WordAfterBound '("die" "dat")))	;accent on VERB before REL
<              (item.relation.append_daughter
< 	                       word
---
> 				     (utt.relation.append utt 'Intonation '("H*"))))
> 
>      ;;; accent is on verb before a relative clause ==> H*LH
>      ((and (string-equal pos "V") 
> 	   (member nextword '("die" "dat")) )
>       (item.relation.append_daughter word
116,118c278,282
<                                (utt.relation.append utt 'Intonation '("H*LH")))
<              (item.relation.append_daughter
< 	                       word
---
> 				     (utt.relation.append utt 'Intonation '("H*LH"))))
> 
>      ;;; otherwise ==> L*H
>      (t
>       (item.relation.append_daughter word
120,121c284
<                                (utt.relation.append utt 'Intonation '("L*H")))))	; default last accent non final phrase
< )
---
> 				     (utt.relation.append utt 'Intonation '("L*H")))) )))
122a286,305
> ;;; // -----
> ;;; // fy::MarkFinalAccsNonfinalPhrase called in fy::basic_tune_choice
> ;;; // The meaning of this function is to check whether an accent is the last  
> ;;; // one in a non-final phrase. When you give phraseboundaries the signs [ and 
> ;;; // ], and accents *, you want for example in  
> ;;; // [ * * ] [ * * ]
> ;;; // that function returns t (true) for the second accent, but nil (false) 
> ;;; // for the first accent (because that isn't the last one in the phrase)  
> ;;; // and nil for the last one (because that is the final accent of the phrase,  
> ;;; // but not of the nonfinal phrase).
> 
> (define  (fy::MarkFinalAccsNonfinalPhrase utt)
>   """
>   \(fy::MarkFinalAccsNonfinalPhrase utt\)
> 
>   Marks all accented words in non-final phrases with the nfaonfp feature 
>   \(= 'final-acc-of-non-final-phrase'\)
>   """
>   (let (uttfinal       ;;flag indicating that the utterance-final accent has been seen 
> 	phrasefinal)   ;; flag indicating that the phrase-final accent has been seen
124,125c307,313
< ;; check if accented word is last accent in non final phrase
< (define (nl::LastAccentNonFinalPhrase word utt)
---
>     ;; read words from right to left
>     (mapcar 
>      (lambda (word)
> ;;; // word before medium or heavy pbreak gets phrasefinal nil
>       (if (member (item.feat word "pbreak") '("medium" "heavy"))
> 	  ;; entering a new phrase, so reset phrase final flag
> 	  (set! phrasefinal nil))
127,129c315,328
<     (set! FinalAccentNFP nil)			; last accent in a Not Final Phrase
<     (set! NextSearch t)
<     (set! BoundWord word)
---
>       (if (string-equal (item.feat word 'acc) "+")
> ;;; // If uttfinal true then ifnot, else uttfinal is true:
> ;;; // IFNOT: if not phrasefinal (so if phrasefinal nil), 
> ;;; // then faonfp + and phrasefinal t
> 	  (if uttfinal
> 	      ;; this is not the last accent the utterance
> 	      (if (not phrasefinal)
> 		  ;; this *is* the phrase-final accent
> 		  ;; set "final-acc-of-non-final-phrase" feature
> 		  (and (item.set_feat word 'faonfp '+)
> 		       (set! phrasefinal t)))
> 	      ;; this *is* the last accent in the utterance
> 	      (and (set! uttfinal t)
>                    (set! phrasefinal t)))) )
131,137c330
<     ;;; first check if this accent is last accent in non final phrase
<     (if (and (item.next word)			; accent on last word, non final phrase
<              (member (item.feat word "pbreak") '("medium" "heavy")))
<         (begin 
<           (set! FinalAccentNFP t)			; found last accent
<           (set! NextSearch nil)                 	; stop searching
<           (set! BoundWord word)))               	; this word has boundary
---
>      (reverse (utt.relation.items utt 'Word)))))
139,144d331
<           (while (and (string-equal NextSearch t)	; search next accent or boundary
<                          (item.next BoundWord))
<              (begin
<                  (set! BoundWord (item.next BoundWord))
<                  (if (string-equal (item.feat BoundWord 'acc) "+")
<                     (set! NextSearch nil))		; not final accent, stop search
146,155d332
<                  (if (and (string-equal NextSearch t)
<                           (member (item.feat BoundWord "pbreak") '("medium" "heavy"))) 	; check non final phrase 
<                     (begin 
<                         (set! NextSearch nil)					; stop search
<                          (if (not (string-equal (item.feat BoundWord 'id)	; non final phrase?
<                                                 (item.feat (utt.relation.last utt 'Word) 'id)))
<                              (set! FinalAccentNFP t))))))
< ; if NotFinalPhrase then BoundWord is the word on boundary position
< FinalAccentNFP
< )
158c335
< (provide 'net_nl_tune)
---
> (provide 'net_fy_tune)


<---------------------  End of report  --------------------->

