@@ -191,8 +191,8 @@ func extractAtomicTrans(composition, last []*Transformation, lastIsVowel bool) (
191191}
192192
193193/*
194- Separate a string into smaller parts: first consonant (or head), vowel,
195- last consonant (if any).
194+ Separate a string into smaller parts: first consonant (or head), vowel,
195+ last consonant (if any).
196196*/
197197func extractCvcAppendingTrans (composition []* Transformation ) ([]* Transformation , []* Transformation , []* Transformation ) {
198198 head , lastConsonant := extractAtomicTrans (composition , nil , false )
@@ -440,22 +440,24 @@ func generateTransformations(composition []*Transformation, applicableRules []Ru
440440 // Implement ươ/ưo(i/c/ng) + o -> uô
441441 if regUhO .MatchString (Flatten (composition , VietnameseMode | ToneLess | LowerCase )) {
442442 var vowels = filterAppendingComposition (getRightMostVowels (composition ))
443- var trans = & Transformation {
444- Target : vowels [0 ],
445- Rule : Rule {
446- EffectType : MarkTransformation ,
447- Key : 0 ,
448- Effect : uint8 (MarkNone ),
449- },
450- }
451- if target , applicableRule := findTarget (append (composition , trans ), applicableRules , flags ); target != nil && target != vowels [0 ] {
452- transformations = append (transformations , trans )
453- transformations = append (transformations , & Transformation {
454- Rule : applicableRule ,
455- Target : target ,
456- IsUpperCase : isUpperCase ,
457- })
458- return transformations
443+ if len (vowels ) > 0 {
444+ var trans = & Transformation {
445+ Target : vowels [0 ],
446+ Rule : Rule {
447+ EffectType : MarkTransformation ,
448+ Key : 0 ,
449+ Effect : uint8 (MarkNone ),
450+ },
451+ }
452+ if target , applicableRule := findTarget (append (composition , trans ), applicableRules , flags ); target != nil && target != vowels [0 ] {
453+ transformations = append (transformations , trans )
454+ transformations = append (transformations , & Transformation {
455+ Rule : applicableRule ,
456+ Target : target ,
457+ IsUpperCase : isUpperCase ,
458+ })
459+ return transformations
460+ }
459461 }
460462 }
461463 if undoTrans := generateUndoTransformations (composition , applicableRules , flags ); len (undoTrans ) > 0 {
0 commit comments