Beispiel #1
0
def char_table_data(text, modulo = 9):
    # initialize data dictionary, split text to columns: #, letter, translit, num, sum, mod, word
    data = dict([key, []] for key in ['letter', 'transliteration', 'isopsephy', 'word'])
    # character chart
    # split words
    for word in _init_text(text).split():
        # split letters
        for idx, letter in enumerate(word):
            #data['index'].append(idx)
            data['letter'].append(letter)
            data['transliteration'].append(to_roman(letter.encode('utf-8')))
            data['isopsephy'].append(isopsephy(letter.encode('utf-8')))
            data['word'].append(word)

    data = pd.DataFrame(data)
    # word summary from character chart
    gb = data.groupby('word')
    data2 = gb.sum()
    data2['characters'] = gb['word'].apply(len)
    data2['digital_sum'] = data2['isopsephy'].apply(digital_sum)
    data2['digital_root'] = data2['isopsephy'].apply(digital_root)
    # phrase summary from word summary
    s = data2.sum()
    data3 = pd.DataFrame({'digital_root': [digital_root(s.isopsephy)],
                          'characters': [s.characters], 
                          'digital_sum': [digital_sum(s.isopsephy)],
                          'isopsephy': [s.isopsephy],
                          'phrase': text})

    return (data, data2, data3)
Beispiel #2
0
def char_table_data(text, modulo=9):
    # initialize data dictionary, split text to columns: #, letter, translit, num, sum, mod, word
    data = dict([key, []]
                for key in ['letter', 'transliteration', 'isopsephy', 'word'])
    # character chart
    # split words
    for word in _init_text(text).split():
        # split letters
        for idx, letter in enumerate(word):
            #data['index'].append(idx)
            data['letter'].append(letter)
            data['transliteration'].append(to_roman(letter.encode('utf-8')))
            data['isopsephy'].append(isopsephy(letter.encode('utf-8')))
            data['word'].append(word)

    data = pd.DataFrame(data)
    # word summary from character chart
    gb = data.groupby('word')
    data2 = gb.sum()
    data2['characters'] = gb['word'].apply(len)
    data2['digital_sum'] = data2['isopsephy'].apply(digital_sum)
    data2['digital_root'] = data2['isopsephy'].apply(digital_root)
    # phrase summary from word summary
    s = data2.sum()
    data3 = pd.DataFrame({
        'digital_root': [digital_root(s.isopsephy)],
        'characters': [s.characters],
        'digital_sum': [digital_sum(s.isopsephy)],
        'isopsephy': [s.isopsephy],
        'phrase': text
    })

    return (data, data2, data3)
Beispiel #3
0
def char_table(text, modulo=9):
    # initialize html table
    tbl = table(Class="char-table")
    # add caption / table title
    tbl.addCaption(text)
    # add data rows
    tr1 = h.tr()  # greek letters
    tr2 = h.tr()  # roman letters
    tr3 = h.tr()  # isopsephy number
    tr4 = h.tr()  # summary
    i = 0
    text = unicode(text, encoding="utf-8")
    for word in text.split():
        if i > 0:
            # add empty cells for word separation
            tr1 << h.th("&nbsp;") + h.th("&nbsp;")
            tr2 << h.td() + h.td(Class="empty-cell")
            tr3 << h.td() + h.td(Class="empty-cell")
            tr4 << h.td() + h.td()
        num = unicode_isopsephy(word)
        tr4 << h.td("%s %s" % (num, h.sub(digital_root(num))),
                    colspan=len(word))
        i = i + 1
        # add each letter on own cell
        for letter in word:
            tr1 << h.th(letter.encode('utf-8'))
            tr2 << h.td(to_roman(letter.encode('utf-8')))
            tr3 << h.td(unicode_isopsephy(letter))
    # add rows to table
    tbl.addHeadRow(tr1)
    tbl.addBodyRow(tr2)
    tbl.addBodyRow(tr3)
    tbl.addFootRow(tr4)
    # add summary footer for table
    num = unicode_isopsephy(text)
    tbl.addFootRow(
        h.tr(
            h.td("%s %s" %
                 (num, h.sub(digital_sum(num), " / ", digital_root(
                     num, modulo))),
                 colspan=len(text) + len(text.split()),
                 style="border-top: solid 1px #ddd")))
    return tbl
Beispiel #4
0
def char_table(text, modulo = 9):
    # initialize html table
    tbl = table(Class="char-table")
    # add caption / table title
    tbl.addCaption(text)
    # add data rows
    tr1 = h.tr() # hebrew letters
    tr2 = h.tr() # roman letters
    tr3 = h.tr() # gematria number
    tr4 = h.tr() # summary
    i = 0
    text = unicode(text, encoding="utf-8")
    for word in text.split():
        if i > 0:
            # add empty cells for word separation
            tr1 += h.th("&nbsp;")
            tr1 += h.th("&nbsp;")
            tr2 += h.td()
            tr2 += h.td(Class="empty-cell")
            tr3 += h.td()
            tr3 += h.td(Class="empty-cell")
            tr4 += h.td()
            tr4 += h.td()
        num = unicode_gematria(word)
        tr4 += h.td("%s %s" % (num, h.sub(digital_root(num))), colspan=len(word))
        i = i+1
        # add each letter on own cell
        for letter in word:
            tr1 += h.th(letter.encode('utf-8'))
            tr2 += h.td(to_roman(letter.encode('utf-8')))
            tr3 += h.td(unicode_gematria(letter))
    # add rows to table
    tbl.addHeadRow(tr1)
    tbl.addBodyRow(tr2)
    tbl.addBodyRow(tr3)
    tbl.addFootRow(tr4)
    # add summary footer for table
    num = unicode_gematria(text)
    tbl.addFootRow(h.tr(h.td("%s %s" % (num, h.sub(digital_sum(num), " / ", digital_root(num, modulo))), 
                             colspan=len(text)+len(text.split()), 
                             style="border-top: solid 1px #ddd")))
    return tbl
Beispiel #5
0
	def test_convert_2_to_roman(self):
		self.assertEquals("II",main.to_roman(2))
Beispiel #6
0
	def test_convert_1_to_roman(self):
		self.assertEquals("I", main.to_roman(1))
Beispiel #7
0
	def test_convert_48_to_roman(self):
		self.assertEquals("XXXXVIII",main.to_roman(48))       
Beispiel #8
0
	def test_convert_44_to_roman(self):
		self.assertEquals("XXXXIV",main.to_roman(44))       
Beispiel #9
0
	def test_convert_25_to_roman(self):
		self.assertEquals("XXV",main.to_roman(25))       
Beispiel #10
0
	def test_convert_14_to_roman(self):
		self.assertEquals("XIV",main.to_roman(14))       
Beispiel #11
0
	def test_convert_12_to_roman(self):
		self.assertEquals("XII",main.to_roman(12))       
Beispiel #12
0
	def test_convert_9_to_roman(self):
		self.assertEquals("IX",main.to_roman(9))       
Beispiel #13
0
	def test_convert_8_to_roman(self):
		self.assertEquals("VIII",main.to_roman(8))       
Beispiel #14
0
	def test_convert_5_to_roman(self):
		self.assertEquals("V",main.to_roman(5))