PhoneticStringUtilities.st
changeset 5456 3040ec2b4531
parent 5236 28c398151366
equal deleted inserted replaced
5455:20dbad6d9935 5456:3040ec2b4531
  1480                                                 addSecondaryTranslation: 'X'.
  1480                                                 addSecondaryTranslation: 'X'.
  1481                                           skipCount := skipCount + 1.
  1481                                           skipCount := skipCount + 1.
  1482                                           ^self ].
  1482                                           ^self ].
  1483 
  1483 
  1484                         (currentIndex = 1          "b"
  1484                         (currentIndex = 1          "b"
  1485                                         and: [ (inputKey size > 5 and: [(inputKey copyFrom: 1 to: 6) = 'CHARAC'
  1485                                         and: [ (inputKey size > 5 and: [(inputKey startsWith: 'CHARAC')
  1486                                                         or: [ (inputKey copyFrom: 1 to: 6) = 'CHARIS' ]] )
  1486                                                         or: [ (inputKey startsWith: 'CHARIS') ]] )
  1487                                                 or: [inputKey size > 4 and: [ ((((inputKey copyFrom: 1 to: 4) = 'CHOR'
  1487                                                 or: [inputKey size > 4 and: [ ((((inputKey startsWith: 'CHOR')
  1488                                                         or: [ (inputKey copyFrom: 1 to: 4) = 'CHYM' ])
  1488                                                         or: [ (inputKey startsWith: 'CHYM') ])
  1489                                                         or: [ (inputKey copyFrom: 1 to: 4) = 'CHIA' ])
  1489                                                         or: [ (inputKey startsWith: 'CHIA') ])
  1490                                                         or: [ (inputKey copyFrom: 1 to: 4) = 'CHEM' ])
  1490                                                         or: [ (inputKey startsWith: 'CHEM') ])
  1491                                                         and: [ (inputKey copyFrom: 1 to: 4) ~= 'CHORE' ] ] ] ])
  1491                                                         and: [ (inputKey startsWith: 'CHORE') not ] ] ] ])
  1492                                 ifTrue: [ self
  1492                                 ifTrue: [ self
  1493                                                 addPrimaryTranslation: 'K';
  1493                                                 addPrimaryTranslation: 'K';
  1494                                                 addSecondaryTranslation: 'K'.
  1494                                                 addSecondaryTranslation: 'K'.
  1495                                           skipCount := skipCount + 1.
  1495                                           skipCount := skipCount + 1.
  1496                                           ^self ].
  1496                                           ^self ].
  1497 
  1497 
  1498                         (((((#('VAN ' 'VON ') includes: (inputKey copyFrom: 1 to: 4))              "c"
  1498                         (((((#('VAN ' 'VON ') includes: (inputKey copyFrom: 1 to: 4))              "c"
  1499                                         or: [ (inputKey copyFrom: 1 to: 3) = 'SCH' ])
  1499                                         or: [ (inputKey startsWith: 'SCH') ])
  1500                                         or: [ #('ORCHES' 'ARCHIT' 'ORCHID')
  1500                                         or: [ #('ORCHES' 'ARCHIT' 'ORCHID')
  1501                                                         includes: (self keyMidString: 6 from: currentIndex-2) ])
  1501                                                         includes: (self keyMidString: 6 from: currentIndex-2) ])
  1502                                         or: [ #($T $S) includes: (self keyAt: currentIndex+2) ])
  1502                                         or: [ #($T $S) includes: (self keyAt: currentIndex+2) ])
  1503                                         or: [ ((currentIndex = 1)
  1503                                         or: [ ((currentIndex = 1)
  1504                                                         or: [ #($A $O $U $E) includes: (self keyAt: currentIndex-1) ])
  1504                                                         or: [ #($A $O $U $E) includes: (self keyAt: currentIndex-1) ])
  1510                                           skipCount := skipCount + 1.
  1510                                           skipCount := skipCount + 1.
  1511                                           ^self ]
  1511                                           ^self ]
  1512                                 ifFalse:
  1512                                 ifFalse:
  1513                                         [ currentIndex > 1
  1513                                         [ currentIndex > 1
  1514                                                 ifTrue:
  1514                                                 ifTrue:
  1515                                                         [ (inputKey copyFrom: 1 to: 2) = 'MC'
  1515                                                         [ (inputKey startsWith: 'MC')
  1516                                                                 ifTrue:
  1516                                                                 ifTrue:
  1517                                                                                 [ self
  1517                                                                                 [ self
  1518                                                                                                 addPrimaryTranslation: 'K';
  1518                                                                                                 addPrimaryTranslation: 'K';
  1519                                                                                                 addSecondaryTranslation: 'K' ]
  1519                                                                                                 addSecondaryTranslation: 'K' ]
  1520                                                                 ifFalse:
  1520                                                                 ifFalse:
  1845                 ifTrue: [
  1845                 ifTrue: [
  1846                         " //obvious germanic
  1846                         " //obvious germanic
  1847                                         if((StringAt(0, 4, VAN , VON , ) OR StringAt(0, 3, SCH, ))
  1847                                         if((StringAt(0, 4, VAN , VON , ) OR StringAt(0, 3, SCH, ))
  1848                                                 OR StringAt((current + 1), 2, ET, ))                                                MetaphAdd(K);"
  1848                                                 OR StringAt((current + 1), 2, ET, ))                                                MetaphAdd(K);"
  1849                         word := (inputKey copyFrom: 1 to: 4).
  1849                         word := (inputKey copyFrom: 1 to: 4).
  1850                         ((#('VAN ' 'VON ') includes: word) or: [(word copyFrom: 1 to: 3) = 'SCH' or: [(word copyFrom: 1 to: 2) = 'ET']]) 
  1850                         ((#('VAN ' 'VON ') includes: word) or: [(word startsWith: 'SCH') or: [(word startsWith: 'ET')]]) 
  1851                         ifTrue: [
  1851                         ifTrue: [
  1852                                 self addPrimaryTranslation: 'K';
  1852                                 self addPrimaryTranslation: 'K';
  1853                                 addSecondaryTranslation: 'K'.
  1853                                 addSecondaryTranslation: 'K'.
  1854                         ] ifFalse: [
  1854                         ] ifFalse: [
  1855                             " //always soft if french ending
  1855                             " //always soft if french ending
  1857                                                         MetaphAdd(J);
  1857                                                         MetaphAdd(J);
  1858                                                 else
  1858                                                 else
  1859                                                         MetaphAdd(J, K);
  1859                                                         MetaphAdd(J, K);
  1860                                         current += 2;
  1860                                         current += 2;
  1861                                         break;"
  1861                                         break;"
  1862                                 (((inputKey copyFrom: currentIndex + 1 to: (currentIndex + 5 min: inputKey size)), '    ') copyFrom: 1 to: 4) = 'IER '
  1862                                 (((inputKey copyFrom: currentIndex + 1 to: (currentIndex + 5 min: inputKey size)), '    ') startsWith: 'IER ')
  1863                                 ifTrue: [
  1863                                 ifTrue: [
  1864                                         self addPrimaryTranslation: 'J';
  1864                                         self addPrimaryTranslation: 'J';
  1865                                         addSecondaryTranslation: 'J'.
  1865                                         addSecondaryTranslation: 'J'.
  1866                                 ] ifFalse: [
  1866                                 ] ifFalse: [
  1867                                         self addPrimaryTranslation: 'J';
  1867                                         self addPrimaryTranslation: 'J';