Beispiel #1
0
 def test_simplify_arabic_text_for_different_alef_types(self):
     # TODO: Add tests for the rest of Alef types.
     self.assertEqual(u'امنا', simplify_arabic_text(u'آمَنَّا'))
     self.assertEqual(u'اولئك', simplify_arabic_text(u'أُوْلَئِكَ'))
     self.assertEqual(u'او', simplify_arabic_text(u'أَوْ'))
     self.assertEqual(u'واذا', simplify_arabic_text(u'وَإِذَا'))
     pass
Beispiel #2
0
 def test_simplify_arabic_text_for_different_alef_types(self):
     # TODO: Add tests for the rest of Alef types.
     self.assertEqual(u'امنا', simplify_arabic_text(u'آمَنَّا'))
     self.assertEqual(u'اولئك', simplify_arabic_text(u'أُوْلَئِكَ'))
     self.assertEqual(u'او', simplify_arabic_text(u'أَوْ'))
     self.assertEqual(u'واذا', simplify_arabic_text(u'وَإِذَا'))
     pass
Beispiel #3
0
def book_pre_save(sender, instance, *_args, **_kwargs):
    """
    Called before a book is saved. We generate the simplified
    (without diacritics) versions of the fields.
    :param sender: See Django's Signals documentation.
    :param instance: See Django's Signals documentation.
    :param _args: See Django's Signals documentation.
    :param _kwargs: See Django's Signals documentation.
    """
    instance.simple_title = simplify_arabic_text(instance.title)
    instance.simple_brief_desc = simplify_arabic_text(instance.brief_desc)
Beispiel #4
0
def person_pre_save(sender, instance, *_args, **_kwargs):
    """
    Called before a person is saved. We generate the simplified
    (without diacritics) versions of the fields.
    :param sender: See Django's Signals documentation.
    :param instance: See Django's Signals documentation.
    :param _args: See Django's Signals documentation.
    :param _kwargs: See Django's Signals documentation.
    """
    instance.simple_display_name = simplify_arabic_text(instance.display_name)
    instance.simple_full_name = simplify_arabic_text(instance.full_name)
    instance.simple_brief_desc = simplify_arabic_text(instance.brief_desc)
Beispiel #5
0
def hadith_pre_save(sender, instance, *_args, **_kwargs):
    """
    Called before a hadith is saved. We generate the simplified
    (without diacritics) versions of the fields.
    :param sender: See Django's Signals documentation.
    :param instance: See Django's Signals documentation.
    :param _args: See Django's Signals documentation.
    :param _kwargs: See Django's Signals documentation.
    """
    instance.simple_text = simplify_arabic_text(instance.text)
Beispiel #6
0
 def test_simplify_arabic_text_for_surat_alfatiha(self):
     self.assertEqual(u'بسم الله الرحمن الرحيم', simplify_arabic_text(
         u'بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ'))
     self.assertEqual(u'الحمد لله رب العالمين', simplify_arabic_text(
         u'الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ'))
     self.assertEqual(u'الرحمن الرحيم',
                      simplify_arabic_text(u'الرَّحْمَنِ الرَّحِيمِ'))
     self.assertEqual(u'مالك يوم الدين',
                      simplify_arabic_text(u'مَالِكِ يَوْمِ الدِّينِ'))
     self.assertEqual(u'اياك نعبد واياك نستعين', simplify_arabic_text(
         u'إِيَّاكَ نَعْبُدُ وَإِيَّاكَ نَسْتَعِينُ'))
     self.assertEqual(u'اهدنا الصراط المستقيم', simplify_arabic_text(
         u'اهدِنَا الصِّرَاطَ الْمُسْتَقِيمَ'))
     self.assertEqual(
         u'صراط الذين انعمت عليهم غير المغضوب عليهم ولا الضالين',
         simplify_arabic_text(
             u'صِرَاطَ الَّذِينَ أَنْعَمْتَ عَلَيْهِمْ غَيْرِ الْمَغْضُوبِ عَلَيْهِمْ وَلاَ الضَّالِّينَ'))
Beispiel #7
0
 def test_simplify_arabic_text_for_surat_alfatiha(self):
     self.assertEqual(
         u'بسم الله الرحمن الرحيم',
         simplify_arabic_text(u'بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيمِ'))
     self.assertEqual(
         u'الحمد لله رب العالمين',
         simplify_arabic_text(u'الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ'))
     self.assertEqual(u'الرحمن الرحيم',
                      simplify_arabic_text(u'الرَّحْمَنِ الرَّحِيمِ'))
     self.assertEqual(u'مالك يوم الدين',
                      simplify_arabic_text(u'مَالِكِ يَوْمِ الدِّينِ'))
     self.assertEqual(
         u'اياك نعبد واياك نستعين',
         simplify_arabic_text(u'إِيَّاكَ نَعْبُدُ وَإِيَّاكَ نَسْتَعِينُ'))
     self.assertEqual(
         u'اهدنا الصراط المستقيم',
         simplify_arabic_text(u'اهدِنَا الصِّرَاطَ الْمُسْتَقِيمَ'))
     self.assertEqual(
         u'صراط الذين انعمت عليهم غير المغضوب عليهم ولا الضالين',
         simplify_arabic_text(
             u'صِرَاطَ الَّذِينَ أَنْعَمْتَ عَلَيْهِمْ غَيْرِ الْمَغْضُوبِ عَلَيْهِمْ وَلاَ الضَّالِّينَ'
         ))
Beispiel #8
0
def hadith_pre_save(sender, instance, *args, **kwargs):
    instance.simple_text = simplify_arabic_text(instance.text)
Beispiel #9
0
def hadithtag_pre_save(sender, instance, *args, **kwargs):
    instance.simple_name = simplify_arabic_text(instance.name)
Beispiel #10
0
def booksection_pre_save(sender, instance, *args, **kwargs):
    instance.simple_title = simplify_arabic_text(instance.title)
Beispiel #11
0
def book_pre_save(sender, instance, *args, **kwargs):
    instance.simple_title = simplify_arabic_text(instance.title)
    instance.simple_brief_desc = simplify_arabic_text(instance.brief_desc)
Beispiel #12
0
def person_pre_save(sender, instance, *args, **kwargs):
    instance.simple_display_name = simplify_arabic_text(instance.display_name)
    instance.simple_full_name = simplify_arabic_text(instance.full_name)
    instance.simple_brief_desc = simplify_arabic_text(instance.brief_desc)