def test_GetAllMatches_empty(self):
     print 'yo'
     daftext = u'אע״ג שאמרו ככה בלה בלה בלה'.split()
     rashi = [u'', u'אף על גב שאמרו']
     daf = dhm.GemaraDaf(daftext, rashi)
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[0], 0,
                                       len(daf.allWords) - 1, 0.27, 0.2)
     for tm in textMatchList:
         print u'{}'.format(tm)
Example #2
0
 def test_GetAllApproximateMatchesWithWordSkip_mismatch_on_last_word_of_daf(
         self):
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[7], 0,
                                       len(daf.allWords) - 1, 0, 0)
     assert len(textMatchList) == 1
     assert textMatchList[
         0].textMatched == u'עד סוף האשמורה הראשונה דברי רבי'
     assert textMatchList[0].startWord == 5
     assert textMatchList[0].endWord == 10
 def test_GetAllApproximateMatchesWithWordSkip_one_skip(self):
     textMatchList = dhm.GetAllMatches(daf,daf.allRashi[1],0,len(daf.allWords) - 1,0,0)
     assert daf.allRashi[1].startingText == textMatchList[0].textToMatch
     assert len(textMatchList) == 2
     assert textMatchList[0].textMatched == u'עד סוף האשמורה הראשונה דברי רבי אליעזר.'
     assert textMatchList[0].startWord == 5
     assert textMatchList[0].endWord == 11
     assert textMatchList[1].textMatched == u'האשמורה הראשונה דברי רבי אליעזר.'
     assert textMatchList[1].startWord == 7
     assert textMatchList[1].endWord == 11
 def test_GetAllApproximateMatchesWithWordSkip_small_rashi(self):
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[8], 0,
                                       len(daf.allWords) - 1, 0, 0)
     assert len(textMatchList) == 2
     assert textMatchList[0].textMatched == 'וחכמים אומרים עד חצות'
     assert textMatchList[0].startWord == 12
     assert textMatchList[0].endWord == 15
     assert textMatchList[1].textMatched == 'אומרים עד חצות'
     assert textMatchList[1].startWord == 13
     assert textMatchList[1].endWord == 15
 def test_GetAllApproximateMatchesWithWordSkip_two_skip_at_end(self):
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[3], 0,
                                       len(daf.allWords) - 1, 0, 0)
     assert len(textMatchList) == 2
     assert textMatchList[0].textMatched == 'עד סוף האשמורה הראשונה דברי'
     assert textMatchList[0].startWord == 5
     assert textMatchList[0].endWord == 9
     assert textMatchList[1].textMatched == 'סוף האשמורה הראשונה דברי'
     assert textMatchList[1].startWord == 6
     assert textMatchList[1].endWord == 9
 def test_GetAllApproximateMatchesWithAbbrev(self):
     daftext = sp(
         'מימיך רב נחמן בר יצחק אמר עשה כדברי בית שמאי חייב מיתה דתנן אמר ר"ט אני הייתי בא בדרך והטתי לקרות כדברי ב"ש וסכנתי בעצמי מפני הלסטים אמרו לו כדאי היית לחוב בעצמך שעברת על דברי ב"ה: מתני׳'
     )
     rashi = [
         'רב נחמן בר יצחק אמר עשה כדברי בית שמאי חייב מיתה דתנן אמר רבי טרפון אני הייתי בא בדרך והטתי לקרות כדברי בית שמאי וסכנתי בעצמי מפני הלסטים אמרו לו כדאי היית לחוב בעצמך שעברת על דברי בית הלל'
     ]
     daf = dhm.GemaraDaf(daftext, rashi)
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[0], 0,
                                       len(daf.allWords) - 1, 0.27, 0.2)
     for tm in textMatchList:
         print('{}'.format(tm))
 def test_GetAllApproximateMatchesWithWordSkip_max_skips(self):
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[10], 0, len(daf.allWords) - 1, 0, 0)
     assert len(textMatchList) == 1
     assert textMatchList[0].textMatched == u'וחכמים אומרים עד חצות ר"ג אומר עד שיעלה עמוד השחר.'
     assert textMatchList[0].startWord == 12
     assert textMatchList[0].endWord == 21
 def test_GetAllApproximateMatchesWithWordSkip_too_skips(self):
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[9], 0, len(daf.allWords) - 1, 0, 0)
     assert len(textMatchList) == 0
 def test_GetAllApproximateMatchesWithWordSkip_rashi_skip_end_of_daf(self):
     textMatchList = dhm.GetAllMatches(daf, daf.allRashi[6], 0, len(daf.allWords) - 1, 0, 0)
     assert len(textMatchList) == 1
     assert textMatchList[0].textMatched == u'בניו מבית המשתה אמרו לו'
     assert textMatchList[0].startWord == 24
     assert textMatchList[0].endWord == 28