func capitalizeYUI(word *snowballword.SnowballWord) {

	// Keep track of vowels that we see
	vowelPreviously := false

	// Peak ahead to see if the next rune is a vowel
	vowelNext := func(j int) bool {
		return (j+1 < len(word.RS) && isLowerVowel(word.RS[j+1]))
	}

	// Look at all runes
	for i := 0; i < len(word.RS); i++ {

		// Nothing to do for non-vowels
		if isLowerVowel(word.RS[i]) == false {
			vowelPreviously = false
			continue
		}

		vowelHere := true

		switch word.RS[i] {
		case 121: // y

			// Is this "y" preceded OR followed by a vowel?
			if vowelPreviously || vowelNext(i) {
				word.RS[i] = 89 // Y
				vowelHere = false
			}

		case 117: // u

			// Is this "u" is flanked by vowels OR preceded by a "q"?
			if (vowelPreviously && vowelNext(i)) || (i >= 1 && word.RS[i-1] == 113) {
				word.RS[i] = 85 // U
				vowelHere = false
			}

		case 105: // i

			// Is this "i" is flanked by vowels?
			if vowelPreviously && vowelNext(i) {
				word.RS[i] = 73 // I
				vowelHere = false
			}
		}
		vowelPreviously = vowelHere
	}
}
func capitalizeYUI(word *snowballword.SnowballWord) {

	
	vowelPreviously := false

	
	vowelNext := func(j int) bool {
		return (j+1 < len(word.RS) && isLowerVowel(word.RS[j+1]))
	}

	
	for i := 0; i < len(word.RS); i++ {

		
		if isLowerVowel(word.RS[i]) == false {
			vowelPreviously = false
			continue
		}

		vowelHere := true

		switch word.RS[i] {
		case 121: 

			
			if vowelPreviously || vowelNext(i) {
				word.RS[i] = 89 
				vowelHere = false
			}

		case 117: 

			
			if (vowelPreviously && vowelNext(i)) || (i >= 1 && word.RS[i-1] == 113) {
				word.RS[i] = 85 
				vowelHere = false
			}

		case 105: 

			
			if vowelPreviously && vowelNext(i) {
				word.RS[i] = 73 
				vowelHere = false
			}
		}
		vowelPreviously = vowelHere
	}
}
func capitalizeYUI ( word * snowballword . SnowballWord ) { // Keep track of vowels that we see vowelPreviously := false // Peak ahead to see if the next rune is a vowel vowelNext := func ( j int ) bool { return ( j + 1 < len ( word . RS ) && isLowerVowel ( word . RS [ j + 1 ] ) ) } // Look at all runes for i := 0 ; i < len ( word . RS ) ; i ++ { // Nothing to do for non-vowels if isLowerVowel ( word . RS [ i ] ) == false { vowelPreviously = false continue } vowelHere := true switch word . RS [ i ] { case 121 : // y // Is this "y" preceded OR followed by a vowel? if vowelPreviously || vowelNext ( i ) { word . RS [ i ] = 89 // Y vowelHere = false } case 117 : // u // Is this "u" is flanked by vowels OR preceded by a "q"? if ( vowelPreviously && vowelNext ( i ) ) || ( i >= 1 && word . RS [ i - 1 ] == 113 ) { word . RS [ i ] = 85 // U vowelHere = false } case 105 : // i // Is this "i" is flanked by vowels? if vowelPreviously && vowelNext ( i ) { word . RS [ i ] = 73 // I vowelHere = false } } vowelPreviously = vowelHere } }
// Capitalize Y, I, and U runes that are acting as consanants.
// Put into upper case "u" or "i" preceded and followed by a
// vowel, and "y" preceded or followed by a vowel. "u" after q is
// also put into upper case.
//
Capitalize Y I and U runes that are acting as consanants . Put into upper case u or i preceded and followed by a vowel and y preceded or followed by a vowel . u after q is also put into upper case .