From 4056b105c9826b77af4eb01efa6edac19ea87070 Mon Sep 17 00:00:00 2001 From: Tim Mahrt Date: Mon, 18 Jul 2016 17:06:50 +0200 Subject: [PATCH] BUGFIX: Monophthongs searches no longer match dipthongs This was in the code but the functionality didn't work. --- pysle/isletool.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/pysle/isletool.py b/pysle/isletool.py index 5722a87..a6b8250 100644 --- a/pysle/isletool.py +++ b/pysle/isletool.py @@ -147,11 +147,11 @@ def _prepRESearchStr(matchStr, wordInitial='ok', wordFinal='ok', # For sounds that are designated two characters, prevent # detecting those sounds if the user wanted a sound # designated by one of the contained characters - for charA, charB in [(u'e', u'i'), (u't', u'ʃ'), (u'o', u'ʊ'), - (u'd', u'ʒ'), (u'a', u'ʊ'), (u'ɑ' u'ɪ'), - (u'ɔ', u'i'), ]: - - # Forward search ('a' and not 'ab') + + # Forward search ('a' and not 'ab') + insertList = [] + for charA, charB in [(u'e', u'i'), (u't', u'ʃ'), (u'd', u'ʒ'), + (u'o', u'ʊ'), (u'a', u'ʊ|ɪ'), (u'ɔ', u'i'), ]: startI = 0 while True: try: @@ -160,10 +160,13 @@ def _prepRESearchStr(matchStr, wordInitial='ok', wordFinal='ok', break if matchStr[i + 1] != charB: forwardStr = u'(?!%s)' % charB - matchStr = matchStr[:i + 1] + forwardStr + matchStr[i + 1:] +# matchStr = matchStr[:i + 1] + forwardStr + matchStr[i + 1:] startI = i + 1 + len(forwardStr) + insertList.append((i + 1, forwardStr)) - # Backward search ('b' and not 'ab') + # Backward search ('b' and not 'ab') + for charA, charB in [(u't', u'ʃ'), (u'd', u'ʒ'), + (u'a|o', u'ʊ'), (u'e|ɔ', u'i'), (u'ɑ' u'ɪ'), ]: startI = 0 while True: try: @@ -172,8 +175,13 @@ def _prepRESearchStr(matchStr, wordInitial='ok', wordFinal='ok', break if matchStr[i - 1] != charA: backStr = u'(?