예제 #1
0
def tag_starts_line(tag, category):
    """
    Make sure a tag always begins a new line
    :param tag: regular expression with which to find tag
    :param category: Identifier for the files (i.e משניות, יכין etc.)
    """

    for tractate in tractates:
        ref = Ref(tractate)
        name = ref.he_book()
        name = name.replace(u'משנה', category)
        try:
            in_file = codecs.open(u'{}.txt'.format(name), 'r', 'utf-8')
        except IOError:
            print u'cannot find {}'.format(name)
            continue

        # instantiate TagTester
        tester = TagTester(tag, in_file)
        if tester.does_start_line():
            print u'{} is okay!'.format(name)
        else:
            print u'problem with {}'.format(name)
예제 #2
0
def tag_starts_line(tag, category):
    """
    Make sure a tag always begins a new line
    :param tag: regular expression with which to find tag
    :param category: Identifier for the files (i.e משניות, יכין etc.)
    """

    for tractate in tractates:
        ref = Ref(tractate)
        name = ref.he_book()
        name = name.replace(u'משנה', category)
        try:
            in_file = codecs.open(u'{}.txt'.format(name), 'r', 'utf-8')
        except IOError:
            print u'cannot find {}'.format(name)
            continue

        # instantiate TagTester
        tester = TagTester(tag, in_file)
        if tester.does_start_line():
            print u'{} is okay!'.format(name)
        else:
            print u'problem with {}'.format(name)