From 78f8ef0894c13664111daa565914a9e3eda43ed6 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 00:48:29 -0600 Subject: [PATCH 01/88] Added HTML output support --- dragonmapper/data/default-style.css | 28 ++++++ dragonmapper/html.py | 134 ++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 dragonmapper/data/default-style.css create mode 100644 dragonmapper/html.py diff --git a/dragonmapper/data/default-style.css b/dragonmapper/data/default-style.css new file mode 100644 index 0000000..6542983 --- /dev/null +++ b/dragonmapper/data/default-style.css @@ -0,0 +1,28 @@ +/** +Default CSS style for dragonmapper +**/ + +.hanzi{ + font-size: 2em; + line-height: 1em; + text-align: center; + vertical-align: middle; +} +.zhuyin{ + font-size: 0.6em; + line-height: 1em; + text-align: left; + vertical-align: middle; +} +.pinyin{ + font-size: 1em; + line-height: 1em; + /** Some fonts have exess space on accented pinyin character, + setting the font fixes this problem. **/ + font-family: Times, "Times New Roman", Georgia, serif; + text-align: center; + vertical-align: center; +} +.unknown{ + visibility: collapse; +} diff --git a/dragonmapper/html.py b/dragonmapper/html.py new file mode 100644 index 0000000..367f9c8 --- /dev/null +++ b/dragonmapper/html.py @@ -0,0 +1,134 @@ +# *-* coding utf8 -*- +"""Formatting Chinese into HTML with dragonmapper's functions""" + +""" +See recomended CSS style: +DRAGONMAPPER_DIR/style.css +""" + +from dragonmapper import hanzi, transcriptions + +_indentation = 1 +_line_html = "" + +def _identify(s): + """ + Returns string of text type for HTML/CSS. + + *s* is the string to identify. + """ + if hanzi.has_chinese(s): + return "hanzi" + else: + c = transcriptions.identify(s) + if c == transcriptions.ZHUYIN: + return "zhuyin" + elif c == transcriptions.PINYIN: + return "pinyin" + elif c == transcriptions.UNKNOWN: + return "unknown" + +def _stackify(s): + """ + Stack string for HTML formatting on the left and right of characters. + + *s* is the string to "stackify". + """ + + temp_s = "" + for c in s: + temp_s += c+"
" + return temp_s + +def _html_add(s, tabs=0): + """ + Wrapper for _line_html+="..." + + *s* is what to add to the html string. + *tabs* specifies the identation intensity (in tabs). + """ + + global _line_html + _line_html+=(("\n")+("\t"*(tabs+_indentation)))+s + +def to_html(characters, + bottom=None, + right=None, + left=None, + top=None, + indentation=0): + """ + Returns valid HTML for the Chinese characters, and (assumed) phonetic ... + ... notations provided, on any given side. + + *characters* will be displayed in the middle of each output table. + *bottom/right/left/bottom* will be displayed on their respective sides ... + ... of the character + *indentation* specifies how many extra tab spaces there should be. + """ + global _indentation + _indentation = indentation+1 + + center = characters + + _html_add("") + _html_add("", 1) + + if bottom is None: + bottom = ["" for a,e in enumerate(center)] + if right is None: + right = ["" for a,e in enumerate(center)] + if left is None: + left = ["" for a,e in enumerate(center)] + if top is None: + top = ["" for a,e in enumerate(center)] + + for y in range(0, 3): + _html_add("", 2) + char_num = 0 + for i in range(0, len(center)*3): + x = i%3 + text = "" + text_type = "unknown" + #print("Y: {0}\nI: {1}\nX: {2}\nCN: {3}".format(y, i, x, char_num)) + + # top + if x == 1 and y == 0: + text_type = _identify(top[char_num]) + text = top[char_num] + char_num += 1 + # left + elif x == 0 and y == 1: + text_type = _identify(left[char_num]) + text = _stackify(left[char_num]) + + # center + elif x == 1 and y == 1: + text_type = _identify(center[char_num]) + text = center[char_num] + + # right + elif x == 2 and y == 1: + text_type = _identify(right[char_num]) + text = _stackify(right[char_num]) + char_num += 1 + # bottom + elif x == 1 and y == 2: + text_type = _identify(bottom[char_num]) + text = bottom[char_num] + char_num += 1 + + _html_add("", 3) + + _html_add("", 2) + _html_add("", 1) + _html_add("
".format(text_type), 3) + _html_add("{0}".format(text), 4) + _html_add("
") + return _line_html + +if __name__ == '__main__': + zi = "你好我叫顏毅" + zh = hanzi.to_zhuyin(zi).split(" ") + pi = transcriptions.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)).split(" ") + print to_html(zi, bottom=pi, right=zh) From a1837cda0a153ad7032da176e5aa94681ecfac50 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 01:24:16 -0600 Subject: [PATCH 02/88] Clear variable every time .to_html is called --- dragonmapper/html.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 367f9c8..b7c67ac 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -8,7 +8,7 @@ from dragonmapper import hanzi, transcriptions -_indentation = 1 +_indentation = 0 _line_html = "" def _identify(s): @@ -66,8 +66,11 @@ def to_html(characters, ... of the character *indentation* specifies how many extra tab spaces there should be. """ + global _indentation - _indentation = indentation+1 + global _line_html + _indentation = indentation + _line_html = "" center = characters @@ -131,4 +134,4 @@ def to_html(characters, zi = "你好我叫顏毅" zh = hanzi.to_zhuyin(zi).split(" ") pi = transcriptions.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)).split(" ") - print to_html(zi, bottom=pi, right=zh) + print(to_html(zi, bottom=pi, right=zh)) From a32f3c0948dbc7c72c0136dd970f5328cc6d1255 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 01:25:08 -0600 Subject: [PATCH 03/88] Added my name --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 2b233b5..2077e68 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -10,4 +10,4 @@ Author and Maintainer Contributors ------------ -None yet. Why not be the first? +Tait Hoyem — HTML output From 7a8fe342b1fbd95bd05b2e4dfde211ed6f455d67 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 01:25:27 -0600 Subject: [PATCH 04/88] Added examples --- README.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2dfb2dd..86b16b7 100644 --- a/README.rst +++ b/README.rst @@ -4,7 +4,7 @@ Dragon Mapper .. image:: https://badge.fury.io/py/dragonmapper.png :target: http://badge.fury.io/py/dragonmapper - + .. image:: https://travis-ci.org/tsroten/dragonmapper.png?branch=develop :target: https://travis-ci.org/tsroten/dragonmapper @@ -22,6 +22,7 @@ Features Phonetic Alphabet. * Identify a string as Traditional or Simplified Chinese, Pinyin, Zhuyin, or the International Phonetic Alphabet. +* Output HTML based on the above. .. code:: python @@ -43,6 +44,19 @@ Features >>> dragonmapper.transcriptions.pinyin_to_ipa(s) 'wɔ˧˩˧ ʂɨ˥˩ i˥ kɤ˥˩ meɪ˧˩˧ kwɔ˧˥ ʐən˧˥.' +.. code:: python + + >>> s = "我是加拿大人" + >>> zh = hanzi.to_zhuyin(s).split(' ') + >>> zh + ['ㄨㄛˇ', 'ㄕˋ', 'ㄐㄧㄚ', 'ㄋㄚˊ', 'ㄉㄚˋ', 'ㄖㄣˊ'] + >>> h = dragonmapper.html.to_html(s, right=zh) + >>> print(h) + +.. image:: http://s33.postimg.org/nzsw0y4qn/Screenshot_from_2016_05_24_01_17_00.png + :target: http://postimg.org/image/6z9zs9rp7/http://postimg.org/image/6z9zs9rp7/ + + Getting Started --------------- * `Install Dragon Mapper `_ From 05fbd79c277ae4d593aeb2ff8a3163ee9018596b Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 01:27:15 -0600 Subject: [PATCH 05/88] Fixed 404 on image --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 86b16b7..4a458b2 100644 --- a/README.rst +++ b/README.rst @@ -54,7 +54,7 @@ Features >>> print(h) .. image:: http://s33.postimg.org/nzsw0y4qn/Screenshot_from_2016_05_24_01_17_00.png - :target: http://postimg.org/image/6z9zs9rp7/http://postimg.org/image/6z9zs9rp7/ + :target: http://postimg.org/image/6z9zs9rp7/ Getting Started From d82027a3e2f2fb8805e90b0cc9418730436746da Mon Sep 17 00:00:00 2001 From: "Tait S. Hoyem" Date: Tue, 24 May 2016 02:52:36 -0600 Subject: [PATCH 06/88] Update api.rst Added HTML docs --- docs/api.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index 2522e95..1310cda 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -234,3 +234,9 @@ lines of code. .. autofunction:: to_zhuyin .. autofunction:: to_ipa + +HTML conversion: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Creates some HTML from the characters, and transcription systems you have. + +.. autofunction:: to_html From e58208d82f842f6ee1e06f3cd1ba29541bdbd292 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 02:54:34 -0600 Subject: [PATCH 07/88] Added tests for dragonmapper.html --- dragonmapper/tests/test-html.py | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 dragonmapper/tests/test-html.py diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py new file mode 100644 index 0000000..f83fc2a --- /dev/null +++ b/dragonmapper/tests/test-html.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +"""Unit tests for dragonmapper.html.""" + +from __future__ import unicode_literals +import unittest + +from dragonmapper import html + + +class TestHtmlFuctions(unittest.TestCase): + + s = '我叫顏毅' + zh = ['ㄨㄛˇ', 'ㄐㄧㄠˋ', 'ㄧㄢˊ', 'ㄧˋ'] + pi = ['wǒ', 'jiào', 'yán', 'yì'] + + indented_5 = '\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t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\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tjiào\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyán\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
' + + def test_indented_5(self): + self.assertEqual(html.to_html(self.s, bottom=self.pi, left=self.zh, indentation=5), self.indented_5) + + def test_indented_0(self): + self.assertEqual(html.to_html(self.s, bottom=self.pi, right=self.zh, indentation=0), self.indented_3) + + def test_indented_3(self): + self.assertEqual(html.to_html(self.s, bottom=self.pi, top=self.zh, indentation=3), self.indented_0) + + def test_zhuyin_both_pinyin_both(self): + self.assertEqual(html.to_html(self.s, bottom=self.pi, top=self.pi, left=self.zh, right=self.zh), self.zhuyin_both_pinyin_both) + + def test_pinyin_top(self): + self.assertEqual(html.to_html(self.s, top=self.pi), self.pinyin_top) + + def test_zhuyin_top(self): + self.assertEqual(html.to_html(self.s, top=self.zh), self.zhuyin_top) + + def test_pinyin_bottom(self): + self.assertEqual(html.to_html(self.s, bottom=self.pi), self.pinyin_bottom) From cb9c23a5a36c64fe9d16249c08992cfc0f4edd8b Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 02:55:14 -0600 Subject: [PATCH 08/88] Tweeked style --- dragonmapper/data/default-style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonmapper/data/default-style.css b/dragonmapper/data/default-style.css index 6542983..030335e 100644 --- a/dragonmapper/data/default-style.css +++ b/dragonmapper/data/default-style.css @@ -11,7 +11,7 @@ Default CSS style for dragonmapper .zhuyin{ font-size: 0.6em; line-height: 1em; - text-align: left; + text-align: center; vertical-align: middle; } .pinyin{ From 6f8144a79865c10d4b4ec61701adda459ce4e632 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 02:56:16 -0600 Subject: [PATCH 09/88] Added 'html' as a tag --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 16360b2..2427e8a 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,8 @@ def open_file(filename): 'Topic :: Text Processing :: Linguistic', ], keywords=['chinese', 'mandarin', 'transcription', 'pinyin', 'zhuyin', - 'ipa', 'convert', 'bopomofo', 'hanzi', 'characters', 'readings'], + 'ipa', 'convert', 'bopomofo', 'hanzi', 'characters', 'readings', + 'html'], packages=['dragonmapper', 'dragonmapper.data'], package_data={'dragonmapper': ['data/*.tsv', 'data/*.csv']}, test_suite='dragonmapper.tests', From 795ed9c11fbe82cdab449a8d8b77feec5dcb00a4 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 02:56:39 -0600 Subject: [PATCH 10/88] Fixed formatting errors --- dragonmapper/html.py | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index b7c67ac..ac50d64 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -1,4 +1,4 @@ -# *-* coding utf8 -*- +# -*- coding: utf-8 -*- """Formatting Chinese into HTML with dragonmapper's functions""" """ @@ -6,12 +6,16 @@ DRAGONMAPPER_DIR/style.css """ +from __future__ import unicode_literals from dragonmapper import hanzi, transcriptions + _indentation = 0 -_line_html = "" +_line_html = '' + def _identify(s): + """ Returns string of text type for HTML/CSS. @@ -28,7 +32,9 @@ def _identify(s): elif c == transcriptions.UNKNOWN: return "unknown" + def _stackify(s): + """ Stack string for HTML formatting on the left and right of characters. @@ -37,10 +43,12 @@ def _stackify(s): temp_s = "" for c in s: - temp_s += c+"
" + temp_s += c + "
" return temp_s + def _html_add(s, tabs=0): + """ Wrapper for _line_html+="..." @@ -49,7 +57,8 @@ def _html_add(s, tabs=0): """ global _line_html - _line_html+=(("\n")+("\t"*(tabs+_indentation)))+s + _line_html += (("\n")+("\t"*(tabs+_indentation)))+s + def to_html(characters, bottom=None, @@ -57,6 +66,7 @@ def to_html(characters, left=None, top=None, indentation=0): + """ Returns valid HTML for the Chinese characters, and (assumed) phonetic ... ... notations provided, on any given side. @@ -66,7 +76,7 @@ def to_html(characters, ... of the character *indentation* specifies how many extra tab spaces there should be. """ - + global _indentation global _line_html _indentation = indentation @@ -78,23 +88,21 @@ def to_html(characters, _html_add("", 1) if bottom is None: - bottom = ["" for a,e in enumerate(center)] + bottom = ["" for a, e in enumerate(center)] if right is None: - right = ["" for a,e in enumerate(center)] + right = ["" for a, e in enumerate(center)] if left is None: - left = ["" for a,e in enumerate(center)] + left = ["" for a, e in enumerate(center)] if top is None: - top = ["" for a,e in enumerate(center)] + top = ["" for a, e in enumerate(center)] for y in range(0, 3): _html_add("", 2) char_num = 0 for i in range(0, len(center)*3): - x = i%3 + x = i % 3 text = "" text_type = "unknown" - #print("Y: {0}\nI: {1}\nX: {2}\nCN: {3}".format(y, i, x, char_num)) - # top if x == 1 and y == 0: text_type = _identify(top[char_num]) @@ -131,7 +139,7 @@ def to_html(characters, return _line_html if __name__ == '__main__': - zi = "你好我叫顏毅" + zi = '你好我叫顏毅' zh = hanzi.to_zhuyin(zi).split(" ") pi = transcriptions.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)).split(" ") print(to_html(zi, bottom=pi, right=zh)) From a3c1616059230270740f440988cc53f80716501e Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 03:00:03 -0600 Subject: [PATCH 11/88] Added description of image --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 4a458b2..ea60123 100644 --- a/README.rst +++ b/README.rst @@ -52,6 +52,7 @@ Features ['ㄨㄛˇ', 'ㄕˋ', 'ㄐㄧㄚ', 'ㄋㄚˊ', 'ㄉㄚˋ', 'ㄖㄣˊ'] >>> h = dragonmapper.html.to_html(s, right=zh) >>> print(h) +* When put in an HTML file, with proper styling, it will look like this: .. image:: http://s33.postimg.org/nzsw0y4qn/Screenshot_from_2016_05_24_01_17_00.png :target: http://postimg.org/image/6z9zs9rp7/ From 3a80b8ec46cc6ae0f774ee9d08518ceffc1ee9ef Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 03:03:29 -0600 Subject: [PATCH 12/88] Tweaked contribution name --- AUTHORS.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 2077e68..2a003c4 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -10,4 +10,6 @@ Author and Maintainer Contributors ------------ -Tait Hoyem — HTML output +Tait Hoyem — HTML Formatting + +Why not be the second? :-) From 1b69123e3cd700440b651bf46adf67ac35cf28a2 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 03:04:59 -0600 Subject: [PATCH 13/88] Added bullet point --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 2a003c4..b4ba68f 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -10,6 +10,6 @@ Author and Maintainer Contributors ------------ -Tait Hoyem — HTML Formatting +* Tait Hoyem — HTML Formatting Why not be the second? :-) From 07895ec260a73520240ca4f11927f609996640dc Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 11:35:55 -0600 Subject: [PATCH 14/88] Added file containing correct Unit testing strings --- dragonmapper/data/test-html-data.txt | 7 +++ dragonmapper/tests/test-html.py | 66 +++++++++++++++++++++------- 2 files changed, 57 insertions(+), 16 deletions(-) create mode 100644 dragonmapper/data/test-html-data.txt diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/test-html-data.txt new file mode 100644 index 0000000..cd5743c --- /dev/null +++ b/dragonmapper/data/test-html-data.txt @@ -0,0 +1,7 @@ +\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\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n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyán\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index f83fc2a..5b8c823 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -1,38 +1,69 @@ # -*- coding: utf-8 -*- - -"""Unit tests for dragonmapper.html.""" - from __future__ import unicode_literals +import codecs import unittest - from dragonmapper import html +"""Unit tests for dragonmapper.html.""" + + class TestHtmlFuctions(unittest.TestCase): + f = codecs.open("dragonmapper/data/test-html-data.txt", 'r', 'utf8') + s = '我叫顏毅' zh = ['ㄨㄛˇ', 'ㄐㄧㄠˋ', 'ㄧㄢˊ', 'ㄧˋ'] pi = ['wǒ', 'jiào', 'yán', 'yì'] - indented_5 = '\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\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\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tjiào\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyán\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
' + indented_5 = f.next()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') + indented_0 = f.next()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') + indented_3 = f.next()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') + zhuyin_both_pinyin_both = f.next()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') + pinyin_top = f.next()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') + zhuyin_top = f.next()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') + pinyin_bottom = f.next()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') def test_indented_5(self): - self.assertEqual(html.to_html(self.s, bottom=self.pi, left=self.zh, indentation=5), self.indented_5) + self.assertEqual( + html.to_html( + self.s, bottom=self.pi, + left=self.zh, indentation=5), + self.indented_5) def test_indented_0(self): - self.assertEqual(html.to_html(self.s, bottom=self.pi, right=self.zh, indentation=0), self.indented_3) + print(html.to_html( + self.s, bottom=self.pi, + right=self.zh, indentation=0)) + print("--------------------") + print(self.indented_0) + self.assertEqual( + html.to_html( + self.s, bottom=self.pi, + right=self.zh, indentation=0), + self.indented_0) def test_indented_3(self): - self.assertEqual(html.to_html(self.s, bottom=self.pi, top=self.zh, indentation=3), self.indented_0) + self.assertEqual( + html.to_html( + self.s, bottom=self.pi, + top=self.zh, indentation=3), + self.indented_3) def test_zhuyin_both_pinyin_both(self): - self.assertEqual(html.to_html(self.s, bottom=self.pi, top=self.pi, left=self.zh, right=self.zh), self.zhuyin_both_pinyin_both) + self.assertEqual( + html.to_html( + self.s, bottom=self.pi, + top=self.pi, left=self.zh, + right=self.zh), + self.zhuyin_both_pinyin_both) def test_pinyin_top(self): self.assertEqual(html.to_html(self.s, top=self.pi), self.pinyin_top) @@ -41,4 +72,7 @@ def test_zhuyin_top(self): self.assertEqual(html.to_html(self.s, top=self.zh), self.zhuyin_top) def test_pinyin_bottom(self): - self.assertEqual(html.to_html(self.s, bottom=self.pi), self.pinyin_bottom) + self.assertEqual( + html.to_html( + self.s, bottom=self.pi), + self.pinyin_bottom) From 2d94722b468f3c2f88654de9d7bfe2c3563a31a7 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 11:36:30 -0600 Subject: [PATCH 15/88] More compliant with PEP8 --- dragonmapper/html.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index ac50d64..4af14f3 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -1,15 +1,14 @@ # -*- coding: utf-8 -*- """Formatting Chinese into HTML with dragonmapper's functions""" -""" -See recomended CSS style: -DRAGONMAPPER_DIR/style.css -""" from __future__ import unicode_literals from dragonmapper import hanzi, transcriptions +"""See recomended CSS style: DRAGONMAPPER_DIR/style.css""" + + _indentation = 0 _line_html = '' From 59011f40e00538fd8f7ffd3e6be7acb8ce3e002d Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 11:37:36 -0600 Subject: [PATCH 16/88] Added link to HTML test data file --- dragonmapper/tests/test-html-data.txt | 1 + 1 file changed, 1 insertion(+) create mode 120000 dragonmapper/tests/test-html-data.txt diff --git a/dragonmapper/tests/test-html-data.txt b/dragonmapper/tests/test-html-data.txt new file mode 120000 index 0000000..39ec209 --- /dev/null +++ b/dragonmapper/tests/test-html-data.txt @@ -0,0 +1 @@ +../data/test-html-data.txt \ No newline at end of file From b35122bbdf1cc0561bbf07a8d4beeda3e322004e Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 12:04:12 -0600 Subject: [PATCH 17/88] Fixed v3 compatibility issue --- dragonmapper/tests/test-html.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 5b8c823..d9889ca 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -16,19 +16,19 @@ class TestHtmlFuctions(unittest.TestCase): zh = ['ㄨㄛˇ', 'ㄐㄧㄠˋ', 'ㄧㄢˊ', 'ㄧˋ'] pi = ['wǒ', 'jiào', 'yán', 'yì'] - indented_5 = f.next()\ + indented_5 = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - indented_0 = f.next()\ + indented_0 = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - indented_3 = f.next()\ + indented_3 = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - zhuyin_both_pinyin_both = f.next()\ + zhuyin_both_pinyin_both = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - pinyin_top = f.next()\ + pinyin_top = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - zhuyin_top = f.next()\ + zhuyin_top = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - pinyin_bottom = f.next()\ + pinyin_bottom = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') def test_indented_5(self): From af20557a9ab1d20c36c26e63b7512685b3630524 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 24 May 2016 12:24:20 -0600 Subject: [PATCH 18/88] Removed debugging print statements from Unit Testing --- dragonmapper/tests/test-html.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index d9889ca..b8cca26 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -39,11 +39,6 @@ def test_indented_5(self): self.indented_5) def test_indented_0(self): - print(html.to_html( - self.s, bottom=self.pi, - right=self.zh, indentation=0)) - print("--------------------") - print(self.indented_0) self.assertEqual( html.to_html( self.s, bottom=self.pi, From 025389b17a3283ab095f9fc134ff2747cad5a944 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 25 May 2016 16:40:45 -0600 Subject: [PATCH 19/88] Added internal functions for striping grammar from phonetic strings --- dragonmapper/html.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 4af14f3..3a014aa 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -59,6 +59,40 @@ def _html_add(s, tabs=0): _line_html += (("\n")+("\t"*(tabs+_indentation)))+s +def _split_grammar(ph_s): + + """ + Internal function to split grammar from the characters before it. + + *ph_s* specifies the string to preform this action on. + """ + + return ph_s.replace( + ',', " , ").replace( + '。', " 。").replace( + ':', " : ").replace( + '“', " “ ").replace( + '”', " ” ").replace( + ' ', " ").rstrip(" ") + + +def _del_grammar(ph_s): + + """ + Ineternal function to strip grammar from phonetic string. + + *ph_s* is the phonetic string to preform on + """ + + return ph.replace( + ',', " ").replace( + '。', " ").replace( + ':', " ").replace( + '“', " ").replace( + '”', " ").replace( + ' ', " ") + + def to_html(characters, bottom=None, right=None, From bffcb980dd20125136b51db39b45d1c10d649757 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 25 May 2016 16:44:11 -0600 Subject: [PATCH 20/88] Changed var name to reflect use --- dragonmapper/html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 3a014aa..5b53be0 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -59,15 +59,15 @@ def _html_add(s, tabs=0): _line_html += (("\n")+("\t"*(tabs+_indentation)))+s -def _split_grammar(ph_s): +def _split_grammar(zi_s): """ Internal function to split grammar from the characters before it. - *ph_s* specifies the string to preform this action on. + *zi_s* specifies the string to preform this action on. """ - return ph_s.replace( + return zi_s.replace( ',', " , ").replace( '。', " 。").replace( ':', " : ").replace( From f3c2f1af60aa33ea6fa43c54b6110b43e607984f Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 25 May 2016 16:45:29 -0600 Subject: [PATCH 21/88] Changed var name to reflect use, again --- dragonmapper/html.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 5b53be0..925c70f 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -76,15 +76,15 @@ def _split_grammar(zi_s): ' ', " ").rstrip(" ") -def _del_grammar(ph_s): +def _del_grammar(zi_s): """ - Ineternal function to strip grammar from phonetic string. + Ineternal function to strip grammar from string. - *ph_s* is the phonetic string to preform on + *zi_s* is the string to preform on """ - return ph.replace( + return zi.replace( ',', " ").replace( '。', " ").replace( ':', " ").replace( From 3c8707c884a51258a60f02941806efa40756f31b Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 25 May 2016 16:46:27 -0600 Subject: [PATCH 22/88] Changed var name to reflect use, again --- dragonmapper/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 925c70f..4d82e58 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -62,7 +62,7 @@ def _html_add(s, tabs=0): def _split_grammar(zi_s): """ - Internal function to split grammar from the characters before it. + Internal function to split grammar (with spaces) from the characters before it. *zi_s* specifies the string to preform this action on. """ From 344ce5b16f217031f01a5a69cd4a261603446190 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 25 May 2016 16:47:48 -0600 Subject: [PATCH 23/88] Make _stackify() XML compliant --- dragonmapper/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 4d82e58..8d4f817 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -42,7 +42,7 @@ def _stackify(s): temp_s = "" for c in s: - temp_s += c + "
" + temp_s += c + "
" return temp_s From 339e5276c7f63897224a0725241b0cbfd75b9feb Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 14:53:29 -0600 Subject: [PATCH 24/88] Added special style for punctuation marks --- dragonmapper/data/default-style.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dragonmapper/data/default-style.css b/dragonmapper/data/default-style.css index 030335e..d637f57 100644 --- a/dragonmapper/data/default-style.css +++ b/dragonmapper/data/default-style.css @@ -8,6 +8,12 @@ Default CSS style for dragonmapper text-align: center; vertical-align: middle; } +.punct{ + font-size: 1.5em; + line-height: 1em; + text-align: center; + vertical-align: middle; +} .zhuyin{ font-size: 0.6em; line-height: 1em; From 2a05e10466bc077d8f27d25b7bd1c4a1a8cf74ea Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 14:58:10 -0600 Subject: [PATCH 25/88] Now can pass hanzi.to_zhuyin() directly into .to_html() --- dragonmapper/html.py | 82 ++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 8d4f817..2499713 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -11,6 +11,7 @@ _indentation = 0 _line_html = '' +_puctuation = [',', '。', '“', '”', ':', ';'] def _identify(s): @@ -22,6 +23,8 @@ def _identify(s): """ if hanzi.has_chinese(s): return "hanzi" + elif s in _puctuation: + return "punct" else: c = transcriptions.identify(s) if c == transcriptions.ZHUYIN: @@ -59,38 +62,50 @@ def _html_add(s, tabs=0): _line_html += (("\n")+("\t"*(tabs+_indentation)))+s -def _split_grammar(zi_s): +def _split_punctuation(zi_s): """ - Internal function to split grammar (with spaces) from the characters before it. + Internal function to split punctuation (with spaces) from the characters before it. *zi_s* specifies the string to preform this action on. """ - return zi_s.replace( - ',', " , ").replace( - '。', " 。").replace( - ':', " : ").replace( - '“', " “ ").replace( - '”', " ” ").replace( - ' ', " ").rstrip(" ") + return zi_s.replace( + ',', " , ").replace( + '。', " 。").replace( + ':', " : ").replace( + ';', " ; ").replace( + '“', " “ ").replace( + '”', " ” ").replace( + ' ', " ").rstrip(" ") -def _del_grammar(zi_s): +def _del_punctuation(zi_s): """ - Ineternal function to strip grammar from string. + Ineternal function to strip punctuation from string. *zi_s* is the string to preform on """ + return zi_s.replace( + ',', " ").replace( + '。', " ").replace( + ':', " ").replace( + ';', " ").replace( + '“', " ").replace( + '”', " ").replace( + ' ', " ") - return zi.replace( - ',', " ").replace( - '。', " ").replace( - ':', " ").replace( - '“', " ").replace( - '”', " ").replace( - ' ', " ") + +def _del_split_punctuation(s): + + """ + Wrapper function for _del_punctuation(_split_punctuation(s)) + + *s* is variable to do on. + """ + + return _del_punctuation(_split_punctuation(s)) def to_html(characters, @@ -115,24 +130,33 @@ def to_html(characters, _indentation = indentation _line_html = "" - center = characters + print(characters) + print(bottom) + print(right) + + bottom = _del_split_punctuation(bottom).split(' ') + right = _del_split_punctuation(right).split(' ') + + print(characters) + print(bottom) + print(right) _html_add("") _html_add("", 1) if bottom is None: - bottom = ["" for a, e in enumerate(center)] + bottom = ["" for a, e in enumerate(characters)] if right is None: - right = ["" for a, e in enumerate(center)] + right = ["" for a, e in enumerate(characters)] if left is None: - left = ["" for a, e in enumerate(center)] + left = ["" for a, e in enumerate(characters)] if top is None: - top = ["" for a, e in enumerate(center)] + top = ["" for a, e in enumerate(characters)] for y in range(0, 3): _html_add("", 2) char_num = 0 - for i in range(0, len(center)*3): + for i in range(0, len(characters)*3): x = i % 3 text = "" text_type = "unknown" @@ -148,8 +172,8 @@ def to_html(characters, # center elif x == 1 and y == 1: - text_type = _identify(center[char_num]) - text = center[char_num] + text_type = _identify(characters[char_num]) + text = characters[char_num] # right elif x == 2 and y == 1: @@ -172,7 +196,7 @@ def to_html(characters, return _line_html if __name__ == '__main__': - zi = '你好我叫顏毅' - zh = hanzi.to_zhuyin(zi).split(" ") - pi = transcriptions.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)).split(" ") + zi = '你好,我叫顏毅。' + zh = hanzi.to_zhuyin(zi) + pi = transcriptions.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)) print(to_html(zi, bottom=pi, right=zh)) From 5ae6718fbd28f69027f65adf853e909532ade8e4 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 15:12:02 -0600 Subject: [PATCH 26/88] CHanged to reflact changes --- README.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.rst b/README.rst index ea60123..ba1100f 100644 --- a/README.rst +++ b/README.rst @@ -47,9 +47,8 @@ Features .. code:: python >>> s = "我是加拿大人" - >>> zh = hanzi.to_zhuyin(s).split(' ') >>> zh - ['ㄨㄛˇ', 'ㄕˋ', 'ㄐㄧㄚ', 'ㄋㄚˊ', 'ㄉㄚˋ', 'ㄖㄣˊ'] + 'ㄨㄛˇ ㄕˋ ㄐㄧㄚ ㄋㄚˊ ㄉㄚˋ ㄖㄣˊ' >>> h = dragonmapper.html.to_html(s, right=zh) >>> print(h) * When put in an HTML file, with proper styling, it will look like this: From a123bdd1049b4fcda4032802d9ceebb2281f7235 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 15:34:32 -0600 Subject: [PATCH 27/88] Add methods to deal with punctuation --- dragonmapper/transcriptions.py | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/dragonmapper/transcriptions.py b/dragonmapper/transcriptions.py index a4294fe..8426687 100644 --- a/dragonmapper/transcriptions.py +++ b/dragonmapper/transcriptions.py @@ -546,3 +546,52 @@ def identify(s): return IPA else: return UNKNOWN + + +def _split_punctuation(zi_s): + + """ + Internal function to split punctuation (with spaces) from the characters before it. + + *zi_s* specifies the string to preform this action on. + """ + + return zi_s.replace( + ',', " , ").replace( + '。', " 。").replace( + ':', " : ").replace( + ';', " ; ").replace( + '“', " “ ").replace( + '”', " ” ").replace( + ' ', " ").rstrip(" ") + + +def _del_punctuation(zi_s): + + """ + Ineternal function to strip punctuation from string. + + *zi_s* is the string to preform on + """ + + return zi_s.replace( + ',', " ").replace( + '。', " ").replace( + ':', " ").replace( + ';', " ").replace( + '“', " ").replace( + '”', " ").replace( + ' ', " ") + + +def del_split_punctuation(s): + + """ + Wrapper function for _del_punctuation(_split_punctuation(s)). It will split the + ...puctuation and then strip it from the string. + This can be called from other programs as needed. + + *s* is variable to do on. + """ + + return _del_punctuation(_split_punctuation(s)) From c640d202a310bd394e4f28d8b1c1e670fb68881c Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 16:46:46 -0600 Subject: [PATCH 28/88] Removed .replace(' ', ' ') --- dragonmapper/transcriptions.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dragonmapper/transcriptions.py b/dragonmapper/transcriptions.py index 8426687..5d908f1 100644 --- a/dragonmapper/transcriptions.py +++ b/dragonmapper/transcriptions.py @@ -562,8 +562,7 @@ def _split_punctuation(zi_s): ':', " : ").replace( ';', " ; ").replace( '“', " “ ").replace( - '”', " ” ").replace( - ' ', " ").rstrip(" ") + '”', " ” ").rstrip(' ') def _del_punctuation(zi_s): From 01fc2c22bab00a4386c80722ae73dacf01288bf5 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 16:50:34 -0600 Subject: [PATCH 29/88] Added keep_puct argument. Allowing for pronunciation to be preserved --- dragonmapper/html.py | 90 ++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 66 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 2499713..6e7bc8f 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -3,8 +3,8 @@ from __future__ import unicode_literals -from dragonmapper import hanzi, transcriptions - +from dragonmapper import hanzi +from dragonmapper import transcriptions as trans """See recomended CSS style: DRAGONMAPPER_DIR/style.css""" @@ -12,7 +12,7 @@ _indentation = 0 _line_html = '' _puctuation = [',', '。', '“', '”', ':', ';'] - +_tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] def _identify(s): @@ -25,13 +25,15 @@ def _identify(s): return "hanzi" elif s in _puctuation: return "punct" + elif s in _tones_marks: + return "tone-mark" else: - c = transcriptions.identify(s) - if c == transcriptions.ZHUYIN: + c = trans.identify(s) + if c == trans.ZHUYIN: return "zhuyin" - elif c == transcriptions.PINYIN: + elif c == trans.PINYIN: return "pinyin" - elif c == transcriptions.UNKNOWN: + elif c == trans.UNKNOWN: return "unknown" @@ -62,58 +64,13 @@ def _html_add(s, tabs=0): _line_html += (("\n")+("\t"*(tabs+_indentation)))+s -def _split_punctuation(zi_s): - - """ - Internal function to split punctuation (with spaces) from the characters before it. - - *zi_s* specifies the string to preform this action on. - """ - - return zi_s.replace( - ',', " , ").replace( - '。', " 。").replace( - ':', " : ").replace( - ';', " ; ").replace( - '“', " “ ").replace( - '”', " ” ").replace( - ' ', " ").rstrip(" ") - - -def _del_punctuation(zi_s): - - """ - Ineternal function to strip punctuation from string. - - *zi_s* is the string to preform on - """ - return zi_s.replace( - ',', " ").replace( - '。', " ").replace( - ':', " ").replace( - ';', " ").replace( - '“', " ").replace( - '”', " ").replace( - ' ', " ") - - -def _del_split_punctuation(s): - - """ - Wrapper function for _del_punctuation(_split_punctuation(s)) - - *s* is variable to do on. - """ - - return _del_punctuation(_split_punctuation(s)) - - def to_html(characters, bottom=None, right=None, left=None, top=None, - indentation=0): + indentation=0, + keep_puct=True): """ Returns valid HTML for the Chinese characters, and (assumed) phonetic ... @@ -123,6 +80,7 @@ def to_html(characters, *bottom/right/left/bottom* will be displayed on their respective sides ... ... of the character *indentation* specifies how many extra tab spaces there should be. + *keep_puct* will make sure that punctuation is preserved. """ global _indentation @@ -130,28 +88,28 @@ def to_html(characters, _indentation = indentation _line_html = "" - print(characters) - print(bottom) - print(right) - - bottom = _del_split_punctuation(bottom).split(' ') - right = _del_split_punctuation(right).split(' ') - - print(characters) - print(bottom) - print(right) - _html_add("
") _html_add("", 1) if bottom is None: bottom = ["" for a, e in enumerate(characters)] + elif keep_puct: + bottom = trans.del_split_punctuation(bottom).split(' ') + if right is None: right = ["" for a, e in enumerate(characters)] + elif keep_puct: + right = trans.del_split_punctuation(right).split(' ') + if left is None: left = ["" for a, e in enumerate(characters)] + elif keep_puct: + left = trans.del_split_punctuation(left).split(' ') + if top is None: top = ["" for a, e in enumerate(characters)] + elif keep_puct: + top = trans.del_split_punctuation(top).split(' ') for y in range(0, 3): _html_add("", 2) @@ -198,5 +156,5 @@ def to_html(characters, if __name__ == '__main__': zi = '你好,我叫顏毅。' zh = hanzi.to_zhuyin(zi) - pi = transcriptions.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)) + pi = trans.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)) print(to_html(zi, bottom=pi, right=zh)) From 5ab3663a6f2cdc3fe781c13058e5198477235979 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 16:51:02 -0600 Subject: [PATCH 30/88] Added style for tone-mark --- dragonmapper/data/default-style.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dragonmapper/data/default-style.css b/dragonmapper/data/default-style.css index d637f57..f4522ae 100644 --- a/dragonmapper/data/default-style.css +++ b/dragonmapper/data/default-style.css @@ -29,6 +29,10 @@ Default CSS style for dragonmapper text-align: center; vertical-align: center; } +.tone-mark{ + font-size: 1em; + text-align: center; +} .unknown{ visibility: collapse; } From bbefcc78b2ef1b8d072c97d6eb414a3fb4d27bc8 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 22:23:57 -0600 Subject: [PATCH 31/88] split_punct() added. Adds spacing so HTML formatting will work properly --- dragonmapper/transcriptions.py | 49 +++++++--------------------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/dragonmapper/transcriptions.py b/dragonmapper/transcriptions.py index 5d908f1..c93a477 100644 --- a/dragonmapper/transcriptions.py +++ b/dragonmapper/transcriptions.py @@ -548,49 +548,20 @@ def identify(s): return UNKNOWN -def _split_punctuation(zi_s): +def split_puct(zi_s): """ - Internal function to split punctuation (with spaces) from the characters before it. + Will split punctuation (with spaces) for HTML formatting. *zi_s* specifies the string to preform this action on. """ return zi_s.replace( - ',', " , ").replace( - '。', " 。").replace( - ':', " : ").replace( - ';', " ; ").replace( - '“', " “ ").replace( - '”', " ” ").rstrip(' ') - - -def _del_punctuation(zi_s): - - """ - Ineternal function to strip punctuation from string. - - *zi_s* is the string to preform on - """ - - return zi_s.replace( - ',', " ").replace( - '。', " ").replace( - ':', " ").replace( - ';', " ").replace( - '“', " ").replace( - '”', " ").replace( - ' ', " ") - - -def del_split_punctuation(s): - - """ - Wrapper function for _del_punctuation(_split_punctuation(s)). It will split the - ...puctuation and then strip it from the string. - This can be called from other programs as needed. - - *s* is variable to do on. - """ - - return _del_punctuation(_split_punctuation(s)) + ',', " ").replace( + '。', " ").replace( + ':', " ").replace( + ';', " ").replace( + '“', " ").replace( + '”', " ").replace( + " ", " ").replace( + " ", " ").rstrip(' ') From 8fd7ae92c97efea1ebb1dfedbbbd3cb7b4fe20b1 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 22:24:47 -0600 Subject: [PATCH 32/88] Moved split_punct() to html file, as it is a special function --- dragonmapper/transcriptions.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/dragonmapper/transcriptions.py b/dragonmapper/transcriptions.py index c93a477..a4294fe 100644 --- a/dragonmapper/transcriptions.py +++ b/dragonmapper/transcriptions.py @@ -546,22 +546,3 @@ def identify(s): return IPA else: return UNKNOWN - - -def split_puct(zi_s): - - """ - Will split punctuation (with spaces) for HTML formatting. - - *zi_s* specifies the string to preform this action on. - """ - - return zi_s.replace( - ',', " ").replace( - '。', " ").replace( - ':', " ").replace( - ';', " ").replace( - '“', " ").replace( - '”', " ").replace( - " ", " ").replace( - " ", " ").rstrip(' ') From ab6e93fe751a92abf89699a5469d8eaac133c2f9 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 22:47:47 -0600 Subject: [PATCH 33/88] Updated tests to include internal functions --- dragonmapper/tests/test-html.py | 38 +++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index b8cca26..2e59652 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -10,11 +10,17 @@ class TestHtmlFuctions(unittest.TestCase): + maxDiff = None + f = codecs.open("dragonmapper/data/test-html-data.txt", 'r', 'utf8') s = '我叫顏毅' - zh = ['ㄨㄛˇ', 'ㄐㄧㄠˋ', 'ㄧㄢˊ', 'ㄧˋ'] - pi = ['wǒ', 'jiào', 'yán', 'yì'] + zh = 'ㄨㄛˇ ㄐㄧㄠˋ ㄧㄢˊ ㄧˋ' + pi = 'wǒ jiào yán yì' + + s2 = '你好,我媽媽對我叫“顏毅”。' + zh2 = 'ㄋㄧˇ ㄏㄠˇ,ㄨㄛˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄨㄛˇ ㄐㄧㄠˋ:“ㄧㄢˊ ㄧˋ”' + pi2 = 'nǐ hǎo,wǒ mā mā duì wǒ jiào:“yán yì”' indented_5 = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') @@ -71,3 +77,31 @@ def test_pinyin_bottom(self): html.to_html( self.s, bottom=self.pi), self.pinyin_bottom) + + def test_identify(self): + self.assertEqual(html._identify(","), 'punct') + self.assertEqual(html._identify("你好嗎?"), 'hanzi') + self.assertEqual(html._identify("wǒ mā mā"), 'pinyin') + self.assertEqual(html._identify("ㄨㄛˇ ㄐㄧㄠˋ ㄧㄢˊ ㄧˋ"), 'zhuyin') + self.assertEqual(html._identify("1"), 'tone-mark') + self.assertEqual(html._identify("ˋ"), 'tone-mark') + self.assertEqual(html._identify(":"), 'punct') + + def test_stackify(self): + self.assertEqual(html._stackify("ni3"), "n
i
3
") + self.assertEqual(html._stackify("ㄨㄛˇ"), "ㄨ

ˇ
") + self.assertEqual(html._stackify("小狗"), "小

") + self.assertEqual(html._stackify("phantom"), + "p
h
a
n
t
o
m
") + self.assertEqual(html._stackify("gxF52f"), + "g
x
F
5
2
f
") + + def test_split_punct(self): + self.assertEqual(html._split_punct("你好嗎?"), ['你', '好', '嗎', '']) + self.assertEqual(html._split_punct("ㄨㄛˇ:ㄇㄚ ㄇㄚ"), + ['ㄨㄛˇ', '', 'ㄇㄚ', 'ㄇㄚ']) + self.assertEqual(html._split_punct("我叫:“顏毅”"), + ['我', '叫', '', '', '顏', '毅', '']) + self.assertEqual(html._split_punct( + "ni3 shi4:wo3 de5 peng2 you5 ma5?", + ['ni3', 'shi4', '', 'wo3', 'de5', 'peng2', 'you5', 'ma', '']) From ffe8e244a3b0cb695d04779e3e69597b6ac5730b Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 22:49:02 -0600 Subject: [PATCH 34/88]
->
(according to XHML standard) --- dragonmapper/data/test-html-data.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/test-html-data.txt index cd5743c..42132ad 100644 --- a/dragonmapper/data/test-html-data.txt +++ b/dragonmapper/data/test-html-data.txt @@ -1,7 +1,7 @@ -\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\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onmapper/html.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 6e7bc8f..019b7d6 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -14,6 +14,7 @@ _puctuation = [',', '。', '“', '”', ':', ';'] _tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] + def _identify(s): """ @@ -64,6 +65,25 @@ def _html_add(s, tabs=0): _line_html += (("\n")+("\t"*(tabs+_indentation)))+s +def _split_punct(zi_s): + + """ + Internal function for spliting punctuation (with spaces) for HTML formatting. + + *zi_s* specifies the string to preform this action on. + """ + + return zi_s.replace( + ',', " ").replace( + '。', " ").replace( + ':', " ").replace( + ';', " ").replace( + '“', " ").replace( + '”', " ").replace( + " ", " ").replace( + " ", " ").split(' ') + + def to_html(characters, bottom=None, right=None, @@ -80,7 +100,7 @@ def to_html(characters, *bottom/right/left/bottom* will be displayed on their respective sides ... ... of the character *indentation* specifies how many extra tab spaces there should be. - *keep_puct* will make sure that punctuation is preserved. + *keep_puct* will make sure that punct is preserved. """ global _indentation @@ -94,22 +114,22 @@ def to_html(characters, if bottom is None: bottom = ["" for a, e in enumerate(characters)] elif keep_puct: - bottom = trans.del_split_punctuation(bottom).split(' ') + bottom = _split_punct(bottom) if right is None: right = ["" for a, e in enumerate(characters)] elif keep_puct: - right = trans.del_split_punctuation(right).split(' ') + right = _split_punct(right) if left is None: left = ["" for a, e in enumerate(characters)] elif keep_puct: - left = trans.del_split_punctuation(left).split(' ') + left = _split_punct(left) if top is None: top = ["" for a, e in enumerate(characters)] elif keep_puct: - top = trans.del_split_punctuation(top).split(' ') + top = _split_punct(top) for y in range(0, 3): _html_add("", 2) From 31a837281622ba32a9e1d6eb4f29aa04a2fe96a1 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 22:51:59 -0600 Subject: [PATCH 36/88] Fixed too-long line --- dragonmapper/html.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 019b7d6..785ce52 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -68,7 +68,8 @@ def _html_add(s, tabs=0): def _split_punct(zi_s): """ - Internal function for spliting punctuation (with spaces) for HTML formatting. + Internal function for spliting punctuation (with spaces + ... only for HTML formatting. *zi_s* specifies the string to preform this action on. """ From 29b931119e6bd20aaf2d48f85de511c9050c7fee Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 22:56:50 -0600 Subject: [PATCH 37/88] More compliant with PEP8 --- dragonmapper/tests/test-html.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 2e59652..1d5b864 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -91,17 +91,21 @@ def test_stackify(self): self.assertEqual(html._stackify("ni3"), "n
i
3
") self.assertEqual(html._stackify("ㄨㄛˇ"), "ㄨ

ˇ
") self.assertEqual(html._stackify("小狗"), "小

") - self.assertEqual(html._stackify("phantom"), + self.assertEqual( + html._stackify("phantom"), "p
h
a
n
t
o
m
") - self.assertEqual(html._stackify("gxF52f"), + self.assertEqual( + html._stackify("gxF52f"), "g
x
F
5
2
f
") def test_split_punct(self): self.assertEqual(html._split_punct("你好嗎?"), ['你', '好', '嗎', '']) - self.assertEqual(html._split_punct("ㄨㄛˇ:ㄇㄚ ㄇㄚ"), + self.assertEqual( + html._split_punct("ㄨㄛˇ:ㄇㄚ ㄇㄚ"), ['ㄨㄛˇ', '', 'ㄇㄚ', 'ㄇㄚ']) - self.assertEqual(html._split_punct("我叫:“顏毅”"), + self.assertEqual( + html._split_punct("我叫:“顏毅”"), ['我', '叫', '', '', '顏', '毅', '']) - self.assertEqual(html._split_punct( - "ni3 shi4:wo3 de5 peng2 you5 ma5?", + self.assertEqual( + html._split_punct("ni3 shi4:wo3 de5 peng2 you5 ma5?"), ['ni3', 'shi4', '', 'wo3', 'de5', 'peng2', 'you5', 'ma', '']) From bac424e1221572db23e104c2c780088be3027a26 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 23:22:34 -0600 Subject: [PATCH 38/88] Fixed false-nagative tests --- dragonmapper/tests/test-html.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 1d5b864..420c641 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -99,13 +99,15 @@ def test_stackify(self): "g
x
F
5
2
f
") def test_split_punct(self): - self.assertEqual(html._split_punct("你好嗎?"), ['你', '好', '嗎', '']) + self.assertEqual( + html._split_punct("ni3 hao3 ma5?"), + ['ni3', 'hao3', 'ma5', '', '']) self.assertEqual( html._split_punct("ㄨㄛˇ:ㄇㄚ ㄇㄚ"), ['ㄨㄛˇ', '', 'ㄇㄚ', 'ㄇㄚ']) self.assertEqual( - html._split_punct("我叫:“顏毅”"), - ['我', '叫', '', '', '顏', '毅', '']) + html._split_punct("wo3 jiao4:“yan2 yi4”"), + ['wo3', 'jiao4', '', '', 'yan2', 'yi4', '', '']) self.assertEqual( html._split_punct("ni3 shi4:wo3 de5 peng2 you5 ma5?"), - ['ni3', 'shi4', '', 'wo3', 'de5', 'peng2', 'you5', 'ma', '']) + ['ni3', 'shi4', '', 'wo3', 'de5', 'peng2', 'you5', 'ma5', '', '']) From f44ed689d04aaecb08901c51325f18e888059b53 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 26 May 2016 23:23:22 -0600 Subject: [PATCH 39/88] =?UTF-8?q?Added=20=EF=BC=9F=20to=20punctuation=20li?= =?UTF-8?q?st?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dragonmapper/html.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 785ce52..b10c48d 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -11,7 +11,7 @@ _indentation = 0 _line_html = '' -_puctuation = [',', '。', '“', '”', ':', ';'] +_puctuation = [',', '。', '“', '”', ':', ';', '?'] _tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] @@ -81,6 +81,7 @@ def _split_punct(zi_s): ';', " ").replace( '“', " ").replace( '”', " ").replace( + "?", " ").replace( " ", " ").replace( " ", " ").split(' ') From 3a83f10c86a1030f15f676187a08e67f1c1deae3 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 27 May 2016 08:15:42 -0600 Subject: [PATCH 40/88] Added simple remove_grammar() function --- dragonmapper/transcriptions.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dragonmapper/transcriptions.py b/dragonmapper/transcriptions.py index a4294fe..48bc756 100644 --- a/dragonmapper/transcriptions.py +++ b/dragonmapper/transcriptions.py @@ -546,3 +546,21 @@ def identify(s): return IPA else: return UNKNOWN + +def remove_punct(s): + + """ + Simple function to remove all punctuation from strings. + (More or less, to help with formatting strings for html.to_html()) + + *s* is the stinrg to preform on. + """ + + return s.replace( + ',', " ").replace( + '。', " ").replace( + ':', " ").replace( + ';', " ").replace( + '“', " ").replace( + '”', " ").replace( + "?", " ") From a1bb926eb5491e0dde59c83b4cab92df6383f74c Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 27 May 2016 08:18:44 -0600 Subject: [PATCH 41/88] Added test for remove_punct() --- dragonmapper/tests/test-transcriptions.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dragonmapper/tests/test-transcriptions.py b/dragonmapper/tests/test-transcriptions.py index a4d5e14..6a2c41d 100644 --- a/dragonmapper/tests/test-transcriptions.py +++ b/dragonmapper/tests/test-transcriptions.py @@ -173,3 +173,9 @@ def test_issue_8(self): numbered = 'Ao4di4li4' self.assertEqual(numbered, trans.accented_to_numbered(accented)) + + def test_remove_punct(self): + pinyin = "ni3 hao3,wo3 jiao4:“yan2 yi4”" + no_punct = "ni3 hao3 wo3 jiao4 yan2 yi4" + + self.assertEqual(trans.remove_punct(pinyin), no_punct) From 7381c63c23040f15fdacaa2dabae485da0448cf5 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 27 May 2016 08:51:31 -0600 Subject: [PATCH 42/88] Changed zh_s to s: usage --- dragonmapper/html.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index b10c48d..9436ae5 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -22,6 +22,7 @@ def _identify(s): *s* is the string to identify. """ + if hanzi.has_chinese(s): return "hanzi" elif s in _puctuation: @@ -65,13 +66,13 @@ def _html_add(s, tabs=0): _line_html += (("\n")+("\t"*(tabs+_indentation)))+s -def _split_punct(zi_s): +def _split_punct(s): """ Internal function for spliting punctuation (with spaces ... only for HTML formatting. - *zi_s* specifies the string to preform this action on. + *s* specifies the string to preform this action on. """ return zi_s.replace( @@ -102,7 +103,7 @@ def to_html(characters, *bottom/right/left/bottom* will be displayed on their respective sides ... ... of the character *indentation* specifies how many extra tab spaces there should be. - *keep_puct* will make sure that punct is preserved. + *keep_puct* will make sure that punctuation is preserved. """ global _indentation From b8e6072b67388ca73671a411898f4addb5fc6d06 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 27 May 2016 08:52:19 -0600 Subject: [PATCH 43/88] More PEP8 compliant --- dragonmapper/transcriptions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dragonmapper/transcriptions.py b/dragonmapper/transcriptions.py index 48bc756..2dd33b5 100644 --- a/dragonmapper/transcriptions.py +++ b/dragonmapper/transcriptions.py @@ -547,6 +547,7 @@ def identify(s): else: return UNKNOWN + def remove_punct(s): """ From d3b9ba6de9b8c9ea09f26be544a08cf2b9eb8111 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 27 May 2016 08:55:53 -0600 Subject: [PATCH 44/88] Fixed incorrect variable name in ._split_punct() --- dragonmapper/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 9436ae5..abdbc0a 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -75,7 +75,7 @@ def _split_punct(s): *s* specifies the string to preform this action on. """ - return zi_s.replace( + return s.replace( ',', " ").replace( '。', " ").replace( ':', " ").replace( From da6420769130d47fa9992c22677c9869d7f55ca3 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 27 May 2016 08:56:33 -0600 Subject: [PATCH 45/88] Fixed test for trans.remove_punct() --- dragonmapper/tests/test-transcriptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonmapper/tests/test-transcriptions.py b/dragonmapper/tests/test-transcriptions.py index 6a2c41d..7cb4e2a 100644 --- a/dragonmapper/tests/test-transcriptions.py +++ b/dragonmapper/tests/test-transcriptions.py @@ -176,6 +176,6 @@ def test_issue_8(self): def test_remove_punct(self): pinyin = "ni3 hao3,wo3 jiao4:“yan2 yi4”" - no_punct = "ni3 hao3 wo3 jiao4 yan2 yi4" + no_punct = "ni3 hao3 wo3 jiao4 yan2 yi4 " self.assertEqual(trans.remove_punct(pinyin), no_punct) From eb3ae95c1a97d2bbdb06117046d0b89e99e1e5d3 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 27 May 2016 09:26:14 -0600 Subject: [PATCH 46/88] Updated README with new features --- README.rst | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index ba1100f..547c2a2 100644 --- a/README.rst +++ b/README.rst @@ -47,14 +47,29 @@ Features .. code:: python >>> s = "我是加拿大人" + >>> zh = hanzi.to_zhuyin(s) >>> zh 'ㄨㄛˇ ㄕˋ ㄐㄧㄚ ㄋㄚˊ ㄉㄚˋ ㄖㄣˊ' >>> h = dragonmapper.html.to_html(s, right=zh) >>> print(h) * When put in an HTML file, with proper styling, it will look like this: -.. image:: http://s33.postimg.org/nzsw0y4qn/Screenshot_from_2016_05_24_01_17_00.png - :target: http://postimg.org/image/6z9zs9rp7/ +.. image:: https://s25.postimg.org/mu1vrnsf3/Screenshot_from_2016_05_24_01_17_00.png + :target: https://postimg.org/image/vcbbvzyxn/ + +.. code:: python + + >>> s = "我是加拿大人" + >>> zh = hanzi.to_zhuyin(s) + >>> pi = trans.zhuyin_to_pinyin(zh) + >>> pi + 'wǒ shì jiā ná dà rén' + >>> h = dragonmapper.html.to_html(s, bottom=pi) + >>> print(h) +* The intermediate switch to Zhuyin, is because of spacing. You can space out the characters instead. +* Font: FZKai-Extended +.. image:: https://s25.postimg.org/h4ln7cm8v/Screenshot_from_2016_05_27_09_20_06.png + :target: https://postimg.org/image/d88bbd197/ Getting Started From a1d9ef46c1990e9cf09e0ace2dbe54e8a275fbb9 Mon Sep 17 00:00:00 2001 From: "Tait S. Hoyem" Date: Fri, 27 May 2016 18:03:52 -0600 Subject: [PATCH 47/88] Update CHANGES.rst Bump version to 0.3.0 --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 87033d4..28902de 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,6 +3,11 @@ Change Log ---------- +0.3.0 (2016-05-27) +++++++++++++++++++ + +* Added HTML Formatting. + 0.2.6 (2016-05-23) ++++++++++++++++++ From e572d9e094ffbfe8bfbe00072e3a0ecab9e9bda6 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 2 Jun 2016 17:32:53 -0600 Subject: [PATCH 48/88] Forced Pinyin compatible font --- dragonmapper/data/default-style.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dragonmapper/data/default-style.css b/dragonmapper/data/default-style.css index f4522ae..c1fdf1b 100644 --- a/dragonmapper/data/default-style.css +++ b/dragonmapper/data/default-style.css @@ -2,6 +2,8 @@ Default CSS style for dragonmapper **/ +@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro); + .hanzi{ font-size: 2em; line-height: 1em; @@ -25,7 +27,7 @@ Default CSS style for dragonmapper line-height: 1em; /** Some fonts have exess space on accented pinyin character, setting the font fixes this problem. **/ - font-family: Times, "Times New Roman", Georgia, serif; + font-family: 'Source Sans Pro', sans-serif; text-align: center; vertical-align: center; } From 69e7d598192db87773bbd66153430b26cc6385e3 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 2 Jun 2016 22:08:34 -0600 Subject: [PATCH 49/88] Removed _split_phons(): Obsolete --- dragonmapper/tests/test-transcriptions.py | 6 ------ dragonmapper/transcriptions.py | 19 ------------------- 2 files changed, 25 deletions(-) diff --git a/dragonmapper/tests/test-transcriptions.py b/dragonmapper/tests/test-transcriptions.py index 7cb4e2a..a4d5e14 100644 --- a/dragonmapper/tests/test-transcriptions.py +++ b/dragonmapper/tests/test-transcriptions.py @@ -173,9 +173,3 @@ def test_issue_8(self): numbered = 'Ao4di4li4' self.assertEqual(numbered, trans.accented_to_numbered(accented)) - - def test_remove_punct(self): - pinyin = "ni3 hao3,wo3 jiao4:“yan2 yi4”" - no_punct = "ni3 hao3 wo3 jiao4 yan2 yi4 " - - self.assertEqual(trans.remove_punct(pinyin), no_punct) diff --git a/dragonmapper/transcriptions.py b/dragonmapper/transcriptions.py index 2dd33b5..a4294fe 100644 --- a/dragonmapper/transcriptions.py +++ b/dragonmapper/transcriptions.py @@ -546,22 +546,3 @@ def identify(s): return IPA else: return UNKNOWN - - -def remove_punct(s): - - """ - Simple function to remove all punctuation from strings. - (More or less, to help with formatting strings for html.to_html()) - - *s* is the stinrg to preform on. - """ - - return s.replace( - ',', " ").replace( - '。', " ").replace( - ':', " ").replace( - ';', " ").replace( - '“', " ").replace( - '”', " ").replace( - "?", " ") From eee9adeac4f410196d4700cb339ff2f474fbba3d Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 2 Jun 2016 22:29:08 -0600 Subject: [PATCH 50/88] Made _split_punct() output cleaner. Updated tests to reflect so. --- dragonmapper/html.py | 46 +++++++++++++++++++++++---------- dragonmapper/tests/test-html.py | 17 +++++++++--- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index abdbc0a..b0656d3 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -5,6 +5,9 @@ from __future__ import unicode_literals from dragonmapper import hanzi from dragonmapper import transcriptions as trans +from zhon import pinyin +from zhon import zhuyin + """See recomended CSS style: DRAGONMAPPER_DIR/style.css""" @@ -69,22 +72,39 @@ def _html_add(s, tabs=0): def _split_punct(s): """ - Internal function for spliting punctuation (with spaces - ... only for HTML formatting. + Internal function for spliting by punctuation only for HTML formatting. - *s* specifies the string to preform this action on. + *s* specifies the list to preform this action on. """ - return s.replace( - ',', " ").replace( - '。', " ").replace( - ':', " ").replace( - ';', " ").replace( - '“', " ").replace( - '”', " ").replace( - "?", " ").replace( - " ", " ").replace( - " ", " ").split(' ') + temp = [] + + s = s.split(' ') + + def update_temp(fct, blnks, temp): + temp.append(fct) + if blnks: + temp.append("") + + for c in s: + full_char_temp = "" + did_early_append = False + for pc in c: + if (pc in zhuyin.characters or + pc in pinyin.vowels or + pc in pinyin.consonants or + pc in _tones_marks or + pc in [1,2,3,4,5]): + full_char_temp += pc + elif pc in _puctuation: + if full_char_temp != "": + temp.append(full_char_temp) + full_char_temp = "" + temp.append("") + if not did_early_append: + if full_char_temp != "": + temp.append(full_char_temp) + return temp def to_html(characters, diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 420c641..231b4b0 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -10,7 +10,7 @@ class TestHtmlFuctions(unittest.TestCase): - maxDiff = None + maxDiff = 20 f = codecs.open("dragonmapper/data/test-html-data.txt", 'r', 'utf8') @@ -22,6 +22,8 @@ class TestHtmlFuctions(unittest.TestCase): zh2 = 'ㄋㄧˇ ㄏㄠˇ,ㄨㄛˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄨㄛˇ ㄐㄧㄠˋ:“ㄧㄢˊ ㄧˋ”' pi2 = 'nǐ hǎo,wǒ mā mā duì wǒ jiào:“yán yì”' + zh3 = "ㄨㄛˇ ㄉㄨㄟˋ ㄊㄚ ㄕㄨㄛ:“ㄋㄧˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ ㄅㄚˋ ㄅㄚˋ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ ㄏㄠˇ ㄋㄩˇ ㄦ˙”””" + indented_5 = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') indented_0 = f.readline()\ @@ -101,13 +103,20 @@ def test_stackify(self): def test_split_punct(self): self.assertEqual( html._split_punct("ni3 hao3 ma5?"), - ['ni3', 'hao3', 'ma5', '', '']) + ['ni3', 'hao3', 'ma5', '']) self.assertEqual( html._split_punct("ㄨㄛˇ:ㄇㄚ ㄇㄚ"), ['ㄨㄛˇ', '', 'ㄇㄚ', 'ㄇㄚ']) self.assertEqual( html._split_punct("wo3 jiao4:“yan2 yi4”"), - ['wo3', 'jiao4', '', '', 'yan2', 'yi4', '', '']) + ['wo3', 'jiao4', '', '', 'yan2', 'yi4', '']) self.assertEqual( html._split_punct("ni3 shi4:wo3 de5 peng2 you5 ma5?"), - ['ni3', 'shi4', '', 'wo3', 'de5', 'peng2', 'you5', 'ma5', '', '']) + ['ni3', 'shi4', '', 'wo3', 'de5', 'peng2', 'you5', 'ma5', '']) + self.assertEqual( + html._split_punct( + self.zh3), + ['ㄨㄛˇ', 'ㄉㄨㄟˋ', 'ㄊㄚ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄇㄚ', 'ㄇㄚ', + 'ㄉㄨㄟˋ', 'ㄋㄧˇ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄅㄚˋ', 'ㄅㄚˋ', + 'ㄉㄨㄟˋ', 'ㄋㄧˇ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄏㄠˇ', 'ㄋㄩˇ', + 'ㄦ˙', '', '', '']) From d2ec1a4c55ad7a256cbc5719df7e609a81c89e12 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 2 Jun 2016 22:34:58 -0600 Subject: [PATCH 51/88] PEP8 Compliency --- dragonmapper/html.py | 2 +- dragonmapper/tests/test-html.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index b0656d3..96c1eb5 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -94,7 +94,7 @@ def update_temp(fct, blnks, temp): pc in pinyin.vowels or pc in pinyin.consonants or pc in _tones_marks or - pc in [1,2,3,4,5]): + pc in [1, 2, 3, 4, 5]): full_char_temp += pc elif pc in _puctuation: if full_char_temp != "": diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 231b4b0..3ab717e 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -22,7 +22,8 @@ class TestHtmlFuctions(unittest.TestCase): zh2 = 'ㄋㄧˇ ㄏㄠˇ,ㄨㄛˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄨㄛˇ ㄐㄧㄠˋ:“ㄧㄢˊ ㄧˋ”' pi2 = 'nǐ hǎo,wǒ mā mā duì wǒ jiào:“yán yì”' - zh3 = "ㄨㄛˇ ㄉㄨㄟˋ ㄊㄚ ㄕㄨㄛ:“ㄋㄧˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ ㄅㄚˋ ㄅㄚˋ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ ㄏㄠˇ ㄋㄩˇ ㄦ˙”””" + zh3 = "ㄨㄛˇ ㄉㄨㄟˋ ㄊㄚ ㄕㄨㄛ:“ㄋㄧˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ " +\ + "ㄅㄚˋ ㄅㄚˋ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ ㄏㄠˇ ㄋㄩˇ ㄦ˙”””" indented_5 = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') From 4bd47e490aa836bbd20ac3723693910396786bee Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 2 Jun 2016 22:47:44 -0600 Subject: [PATCH 52/88] Commented api.rst for testing --- docs/api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 1310cda..baaf9b6 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -235,8 +235,8 @@ lines of code. .. autofunction:: to_ipa -HTML conversion: +HTML Conversion: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Creates some HTML from the characters, and transcription systems you have. -.. autofunction:: to_html +#.. autofunction:: to_html From dd54c8e139337bf083fa0769fcce900ffad7d217 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 2 Jun 2016 23:06:40 -0600 Subject: [PATCH 53/88] Removed uncesseary lines --- dragonmapper/html.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 96c1eb5..98172d3 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -81,14 +81,8 @@ def _split_punct(s): s = s.split(' ') - def update_temp(fct, blnks, temp): - temp.append(fct) - if blnks: - temp.append("") - for c in s: full_char_temp = "" - did_early_append = False for pc in c: if (pc in zhuyin.characters or pc in pinyin.vowels or @@ -101,9 +95,8 @@ def update_temp(fct, blnks, temp): temp.append(full_char_temp) full_char_temp = "" temp.append("") - if not did_early_append: - if full_char_temp != "": - temp.append(full_char_temp) + if full_char_temp != "": + temp.append(full_char_temp) return temp From 58f1f7ee10318c17f71e71aea84eed187679faf1 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 2 Jun 2016 23:07:02 -0600 Subject: [PATCH 54/88] Updated zhon version --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8020a81..51eed4e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,4 @@ py==1.4.19 pyflakes==0.8.1 tox==1.6.1 virtualenv==1.11.2 -zhon==1.1.3 +zhon==1.1.5 From 4d8f9f522e6a96b0b4f9880c92250c7926e29df6 Mon Sep 17 00:00:00 2001 From: "Tait S. Hoyem" Date: Fri, 3 Jun 2016 11:23:28 -0600 Subject: [PATCH 55/88] Update README.rst --- README.rst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 547c2a2..694601a 100644 --- a/README.rst +++ b/README.rst @@ -52,10 +52,11 @@ Features 'ㄨㄛˇ ㄕˋ ㄐㄧㄚ ㄋㄚˊ ㄉㄚˋ ㄖㄣˊ' >>> h = dragonmapper.html.to_html(s, right=zh) >>> print(h) -* When put in an HTML file, with proper styling, it will look like this: -.. image:: https://s25.postimg.org/mu1vrnsf3/Screenshot_from_2016_05_24_01_17_00.png - :target: https://postimg.org/image/vcbbvzyxn/ +* When put in an HTML file, with proper styling, it will look like this: +* Font: FZKai-Extended +.. image:: http://s25.postimg.org/82l3nbfrz/Screenshot_from_2016_06_03_11_16_14.png + :target: http://postimg.org/image/m90uijqmz/ .. code:: python @@ -66,11 +67,19 @@ Features 'wǒ shì jiā ná dà rén' >>> h = dragonmapper.html.to_html(s, bottom=pi) >>> print(h) + * The intermediate switch to Zhuyin, is because of spacing. You can space out the characters instead. -* Font: FZKai-Extended .. image:: https://s25.postimg.org/h4ln7cm8v/Screenshot_from_2016_05_27_09_20_06.png :target: https://postimg.org/image/d88bbd197/ +* You can even mix-and-match the different phonetic systems: +* right=, and top= are also available. +.. code:: python + + >>> h = dragonmapper.html.to_html(s, bottom=pi, right=zh) +.. image:: http://s25.postimg.org/9g854vpnj/Screenshot_from_2016_06_03_11_16_57.png + :target: http://postimg.org/image/m90uijqmz/ + Getting Started --------------- From 5a491f9183422abc57b692d759935077da056b12 Mon Sep 17 00:00:00 2001 From: "Tait S. Hoyem" Date: Fri, 3 Jun 2016 11:52:26 -0600 Subject: [PATCH 56/88] Update README.rst --- README.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 694601a..0a396b8 100644 --- a/README.rst +++ b/README.rst @@ -53,8 +53,12 @@ Features >>> h = dragonmapper.html.to_html(s, right=zh) >>> print(h) +* FZKai-Extended for characters, and zhuyin: + https://www.fontyukle.net/en/DownLoad-FZKai-Z03S.ttf +* Source Sans Pro, Normal 400 (for Pinyin) [Google Fonts]: + https://www.google.com/fonts#QuickUsePlace:quickUse/Family:Source+Sans+Pro + * When put in an HTML file, with proper styling, it will look like this: -* Font: FZKai-Extended .. image:: http://s25.postimg.org/82l3nbfrz/Screenshot_from_2016_06_03_11_16_14.png :target: http://postimg.org/image/m90uijqmz/ @@ -69,8 +73,8 @@ Features >>> print(h) * The intermediate switch to Zhuyin, is because of spacing. You can space out the characters instead. -.. image:: https://s25.postimg.org/h4ln7cm8v/Screenshot_from_2016_05_27_09_20_06.png - :target: https://postimg.org/image/d88bbd197/ +.. image:: http://s25.postimg.org/9vo0bn0yn/Screenshot_from_2016_06_03_11_16_39.png + :target: http://postimg.org/image/j3g8sc80r/ * You can even mix-and-match the different phonetic systems: * right=, and top= are also available. From c34e19c5b63aa1003fadfa993b460f79568e4ff1 Mon Sep 17 00:00:00 2001 From: "Tait S. Hoyem" Date: Fri, 3 Jun 2016 11:55:47 -0600 Subject: [PATCH 57/88] Update README.rst --- README.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 0a396b8..645434f 100644 --- a/README.rst +++ b/README.rst @@ -53,11 +53,6 @@ Features >>> h = dragonmapper.html.to_html(s, right=zh) >>> print(h) -* FZKai-Extended for characters, and zhuyin: - https://www.fontyukle.net/en/DownLoad-FZKai-Z03S.ttf -* Source Sans Pro, Normal 400 (for Pinyin) [Google Fonts]: - https://www.google.com/fonts#QuickUsePlace:quickUse/Family:Source+Sans+Pro - * When put in an HTML file, with proper styling, it will look like this: .. image:: http://s25.postimg.org/82l3nbfrz/Screenshot_from_2016_06_03_11_16_14.png :target: http://postimg.org/image/m90uijqmz/ @@ -84,6 +79,11 @@ Features .. image:: http://s25.postimg.org/9g854vpnj/Screenshot_from_2016_06_03_11_16_57.png :target: http://postimg.org/image/m90uijqmz/ +* FZKai-Extended for characters, and zhuyin: + https://www.fontyukle.net/en/DownLoad-FZKai-Z03S.ttf +* Source Sans Pro, Normal 400 (for Pinyin) [Google Fonts]: + https://www.google.com/fonts#QuickUsePlace:quickUse/Family:Source+Sans+Pro + Getting Started --------------- From 0da98242d6c7c84ce06e5fbe46385a65ff0b289d Mon Sep 17 00:00:00 2001 From: "Tait S. Hoyem" Date: Fri, 3 Jun 2016 12:02:36 -0600 Subject: [PATCH 58/88] Update README.rst Centralised placement of features. --- README.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 645434f..84f362a 100644 --- a/README.rst +++ b/README.rst @@ -23,6 +23,9 @@ Features * Identify a string as Traditional or Simplified Chinese, Pinyin, Zhuyin, or the International Phonetic Alphabet. * Output HTML based on the above. +* [HTML] You can even mix-and-match the different phonetic systems: +* [HTML] right=, and top= are also available. +* [HTML] See data/default-style.css .. code:: python @@ -53,7 +56,6 @@ Features >>> h = dragonmapper.html.to_html(s, right=zh) >>> print(h) -* When put in an HTML file, with proper styling, it will look like this: .. image:: http://s25.postimg.org/82l3nbfrz/Screenshot_from_2016_06_03_11_16_14.png :target: http://postimg.org/image/m90uijqmz/ @@ -71,11 +73,14 @@ Features .. image:: http://s25.postimg.org/9vo0bn0yn/Screenshot_from_2016_06_03_11_16_39.png :target: http://postimg.org/image/j3g8sc80r/ -* You can even mix-and-match the different phonetic systems: -* right=, and top= are also available. .. code:: python - + + >>> s = "我是加拿大人" + >>> zh = hanzi.to_zhuyin(s) + >>> pi = trans.zhuyin_to_pinyin(zh) >>> h = dragonmapper.html.to_html(s, bottom=pi, right=zh) + >>> print(h) + .. image:: http://s25.postimg.org/9g854vpnj/Screenshot_from_2016_06_03_11_16_57.png :target: http://postimg.org/image/m90uijqmz/ From d3f0649b06650bf3216e00b24f900c56c0568e07 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 9 Jun 2016 18:50:19 -0600 Subject: [PATCH 59/88] Make _stackify() simpler + removed unneeded
--- dragonmapper/data/test-html-data.txt | 6 +++--- dragonmapper/html.py | 5 +---- dragonmapper/tests/test-html.py | 12 ++++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/test-html-data.txt index 42132ad..cf95f6e 100644 --- a/dragonmapper/data/test-html-data.txt +++ b/dragonmapper/data/test-html-data.txt @@ -1,7 +1,7 @@ -\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\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\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tjiào\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyán\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 98172d3..916a0c9 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -50,10 +50,7 @@ def _stackify(s): *s* is the string to "stackify". """ - temp_s = "" - for c in s: - temp_s += c + "
" - return temp_s + return "
".join(list(s)) def _html_add(s, tabs=0): diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 3ab717e..5272130 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -10,7 +10,7 @@ class TestHtmlFuctions(unittest.TestCase): - maxDiff = 20 + maxDiff = None f = codecs.open("dragonmapper/data/test-html-data.txt", 'r', 'utf8') @@ -91,15 +91,15 @@ def test_identify(self): self.assertEqual(html._identify(":"), 'punct') def test_stackify(self): - self.assertEqual(html._stackify("ni3"), "n
i
3
") - self.assertEqual(html._stackify("ㄨㄛˇ"), "ㄨ

ˇ
") - self.assertEqual(html._stackify("小狗"), "小

") + self.assertEqual(html._stackify("ni3"), "n
i
3") + self.assertEqual(html._stackify("ㄨㄛˇ"), "ㄨ

ˇ") + self.assertEqual(html._stackify("小狗"), "小
狗") self.assertEqual( html._stackify("phantom"), - "p
h
a
n
t
o
m
") + "p
h
a
n
t
o
m") self.assertEqual( html._stackify("gxF52f"), - "g
x
F
5
2
f
") + "g
x
F
5
2
f") def test_split_punct(self): self.assertEqual( From 334c3925bdb387ad3809ffeb6cf767113f70e132 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 9 Jun 2016 18:51:18 -0600 Subject: [PATCH 60/88] -> --- dragonmapper/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 916a0c9..8ea2368 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -122,7 +122,7 @@ def to_html(characters, _line_html = "" _html_add("") - _html_add("", 1) + _html_add("", 1) if bottom is None: bottom = ["" for a, e in enumerate(characters)] From bba2667c6d8a9a0d9df33a5a0f75009efa6d742c Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 9 Jun 2016 19:04:31 -0600 Subject: [PATCH 61/88] -> in test cases --- dragonmapper/data/test-html-data.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/test-html-data.txt index cf95f6e..988254c 100644 --- a/dragonmapper/data/test-html-data.txt +++ b/dragonmapper/data/test-html-data.txt @@ -1,7 +1,7 @@ -\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t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n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tjiào\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyán\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
From 5234bce641951dcc8d7a4a4320b44b01a38d0724 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 9 Jun 2016 19:08:07 -0600 Subject: [PATCH 62/88] Cleaned up enumerate() lines --- dragonmapper/html.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 8ea2368..7f722fd 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -125,22 +125,22 @@ def to_html(characters, _html_add("", 1) if bottom is None: - bottom = ["" for a, e in enumerate(characters)] + bottom = [""] * len(characters) elif keep_puct: bottom = _split_punct(bottom) if right is None: - right = ["" for a, e in enumerate(characters)] + right = [""] * len(characters) elif keep_puct: right = _split_punct(right) if left is None: - left = ["" for a, e in enumerate(characters)] + left = [""] * len(characters) elif keep_puct: left = _split_punct(left) if top is None: - top = ["" for a, e in enumerate(characters)] + top = [""] * len(characters) elif keep_puct: top = _split_punct(top) From 6fc461ca1ccbf0303c88441d5acfa28cda9708f2 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 9 Jun 2016 19:19:15 -0600 Subject: [PATCH 63/88] More exaustive list of punctuation --- dragonmapper/html.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 7f722fd..28a492d 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals from dragonmapper import hanzi from dragonmapper import transcriptions as trans +import zhon from zhon import pinyin from zhon import zhuyin @@ -14,7 +15,7 @@ _indentation = 0 _line_html = '' -_puctuation = [',', '。', '“', '”', ':', ';', '?'] +_puctuation = tuple(zhon.hanzi.punctuation + zhon.pinyin.punctuation) _tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] @@ -28,6 +29,8 @@ def _identify(s): if hanzi.has_chinese(s): return "hanzi" + elif s == "": + return "unknown" elif s in _puctuation: return "punct" elif s in _tones_marks: From 55bed18cb980b70f5da44f874d09032f7529a338 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 9 Jun 2016 20:00:15 -0600 Subject: [PATCH 64/88] removed uneeded [1,2,3,4,5] --- dragonmapper/html.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 28a492d..4a90c0b 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -87,8 +87,7 @@ def _split_punct(s): if (pc in zhuyin.characters or pc in pinyin.vowels or pc in pinyin.consonants or - pc in _tones_marks or - pc in [1, 2, 3, 4, 5]): + pc in _tones_marks): full_char_temp += pc elif pc in _puctuation: if full_char_temp != "": From 71c4c3afa527f561ef10ce45bce40b0faf360660 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Fri, 10 Jun 2016 12:32:36 -0600 Subject: [PATCH 65/88] Removed split_punct argument. Added tests --- dragonmapper/data/test-html-data.txt | 1 + dragonmapper/html.py | 16 ++++++++-------- dragonmapper/tests/test-html.py | 9 +++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/test-html-data.txt index 988254c..4e842ba 100644 --- a/dragonmapper/data/test-html-data.txt +++ b/dragonmapper/data/test-html-data.txt @@ -5,3 +5,4 @@ \n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tjiào\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyán\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\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\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyan2\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyi4\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 4a90c0b..b6f4b16 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -104,8 +104,7 @@ def to_html(characters, right=None, left=None, top=None, - indentation=0, - keep_puct=True): + indentation=0): """ Returns valid HTML for the Chinese characters, and (assumed) phonetic ... @@ -113,9 +112,9 @@ def to_html(characters, *characters* will be displayed in the middle of each output table. *bottom/right/left/bottom* will be displayed on their respective sides ... - ... of the character + ... of the character. Strings from dragonmapper.transcriptions, ... + ... dragonmapper.hanzi.to_xxxyin, or an array/tuple are acceptable. *indentation* specifies how many extra tab spaces there should be. - *keep_puct* will make sure that punctuation is preserved. """ global _indentation @@ -128,22 +127,23 @@ def to_html(characters, if bottom is None: bottom = [""] * len(characters) - elif keep_puct: + # Signifies that bottom is not an array with 1-1 correspondence + elif len(bottom) > len(characters): bottom = _split_punct(bottom) if right is None: right = [""] * len(characters) - elif keep_puct: + elif len(right) > len(characters): right = _split_punct(right) if left is None: left = [""] * len(characters) - elif keep_puct: + elif len(left) > len(characters): left = _split_punct(left) if top is None: top = [""] * len(characters) - elif keep_puct: + elif len(top) > len(characters): top = _split_punct(top) for y in range(0, 3): diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 5272130..d654b16 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -21,6 +21,7 @@ class TestHtmlFuctions(unittest.TestCase): s2 = '你好,我媽媽對我叫“顏毅”。' zh2 = 'ㄋㄧˇ ㄏㄠˇ,ㄨㄛˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄨㄛˇ ㄐㄧㄠˋ:“ㄧㄢˊ ㄧˋ”' pi2 = 'nǐ hǎo,wǒ mā mā duì wǒ jiào:“yán yì”' + zh2_man = ['', '', '', '', '', '', '', '', '', '', 'yan2', 'yi4', '', ''] zh3 = "ㄨㄛˇ ㄉㄨㄟˋ ㄊㄚ ㄕㄨㄛ:“ㄋㄧˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ " +\ "ㄅㄚˋ ㄅㄚˋ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ ㄏㄠˇ ㄋㄩˇ ㄦ˙”””" @@ -39,6 +40,8 @@ class TestHtmlFuctions(unittest.TestCase): .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') pinyin_bottom = f.readline()\ .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') + manual_pinyin = f.readline()\ + .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') def test_indented_5(self): self.assertEqual( @@ -121,3 +124,9 @@ def test_split_punct(self): 'ㄉㄨㄟˋ', 'ㄋㄧˇ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄅㄚˋ', 'ㄅㄚˋ', 'ㄉㄨㄟˋ', 'ㄋㄧˇ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄏㄠˇ', 'ㄋㄩˇ', 'ㄦ˙', '', '', '']) + + def test_manual_phonetics_input(self): + self.assertEqual( + html.to_html( + self.s2, bottom=self.zh2_man), + self.manual_pinyin) From e9f184588eb64bd87700a4ebfca0a7700e6c1886 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Mon, 13 Jun 2016 16:08:50 -0600 Subject: [PATCH 66/88] Removed long sections of code, replaced with functions --- dragonmapper/html.py | 138 ++++++++++++++++++++++++++++--------------- 1 file changed, 92 insertions(+), 46 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index b6f4b16..6cc6560 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -12,6 +12,32 @@ """See recomended CSS style: DRAGONMAPPER_DIR/style.css""" +TOP_LEFT = 0 +TOP_MID = 1 +TOP_RIGHT = 2 +MID_LEFT = 3 +MID_MID = 4 +MID_RIGHT = 5 +LOW_LEFT = 6 +LOW_MID = 7 +LOW_RIGHT = 8 + +TOP = TOP_MID +LEFT = MID_LEFT +CENTER = MID_MID +RIGHT = MID_RIGHT +BOTTOM = LOW_MID + +PUT_TEXT_PLACES = (TOP, LEFT, CENTER, RIGHT, BOTTOM) +NEW_CHARCTER_PLACES = (TOP_RIGHT, MID_RIGHT, LOW_RIGHT) +STACKED_SIDES = (LEFT, RIGHT) +PLACES = ( + TOP_LEFT, TOP_MID, TOP_RIGHT, + MID_LEFT, MID_MID, MID_RIGHT, + LOW_LEFT, LOW_MID, LOW_RIGHT, + TOP, LEFT, RIGHT, BOTTOM, CENTER, +) +places = PLACES _indentation = 0 _line_html = '' @@ -99,6 +125,53 @@ def _split_punct(s): return temp +def _return_correct_side(x, y, t, l, c, r, b): + + """ + Returns what side is being referenced by the coordinates, and the ... + ... coresponding list. + + *x, y* are the coordinates + *t, l, c, r, b* are top, left, center, right, and bottom, respectively. + """ + + if x == 0 and y == 0: + return ([], TOP_LEFT) + elif x == 1 and y == 0: + return (t, TOP) + elif x == 2 and y == 0: + return ([], TOP_RIGHT) + elif x == 0 and y == 1: + return (l, LEFT) + elif x == 1 and y == 1: + return (c, CENTER) + elif x == 2 and y == 1: + return (r, RIGHT) + elif x == 0 and y == 2: + return ([], LOW_LEFT) + elif x == 1 and y == 2: + return (b, BOTTOM) + elif x == 2 and y == 2: + return ([], LOW_RIGHT) + + +def _fix_empty_arrays(a, length): + + """ + Returns array of length 'length' if it does not contain anything ... + ... otherwise returns _split_punct(a) + + *a* is the array to proform the action on + *length* is the length + """ + + if a is None: + a = [""] * length + elif len(a) > length: + a = _split_punct(a) + return a + + def to_html(characters, bottom=None, right=None, @@ -121,62 +194,35 @@ def to_html(characters, global _line_html _indentation = indentation _line_html = "" + proper_length = len(characters) _html_add("") _html_add("", 1) - if bottom is None: - bottom = [""] * len(characters) - # Signifies that bottom is not an array with 1-1 correspondence - elif len(bottom) > len(characters): - bottom = _split_punct(bottom) - - if right is None: - right = [""] * len(characters) - elif len(right) > len(characters): - right = _split_punct(right) - - if left is None: - left = [""] * len(characters) - elif len(left) > len(characters): - left = _split_punct(left) - - if top is None: - top = [""] * len(characters) - elif len(top) > len(characters): - top = _split_punct(top) + top = _fix_empty_arrays(top, proper_length) + left = _fix_empty_arrays(left, proper_length) + right = _fix_empty_arrays(right, proper_length) + bottom = _fix_empty_arrays(bottom, proper_length) for y in range(0, 3): _html_add("", 2) char_num = 0 - for i in range(0, len(characters)*3): + for i in range(0, (len(characters)*3)): x = i % 3 text = "" text_type = "unknown" - # top - if x == 1 and y == 0: - text_type = _identify(top[char_num]) - text = top[char_num] - char_num += 1 - # left - elif x == 0 and y == 1: - text_type = _identify(left[char_num]) - text = _stackify(left[char_num]) - - # center - elif x == 1 and y == 1: - text_type = _identify(characters[char_num]) - text = characters[char_num] - - # right - elif x == 2 and y == 1: - text_type = _identify(right[char_num]) - text = _stackify(right[char_num]) - char_num += 1 - # bottom - elif x == 1 and y == 2: - text_type = _identify(bottom[char_num]) - text = bottom[char_num] + + current_side, side = _return_correct_side( + x, y, top, left, characters, right, bottom) + + if side in PUT_TEXT_PLACES: + text_type = _identify(current_side[char_num]) + if side in STACKED_SIDES: + text = _stackify(current_side[char_num]) + else: + text = current_side[char_num] + + if side in NEW_CHARCTER_PLACES: char_num += 1 _html_add("", 3) _html_add("", 2) _html_add("", 1) _html_add("
".format(text_type), 3) @@ -189,7 +235,7 @@ def to_html(characters, return _line_html if __name__ == '__main__': - zi = '你好,我叫顏毅。' + zi = '你好,我叫顏毅。我是加拿大人!' zh = hanzi.to_zhuyin(zi) pi = trans.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)) print(to_html(zi, bottom=pi, right=zh)) From 714f45ce811ec0556e128a097b78d7e56800bfbb Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Mon, 13 Jun 2016 16:09:06 -0600 Subject: [PATCH 67/88] Add test for new functions --- dragonmapper/tests/test-html.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index d654b16..6554818 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -130,3 +130,31 @@ def test_manual_phonetics_input(self): html.to_html( self.s2, bottom=self.zh2_man), self.manual_pinyin) + + def test_return_correct_sid(self): + self.assertEqual( + html._return_correct_side( + 2, 0, [], [], [], [], [] + ), + ([], html.places.TOP_RIGHT) + ) + self.assertEqual( + html._return_correct_side( + 2, 2, [], [], [], [], [] + ), + ([], html.places.LOW_RIGHT) + ) + self.assertEqual( + html._return_correct_side( + 1, 2, [], [], [], [], [] + ), + ([], html.places.BOTTOM) + ) + + def test_fix_empty_arrays(self): + self.assertEqual( + html._fix_empty_arrays( + None, 6 + ), + [""] * 6 + ) From 98c4639cadb227ded03d49ab2ce13470917d049c Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Mon, 13 Jun 2016 16:10:52 -0600 Subject: [PATCH 68/88] Changes variable name for clarity --- dragonmapper/html.py | 1 - dragonmapper/tests/test-html.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 6cc6560..56e8622 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -37,7 +37,6 @@ LOW_LEFT, LOW_MID, LOW_RIGHT, TOP, LEFT, RIGHT, BOTTOM, CENTER, ) -places = PLACES _indentation = 0 _line_html = '' diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 6554818..b5afc40 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -136,19 +136,19 @@ def test_return_correct_sid(self): html._return_correct_side( 2, 0, [], [], [], [], [] ), - ([], html.places.TOP_RIGHT) + ([], html.PLACES.TOP_RIGHT) ) self.assertEqual( html._return_correct_side( 2, 2, [], [], [], [], [] ), - ([], html.places.LOW_RIGHT) + ([], html.PLACES.LOW_RIGHT) ) self.assertEqual( html._return_correct_side( 1, 2, [], [], [], [], [] ), - ([], html.places.BOTTOM) + ([], html.PLACES.BOTTOM) ) def test_fix_empty_arrays(self): From a5c4fcdb4601747f1ffadf617f7e362a31a1dd26 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Mon, 13 Jun 2016 16:12:44 -0600 Subject: [PATCH 69/88] Removed unneeded variables --- dragonmapper/html.py | 6 ------ dragonmapper/tests/test-html.py | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 56e8622..e1dd667 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -31,12 +31,6 @@ PUT_TEXT_PLACES = (TOP, LEFT, CENTER, RIGHT, BOTTOM) NEW_CHARCTER_PLACES = (TOP_RIGHT, MID_RIGHT, LOW_RIGHT) STACKED_SIDES = (LEFT, RIGHT) -PLACES = ( - TOP_LEFT, TOP_MID, TOP_RIGHT, - MID_LEFT, MID_MID, MID_RIGHT, - LOW_LEFT, LOW_MID, LOW_RIGHT, - TOP, LEFT, RIGHT, BOTTOM, CENTER, -) _indentation = 0 _line_html = '' diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index b5afc40..29bc49e 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -136,19 +136,19 @@ def test_return_correct_sid(self): html._return_correct_side( 2, 0, [], [], [], [], [] ), - ([], html.PLACES.TOP_RIGHT) + ([], html.TOP_RIGHT) ) self.assertEqual( html._return_correct_side( 2, 2, [], [], [], [], [] ), - ([], html.PLACES.LOW_RIGHT) + ([], html.LOW_RIGHT) ) self.assertEqual( html._return_correct_side( 1, 2, [], [], [], [], [] ), - ([], html.PLACES.BOTTOM) + ([], html.BOTTOM) ) def test_fix_empty_arrays(self): From 225af7e9d7f044d3eeb0aaceb774b1fad9102761 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 14 Jun 2016 13:22:24 -0600 Subject: [PATCH 70/88] Added proper attribution --- AUTHORS.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index b4ba68f..b2a3d7a 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -13,3 +13,9 @@ Contributors * Tait Hoyem — HTML Formatting Why not be the second? :-) + +Attribution +------------ + +* Sun Jianai — FZKai-Extended font [used in pictures] +* Google — [Source Sans Pro, Normal 400](https://www.google.com/fonts#QuickUsePlace:quickUse/Family:Source+Sans+Pro) [used for Pinyin font] From 3c03a6db77938cd810942c4c012e04fb55b62522 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 14 Jun 2016 13:23:01 -0600 Subject: [PATCH 71/88] moved attribution from here --- README.rst | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 84f362a..9fe0354 100644 --- a/README.rst +++ b/README.rst @@ -74,7 +74,7 @@ Features :target: http://postimg.org/image/j3g8sc80r/ .. code:: python - + >>> s = "我是加拿大人" >>> zh = hanzi.to_zhuyin(s) >>> pi = trans.zhuyin_to_pinyin(zh) @@ -84,12 +84,6 @@ Features .. image:: http://s25.postimg.org/9g854vpnj/Screenshot_from_2016_06_03_11_16_57.png :target: http://postimg.org/image/m90uijqmz/ -* FZKai-Extended for characters, and zhuyin: - https://www.fontyukle.net/en/DownLoad-FZKai-Z03S.ttf -* Source Sans Pro, Normal 400 (for Pinyin) [Google Fonts]: - https://www.google.com/fonts#QuickUsePlace:quickUse/Family:Source+Sans+Pro - - Getting Started --------------- * `Install Dragon Mapper `_ From 9d57d92553090a409782b079e0b3c09920ad63b4 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Mon, 20 Jun 2016 15:27:38 -0600 Subject: [PATCH 72/88] Added class='xyz character' --- dragonmapper/data/test-html-data.txt | 16 ++++----- dragonmapper/html.py | 53 +++++++++++++++++++++++++--- dragonmapper/tests/test-html.py | 6 ++++ 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/test-html-data.txt index 4e842ba..d193be4 100644 --- a/dragonmapper/data/test-html-data.txt +++ b/dragonmapper/data/test-html-data.txt @@ -1,8 +1,8 @@ -\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\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t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyan2\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\tyi4\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
diff --git a/dragonmapper/html.py b/dragonmapper/html.py index e1dd667..46651e6 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -29,8 +29,14 @@ BOTTOM = LOW_MID PUT_TEXT_PLACES = (TOP, LEFT, CENTER, RIGHT, BOTTOM) -NEW_CHARCTER_PLACES = (TOP_RIGHT, MID_RIGHT, LOW_RIGHT) -STACKED_SIDES = (LEFT, RIGHT) + +TOP_PLACES = (TOP_LEFT, TOP_MID, TOP_RIGHT) +LEFT_PLACES = (TOP_LEFT, MID_LEFT, LOW_LEFT) +RIGHT_PLACES = (TOP_RIGHT, MID_RIGHT, LOW_RIGHT) +BOTTOM_PLACES = (LOW_LEFT, LOW_MID, LOW_RIGHT) + +STACKED_PLACES = (LEFT, RIGHT) + _indentation = 0 _line_html = '' @@ -60,9 +66,24 @@ def _identify(s): return "zhuyin" elif c == trans.PINYIN: return "pinyin" + elif c == trans.IPA: + return "ipa" elif c == trans.UNKNOWN: return "unknown" +def _is_phonetic_script(s): + + """ + Returns bool if s is any phonetic script. + + *s* string to preform test on + """ + + i_s = _identify(s) + if i_s == "pinyin" or i_s == "zhuyin" or i_s == "ipa": + return True + return False + def _stackify(s): @@ -170,6 +191,7 @@ def to_html(characters, right=None, left=None, top=None, + minified=False, indentation=0): """ @@ -210,21 +232,42 @@ def to_html(characters, if side in PUT_TEXT_PLACES: text_type = _identify(current_side[char_num]) - if side in STACKED_SIDES: + if side in STACKED_PLACES: text = _stackify(current_side[char_num]) else: text = current_side[char_num] - if side in NEW_CHARCTER_PLACES: + if text is not "": + if _is_phonetic_script(text): + _html_add( + "
".format( + text_type, characters[char_num], 'phonetic-script'), + 3) + else: + _html_add( + "".format( + text_type, characters[char_num]), + 3) + # If the text is blank + else: + _html_add( + "".format( + text_type), + 3) + + if side in RIGHT_PLACES: char_num += 1 + - _html_add("".format(text_type), 3) _html_add("{0}".format(text), 4) _html_add("
") + + if minified: + return _line_html.replace('\t', '').replace('\n', '') return _line_html if __name__ == '__main__': diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 29bc49e..33e8b96 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -158,3 +158,9 @@ def test_fix_empty_arrays(self): ), [""] * 6 ) + + def test_is_phonetic_script(self): + self.assertEqual(html._is_phonetic_script("ni3"), True) + self.assertEqual(html._is_phonetic_script("老f22x9-\\"), False) + self.assertEqual(html._is_phonetic_script("ni˧˩˧ xɑʊ˧˩˧"), True) + self.assertEqual(html._is_phonetic_script("ㄨㄛˇ"), True) From 9e93c6739c2da6b18eb8810596b825b92ad61bd6 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Mon, 20 Jun 2016 15:33:45 -0600 Subject: [PATCH 73/88] PEP8 --- dragonmapper/html.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 46651e6..92bd122 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -71,6 +71,7 @@ def _identify(s): elif c == trans.UNKNOWN: return "unknown" + def _is_phonetic_script(s): """ @@ -241,7 +242,9 @@ def to_html(characters, if _is_phonetic_script(text): _html_add( "".format( - text_type, characters[char_num], 'phonetic-script'), + text_type, + characters[char_num], + 'phonetic-script'), 3) else: _html_add( @@ -257,7 +260,6 @@ def to_html(characters, if side in RIGHT_PLACES: char_num += 1 - _html_add("{0}".format(text), 4) _html_add("", 3) From dbd2df2b8366f5b4e066d1a7a63950e3296a6113 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 12 Jul 2016 09:22:00 -0600 Subject: [PATCH 74/88] Added CSS classes --- dragonmapper/html.py | 115 +++++++++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 37 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 92bd122..0db1775 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -43,7 +43,6 @@ _puctuation = tuple(zhon.hanzi.punctuation + zhon.pinyin.punctuation) _tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] - def _identify(s): """ @@ -140,7 +139,7 @@ def _split_punct(s): return temp -def _return_correct_side(x, y, t, l, c, r, b): +def _return_correct_side(x, y, t, l, c, r, b, bl, br, tl, tr): """ Returns what side is being referenced by the coordinates, and the ... @@ -148,14 +147,15 @@ def _return_correct_side(x, y, t, l, c, r, b): *x, y* are the coordinates *t, l, c, r, b* are top, left, center, right, and bottom, respectively. + *bl, br, tl, and tr* are bottom left, bottom right, top left, and top right. """ if x == 0 and y == 0: - return ([], TOP_LEFT) + return (tl, TOP_LEFT) elif x == 1 and y == 0: return (t, TOP) elif x == 2 and y == 0: - return ([], TOP_RIGHT) + return (tr, TOP_RIGHT) elif x == 0 and y == 1: return (l, LEFT) elif x == 1 and y == 1: @@ -163,12 +163,39 @@ def _return_correct_side(x, y, t, l, c, r, b): elif x == 2 and y == 1: return (r, RIGHT) elif x == 0 and y == 2: - return ([], LOW_LEFT) + return (bl, LOW_LEFT) elif x == 1 and y == 2: return (b, BOTTOM) elif x == 2 and y == 2: - return ([], LOW_RIGHT) + return (br, LOW_RIGHT) + +def _get_side_string(s): + """ + Returns side as string (for html-css referencing) + s is int constant + """ + + result = "" + if s == TOP_LEFT: + result = "top-left" + elif s == TOP_MID: + result = "top-mid top" + elif s == TOP_RIGHT: + result = "top-right" + elif s == MID_LEFT: + result = "mid-left left" + elif s == MID_MID: + result = "mid-mid center" + elif s == MID_RIGHT: + result = "mid-right right" + elif s == LOW_LEFT: + result = "low-left" + elif s == LOW_MID: + result = "low-mid bottom" + elif s == LOW_RIGHT: + result = "low-right" + return result def _fix_empty_arrays(a, length): @@ -188,10 +215,14 @@ def _fix_empty_arrays(a, length): def to_html(characters, + bottom_left=None, bottom=None, + bottom_right=None, right=None, left=None, + top_left=None, top=None, + top_right=None, minified=False, indentation=0): @@ -200,7 +231,7 @@ def to_html(characters, ... notations provided, on any given side. *characters* will be displayed in the middle of each output table. - *bottom/right/left/bottom* will be displayed on their respective sides ... + *bottom/right/left/bottom ...* will be displayed on their respective sides ... ... of the character. Strings from dragonmapper.transcriptions, ... ... dragonmapper.hanzi.to_xxxyin, or an array/tuple are acceptable. *indentation* specifies how many extra tab spaces there should be. @@ -212,13 +243,25 @@ def to_html(characters, _line_html = "" proper_length = len(characters) - _html_add("") + char_type = 'unknown' + if hanzi.is_traditional(characters) and hanzi.is_simplified(characters): + char_type = 'traditional-simplified-same' + elif hanzi.is_traditional(characters): + char_type = 'traditional' + elif hanzi.is_simplified(characters): + char_type = 'simplified' + + _html_add("
".format("".join(characters), char_type)) _html_add("", 1) + top_left = _fix_empty_arrays(top_left, proper_length) top = _fix_empty_arrays(top, proper_length) + top_right = _fix_empty_arrays(top_right, proper_length) left = _fix_empty_arrays(left, proper_length) right = _fix_empty_arrays(right, proper_length) + bottom_left = _fix_empty_arrays(bottom_left, proper_length) bottom = _fix_empty_arrays(bottom, proper_length) + bottom_right = _fix_empty_arrays(bottom_right, proper_length) for y in range(0, 3): _html_add("", 2) @@ -227,43 +270,41 @@ def to_html(characters, x = i % 3 text = "" text_type = "unknown" + phonetic_script_string = "" current_side, side = _return_correct_side( - x, y, top, left, characters, right, bottom) - - if side in PUT_TEXT_PLACES: - text_type = _identify(current_side[char_num]) - if side in STACKED_PLACES: - text = _stackify(current_side[char_num]) - else: - text = current_side[char_num] - - if text is not "": - if _is_phonetic_script(text): - _html_add( - "".format( + characters), 3) + else: + _html_add("", 3) if side in RIGHT_PLACES: char_num += 1 - - _html_add("{0}".format(text), 4) - _html_add("", 3) - _html_add("", 2) _html_add("", 1) _html_add("
".format( - text_type, - characters[char_num], - 'phonetic-script'), - 3) - else: - _html_add( - "".format( - text_type, characters[char_num]), - 3) - # If the text is blank + x, y, top, left, characters, right, bottom, + bottom_left, bottom_right, top_left, top_right + ) + + text_type = _identify(current_side[char_num]) + if side in STACKED_PLACES: + text = _stackify(current_side[char_num]) else: + text = current_side[char_num] + + if _is_phonetic_script(text): + phonetic_script_string = " phonetic-script" + + if text is "": _html_add( - "".format( - text_type), + "", 3) + _html_add( + "{4}".format( + characters, + phonetic_script_string, + text_type, + _get_side_string(side), + text), + 4) + _html_add("
") From c7af733fe87d5dea975f0f13d572d78f398d002a Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 12 Jul 2016 11:06:34 -0600 Subject: [PATCH 75/88] Updated tests --- dragonmapper/data/test-html-data.txt | 16 ++++++++-------- dragonmapper/tests/test-html.py | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/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\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\tyan2\n\t\t\t\n\t\t\t\tyi4\n\t\t\t
diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 33e8b96..c59b9ca 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -134,19 +134,19 @@ def test_manual_phonetics_input(self): def test_return_correct_sid(self): self.assertEqual( html._return_correct_side( - 2, 0, [], [], [], [], [] + 2, 0, [], [], [], [], [], [], [], [], [] ), ([], html.TOP_RIGHT) ) self.assertEqual( html._return_correct_side( - 2, 2, [], [], [], [], [] + 2, 2, [], [], [], [], [], [], [], [], [] ), ([], html.LOW_RIGHT) ) self.assertEqual( html._return_correct_side( - 1, 2, [], [], [], [], [] + 1, 2, [], [], [], [], [], [], [], [], [] ), ([], html.BOTTOM) ) From 61ef624f113aed2b4050d0124923a402b0150af3 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Tue, 12 Jul 2016 11:12:49 -0600 Subject: [PATCH 76/88] PEP8 --- dragonmapper/html.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 0db1775..854f575 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -43,6 +43,7 @@ _puctuation = tuple(zhon.hanzi.punctuation + zhon.pinyin.punctuation) _tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] + def _identify(s): """ @@ -147,7 +148,7 @@ def _return_correct_side(x, y, t, l, c, r, b, bl, br, tl, tr): *x, y* are the coordinates *t, l, c, r, b* are top, left, center, right, and bottom, respectively. - *bl, br, tl, and tr* are bottom left, bottom right, top left, and top right. + *bl, br, tl, and tr* are bottomleft, bottomright, topleft, and topright. """ if x == 0 and y == 0: @@ -169,6 +170,7 @@ def _return_correct_side(x, y, t, l, c, r, b, bl, br, tl, tr): elif x == 2 and y == 2: return (br, LOW_RIGHT) + def _get_side_string(s): """ Returns side as string (for html-css referencing) @@ -197,6 +199,7 @@ def _get_side_string(s): result = "low-right" return result + def _fix_empty_arrays(a, length): """ @@ -231,8 +234,8 @@ def to_html(characters, ... notations provided, on any given side. *characters* will be displayed in the middle of each output table. - *bottom/right/left/bottom ...* will be displayed on their respective sides ... - ... of the character. Strings from dragonmapper.transcriptions, ... + *bottom/right/left/bottom ...* will be displayed on their respective ... + ... sides of the character. Strings from dragonmapper.transcriptions, ... ... dragonmapper.hanzi.to_xxxyin, or an array/tuple are acceptable. *indentation* specifies how many extra tab spaces there should be. """ @@ -251,7 +254,10 @@ def to_html(characters, elif hanzi.is_simplified(characters): char_type = 'simplified' - _html_add("".format("".join(characters), char_type)) + _html_add( + "
".format( + "".join(characters), char_type) + ) _html_add("", 1) top_left = _fix_empty_arrays(top_left, proper_length) From 2c7787aa1715be0a6bf51e1c797206a496c838e2 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Sat, 30 Jul 2016 16:13:05 -0600 Subject: [PATCH 77/88] Added more simple ruby function --- dragonmapper/html.py | 99 +++++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 28 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 854f575..4be598b 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -140,7 +140,7 @@ def _split_punct(s): return temp -def _return_correct_side(x, y, t, l, c, r, b, bl, br, tl, tr): +def _return_correct_side(x, y, t, l, c, r, b): """ Returns what side is being referenced by the coordinates, and the ... @@ -148,28 +148,23 @@ def _return_correct_side(x, y, t, l, c, r, b, bl, br, tl, tr): *x, y* are the coordinates *t, l, c, r, b* are top, left, center, right, and bottom, respectively. - *bl, br, tl, and tr* are bottomleft, bottomright, topleft, and topright. """ - if x == 0 and y == 0: - return (tl, TOP_LEFT) - elif x == 1 and y == 0: + # top + if x == 1 and y == 0: return (t, TOP) - elif x == 2 and y == 0: - return (tr, TOP_RIGHT) + # left elif x == 0 and y == 1: return (l, LEFT) + # characters/center elif x == 1 and y == 1: return (c, CENTER) + # right elif x == 2 and y == 1: return (r, RIGHT) - elif x == 0 and y == 2: - return (bl, LOW_LEFT) + # bottom elif x == 1 and y == 2: return (b, BOTTOM) - elif x == 2 and y == 2: - return (br, LOW_RIGHT) - def _get_side_string(s): """ @@ -209,23 +204,18 @@ def _fix_empty_arrays(a, length): *a* is the array to proform the action on *length* is the length """ - if a is None: a = [""] * length - elif len(a) > length: + elif len(a) != length: a = _split_punct(a) return a def to_html(characters, - bottom_left=None, bottom=None, - bottom_right=None, right=None, left=None, - top_left=None, top=None, - top_right=None, minified=False, indentation=0): @@ -246,6 +236,11 @@ def to_html(characters, _line_html = "" proper_length = len(characters) + top = _fix_empty_arrays(top, proper_length) + left = _fix_empty_arrays(left, proper_length) + right = _fix_empty_arrays(right, proper_length) + bottom = _fix_empty_arrays(bottom, proper_length) + char_type = 'unknown' if hanzi.is_traditional(characters) and hanzi.is_simplified(characters): char_type = 'traditional-simplified-same' @@ -260,15 +255,6 @@ def to_html(characters, ) _html_add("", 1) - top_left = _fix_empty_arrays(top_left, proper_length) - top = _fix_empty_arrays(top, proper_length) - top_right = _fix_empty_arrays(top_right, proper_length) - left = _fix_empty_arrays(left, proper_length) - right = _fix_empty_arrays(right, proper_length) - bottom_left = _fix_empty_arrays(bottom_left, proper_length) - bottom = _fix_empty_arrays(bottom, proper_length) - bottom_right = _fix_empty_arrays(bottom_right, proper_length) - for y in range(0, 3): _html_add("", 2) char_num = 0 @@ -280,7 +266,6 @@ def to_html(characters, current_side, side = _return_correct_side( x, y, top, left, characters, right, bottom, - bottom_left, bottom_right, top_left, top_right ) text_type = _identify(current_side[char_num]) @@ -319,6 +304,64 @@ def to_html(characters, return _line_html.replace('\t', '').replace('\n', '') return _line_html + +def to_ruby_html(characters, + bottom=None, + right=None, + left=None, + top=None, + minified=False, + indentation=0): + + """ + Returns valid HTML for the Chinese characters, and (assumed) phonetic ... + ... notations provided, on any given side. + + *characters* will be displayed in the middle of each output table. + *bottom/right/left/bottom ...* will be displayed on their respective ... + ... sides of the character. Strings from dragonmapper.transcriptions, ... + ... dragonmapper.hanzi.to_xxxyin, or an array/tuple are acceptable. + *indentation* specifies how many extra tab spaces there should be. + """ + + global _indentation + global _line_html + _indentation = indentation + _line_html = "" + proper_length = len(characters) + + top = _fix_empty_arrays(top, proper_length) + left = _fix_empty_arrays(left, proper_length) + right = _fix_empty_arrays(right, proper_length) + bottom = _fix_empty_arrays(bottom, proper_length) + + + char_type = 'unknown' + if hanzi.is_traditional(characters) and hanzi.is_simplified(characters): + char_type = 'traditional-simplified-same' + elif hanzi.is_traditional(characters): + char_type = 'traditional' + elif hanzi.is_simplified(characters): + char_type = 'simplified' + + print(len(characters)) + print(len(top)) + _html_add( + "".format( + "".join(characters), char_type) + ) + print(characters) + print(top) + for i in range(len(characters)): + _html_add("{1}\ + {2}".format( + characters, characters[i], top[i]), 1) + _html_add("") + + if minified: + return _line_html.replace('\t', '').replace('\n', '') + return _line_html + if __name__ == '__main__': zi = '你好,我叫顏毅。我是加拿大人!' zh = hanzi.to_zhuyin(zi) From e39bf684a65ad6e59beea714df90a5f51eddd86c Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Sat, 30 Jul 2016 16:23:57 -0600 Subject: [PATCH 78/88] Fixed some short sound like yo and o causeing errors. Added tests --- dragonmapper/data/transcriptions.csv | 2 ++ dragonmapper/tests/test-transcriptions.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/dragonmapper/data/transcriptions.csv b/dragonmapper/data/transcriptions.csv index 6447017..d46350e 100644 --- a/dragonmapper/data/transcriptions.csv +++ b/dragonmapper/data/transcriptions.csv @@ -234,6 +234,7 @@ nun,ㄋㄨㄣ,nwən nuo,ㄋㄨㄛ,nwɔ nü,ㄋㄩ,ny nüe,ㄋㄩㄝ,nɥœ +o,ㄛ,wɔ ou,ㄡ,oʊ pa,ㄆㄚ,pʰa pai,ㄆㄞ,pʰaɪ @@ -368,6 +369,7 @@ ye,ㄧㄝ,jɛ yi,ㄧ,i yin,ㄧㄣ,in ying,ㄧㄥ,iŋ +yo,ㄧㄛ,jʊ yong,ㄩㄥ,yʊŋ you,ㄧㄡ,yoʊ yu,ㄩ,y diff --git a/dragonmapper/tests/test-transcriptions.py b/dragonmapper/tests/test-transcriptions.py index a4d5e14..d460b47 100644 --- a/dragonmapper/tests/test-transcriptions.py +++ b/dragonmapper/tests/test-transcriptions.py @@ -173,3 +173,9 @@ def test_issue_8(self): numbered = 'Ao4di4li4' self.assertEqual(numbered, trans.accented_to_numbered(accented)) + + def test_short_syllables(self): + pinyin = 'yo1' + zhuyin = 'ㄧㄛ' + + self.assertEqual(zhuyin, trans.pinyin_to_zhuyin(pinyin)) From 6278c8a167aa3cba1e338f88972510c9311d956f Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 3 Aug 2016 14:06:15 -0600 Subject: [PATCH 79/88] =?UTF-8?q?Changed=20to=20more=20common=20pronunciat?= =?UTF-8?q?ion=20=E8=AA=B0(shui)->shei?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dragonmapper/data/hanzi_pinyin_characters.tsv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dragonmapper/data/hanzi_pinyin_characters.tsv b/dragonmapper/data/hanzi_pinyin_characters.tsv index f5db59c..0873de3 100644 --- a/dragonmapper/data/hanzi_pinyin_characters.tsv +++ b/dragonmapper/data/hanzi_pinyin_characters.tsv @@ -24969,8 +24969,8 @@ 䳠 shuì/zhù 脽 shuí 𧀣 shuí -谁 shuí -誰 shuí/shéi +谁 shéi +誰 shéi/shuí 鎙 shuò 硕 shuò 𠲿 shuò From 165f2f057a102ef0b21eddce73da9c1670bfa856 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 3 Aug 2016 14:17:59 -0600 Subject: [PATCH 80/88] Overhauled.. Using insead of
--- dragonmapper/html.py | 287 ++----------------------------------------- 1 file changed, 9 insertions(+), 278 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 4be598b..c4e8995 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -12,37 +12,8 @@ """See recomended CSS style: DRAGONMAPPER_DIR/style.css""" -TOP_LEFT = 0 -TOP_MID = 1 -TOP_RIGHT = 2 -MID_LEFT = 3 -MID_MID = 4 -MID_RIGHT = 5 -LOW_LEFT = 6 -LOW_MID = 7 -LOW_RIGHT = 8 - -TOP = TOP_MID -LEFT = MID_LEFT -CENTER = MID_MID -RIGHT = MID_RIGHT -BOTTOM = LOW_MID - -PUT_TEXT_PLACES = (TOP, LEFT, CENTER, RIGHT, BOTTOM) - -TOP_PLACES = (TOP_LEFT, TOP_MID, TOP_RIGHT) -LEFT_PLACES = (TOP_LEFT, MID_LEFT, LOW_LEFT) -RIGHT_PLACES = (TOP_RIGHT, MID_RIGHT, LOW_RIGHT) -BOTTOM_PLACES = (LOW_LEFT, LOW_MID, LOW_RIGHT) - -STACKED_PLACES = (LEFT, RIGHT) - - _indentation = 0 _line_html = '' -_puctuation = tuple(zhon.hanzi.punctuation + zhon.pinyin.punctuation) -_tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] - def _identify(s): @@ -56,7 +27,7 @@ def _identify(s): return "hanzi" elif s == "": return "unknown" - elif s in _puctuation: + elif s in punctuation: return "punct" elif s in _tones_marks: return "tone-mark" @@ -71,32 +42,6 @@ def _identify(s): elif c == trans.UNKNOWN: return "unknown" - -def _is_phonetic_script(s): - - """ - Returns bool if s is any phonetic script. - - *s* string to preform test on - """ - - i_s = _identify(s) - if i_s == "pinyin" or i_s == "zhuyin" or i_s == "ipa": - return True - return False - - -def _stackify(s): - - """ - Stack string for HTML formatting on the left and right of characters. - - *s* is the string to "stackify". - """ - - return "
".join(list(s)) - - def _html_add(s, tabs=0): """ @@ -109,125 +54,19 @@ def _html_add(s, tabs=0): global _line_html _line_html += (("\n")+("\t"*(tabs+_indentation)))+s - -def _split_punct(s): - - """ - Internal function for spliting by punctuation only for HTML formatting. - - *s* specifies the list to preform this action on. - """ - - temp = [] - - s = s.split(' ') - - for c in s: - full_char_temp = "" - for pc in c: - if (pc in zhuyin.characters or - pc in pinyin.vowels or - pc in pinyin.consonants or - pc in _tones_marks): - full_char_temp += pc - elif pc in _puctuation: - if full_char_temp != "": - temp.append(full_char_temp) - full_char_temp = "" - temp.append("") - if full_char_temp != "": - temp.append(full_char_temp) - return temp - - -def _return_correct_side(x, y, t, l, c, r, b): - - """ - Returns what side is being referenced by the coordinates, and the ... - ... coresponding list. - - *x, y* are the coordinates - *t, l, c, r, b* are top, left, center, right, and bottom, respectively. - """ - - # top - if x == 1 and y == 0: - return (t, TOP) - # left - elif x == 0 and y == 1: - return (l, LEFT) - # characters/center - elif x == 1 and y == 1: - return (c, CENTER) - # right - elif x == 2 and y == 1: - return (r, RIGHT) - # bottom - elif x == 1 and y == 2: - return (b, BOTTOM) - -def _get_side_string(s): - """ - Returns side as string (for html-css referencing) - - s is int constant - """ - - result = "" - if s == TOP_LEFT: - result = "top-left" - elif s == TOP_MID: - result = "top-mid top" - elif s == TOP_RIGHT: - result = "top-right" - elif s == MID_LEFT: - result = "mid-left left" - elif s == MID_MID: - result = "mid-mid center" - elif s == MID_RIGHT: - result = "mid-right right" - elif s == LOW_LEFT: - result = "low-left" - elif s == LOW_MID: - result = "low-mid bottom" - elif s == LOW_RIGHT: - result = "low-right" - return result - - -def _fix_empty_arrays(a, length): - - """ - Returns array of length 'length' if it does not contain anything ... - ... otherwise returns _split_punct(a) - - *a* is the array to proform the action on - *length* is the length - """ - if a is None: - a = [""] * length - elif len(a) != length: - a = _split_punct(a) - return a - - def to_html(characters, - bottom=None, - right=None, - left=None, top=None, minified=False, indentation=0): """ - Returns valid HTML for the Chinese characters, and (assumed) phonetic ... - ... notations provided, on any given side. + Returns valid HTML(5) for the Chinese characters, + and phonetic notations provided. - *characters* will be displayed in the middle of each output table. - *bottom/right/left/bottom ...* will be displayed on their respective ... - ... sides of the character. Strings from dragonmapper.transcriptions, ... - ... dragonmapper.hanzi.to_xxxyin, or an array/tuple are acceptable. - *indentation* specifies how many extra tab spaces there should be. + *characters* is an array of the Chinese characters. + *top* is an array that will be displayed on top of the characters. + TODO: Add support for more sides... Waiting on browser support. + *indentation* specifies how many extra tabs there should be. """ global _indentation @@ -236,10 +75,7 @@ def to_html(characters, _line_html = "" proper_length = len(characters) - top = _fix_empty_arrays(top, proper_length) - left = _fix_empty_arrays(left, proper_length) - right = _fix_empty_arrays(right, proper_length) - bottom = _fix_empty_arrays(bottom, proper_length) + phonetic_script_type = _identify(top) char_type = 'unknown' if hanzi.is_traditional(characters) and hanzi.is_simplified(characters): @@ -249,121 +85,16 @@ def to_html(characters, elif hanzi.is_simplified(characters): char_type = 'simplified' - _html_add( - "
".format( - "".join(characters), char_type) - ) - _html_add("", 1) - - for y in range(0, 3): - _html_add("", 2) - char_num = 0 - for i in range(0, (len(characters)*3)): - x = i % 3 - text = "" - text_type = "unknown" - phonetic_script_string = "" - - current_side, side = _return_correct_side( - x, y, top, left, characters, right, bottom, - ) - - text_type = _identify(current_side[char_num]) - if side in STACKED_PLACES: - text = _stackify(current_side[char_num]) - else: - text = current_side[char_num] - - if _is_phonetic_script(text): - phonetic_script_string = " phonetic-script" - - if text is "": - _html_add( - "".format( - characters), - 3) - else: - _html_add("", 3) - - if side in RIGHT_PLACES: - char_num += 1 - _html_add("", 2) - _html_add("", 1) - _html_add("
", 3) - _html_add( - "{4}".format( - characters, - phonetic_script_string, - text_type, - _get_side_string(side), - text), - 4) - _html_add("
") - - if minified: - return _line_html.replace('\t', '').replace('\n', '') - return _line_html - - -def to_ruby_html(characters, - bottom=None, - right=None, - left=None, - top=None, - minified=False, - indentation=0): - - """ - Returns valid HTML for the Chinese characters, and (assumed) phonetic ... - ... notations provided, on any given side. - - *characters* will be displayed in the middle of each output table. - *bottom/right/left/bottom ...* will be displayed on their respective ... - ... sides of the character. Strings from dragonmapper.transcriptions, ... - ... dragonmapper.hanzi.to_xxxyin, or an array/tuple are acceptable. - *indentation* specifies how many extra tab spaces there should be. - """ - - global _indentation - global _line_html - _indentation = indentation - _line_html = "" - proper_length = len(characters) - - top = _fix_empty_arrays(top, proper_length) - left = _fix_empty_arrays(left, proper_length) - right = _fix_empty_arrays(right, proper_length) - bottom = _fix_empty_arrays(bottom, proper_length) - - - char_type = 'unknown' - if hanzi.is_traditional(characters) and hanzi.is_simplified(characters): - char_type = 'traditional-simplified-same' - elif hanzi.is_traditional(characters): - char_type = 'traditional' - elif hanzi.is_simplified(characters): - char_type = 'simplified' - - print(len(characters)) - print(len(top)) _html_add( "".format( "".join(characters), char_type) ) - print(characters) - print(top) for i in range(len(characters)): _html_add("{1}\ - {2}".format( + {3}".format( characters, characters[i], top[i]), 1) _html_add("") if minified: return _line_html.replace('\t', '').replace('\n', '') return _line_html - -if __name__ == '__main__': - zi = '你好,我叫顏毅。我是加拿大人!' - zh = hanzi.to_zhuyin(zi) - pi = trans.zhuyin_to_pinyin(hanzi.to_zhuyin(zi)) - print(to_html(zi, bottom=pi, right=zh)) From 1cfa75c1f3d5e05554a5dad2dda10fcb11f1016f Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 3 Aug 2016 15:01:44 -0600 Subject: [PATCH 81/88] Added tests --- dragonmapper/data/test-html-data.txt | 8 -- dragonmapper/html.py | 61 +++++++--- dragonmapper/tests/test-html-data.txt | 1 - dragonmapper/tests/test-html.py | 164 ++------------------------ 4 files changed, 56 insertions(+), 178 deletions(-) delete mode 100644 dragonmapper/data/test-html-data.txt delete mode 120000 dragonmapper/tests/test-html-data.txt diff --git a/dragonmapper/data/test-html-data.txt b/dragonmapper/data/test-html-data.txt deleted file mode 100644 index 628c3de..0000000 --- a/dragonmapper/data/test-html-data.txt +++ /dev/null @@ -1,8 +0,0 @@ -\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\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\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\tyan2\n\t\t\t\n\t\t\t\tyi4\n\t\t\t
diff --git a/dragonmapper/html.py b/dragonmapper/html.py index c4e8995..6c408b1 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -6,14 +6,23 @@ from dragonmapper import hanzi from dragonmapper import transcriptions as trans import zhon -from zhon import pinyin -from zhon import zhuyin - """See recomended CSS style: DRAGONMAPPER_DIR/style.css""" +CHINESE_TYPE_UNKNOWN = 0 +CHINESE_TYPE_SIMPLIFIED = 1 +CHINESE_TYPE_TRADITIONAL = 2 +CHINESE_TYPE_SAME = 3 + +TYPE_TO_CSS_CLASS = {0: 'unknown', +1: 'simplified', +2: 'traditional', +3: 'traditional-simplified-same'} + _indentation = 0 _line_html = '' +punctuation = tuple(zhon.hanzi.punctuation + zhon.pinyin.punctuation) +_tones_marks = _tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] def _identify(s): @@ -42,6 +51,7 @@ def _identify(s): elif c == trans.UNKNOWN: return "unknown" + def _html_add(s, tabs=0): """ @@ -54,17 +64,37 @@ def _html_add(s, tabs=0): global _line_html _line_html += (("\n")+("\t"*(tabs+_indentation)))+s + +def is_what_type_of_chinese(s): + + """ + Returns values for diffent kinds of Chinese, see CHINESE_TYPE_... + + *s* character string + """ + + if hanzi.is_traditional(s) and hanzi.is_simplified(s): + return CHINESE_TYPE_SAME + elif hanzi.is_traditional(s): + return CHINESE_TYPE_TRADITIONAL + elif hanzi.is_simplified(s): + return CHINESE_TYPE_SIMPLIFIED + return CHINESE_TYPE_UNKNOWN + + + + def to_html(characters, top=None, minified=False, indentation=0): """ - Returns valid HTML(5) for the Chinese characters, + Returns (probably) valid HTML(5) for the Chinese characters, and phonetic notations provided. - *characters* is an array of the Chinese characters. - *top* is an array that will be displayed on top of the characters. + *characters* is an string of the Chinese characters. + *top* is an array that will be displayed on top of their respective characters. TODO: Add support for more sides... Waiting on browser support. *indentation* specifies how many extra tabs there should be. """ @@ -73,17 +103,10 @@ def to_html(characters, global _line_html _indentation = indentation _line_html = "" - proper_length = len(characters) - phonetic_script_type = _identify(top) + phonetic_script_type = _identify("".join(top)) - char_type = 'unknown' - if hanzi.is_traditional(characters) and hanzi.is_simplified(characters): - char_type = 'traditional-simplified-same' - elif hanzi.is_traditional(characters): - char_type = 'traditional' - elif hanzi.is_simplified(characters): - char_type = 'simplified' + char_type = TYPE_TO_CSS_CLASS[is_what_type_of_chinese(characters)] _html_add( "".format( @@ -91,8 +114,12 @@ def to_html(characters, ) for i in range(len(characters)): _html_add("{1}\ - {3}".format( - characters, characters[i], top[i]), 1) +{3}".format( + characters, + characters[i], + phonetic_script_type, + top[i] + ), 1) _html_add("") if minified: diff --git a/dragonmapper/tests/test-html-data.txt b/dragonmapper/tests/test-html-data.txt deleted file mode 120000 index 39ec209..0000000 --- a/dragonmapper/tests/test-html-data.txt +++ /dev/null @@ -1 +0,0 @@ -../data/test-html-data.txt \ No newline at end of file diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index c59b9ca..26e226a 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -12,155 +12,15 @@ class TestHtmlFuctions(unittest.TestCase): maxDiff = None - f = codecs.open("dragonmapper/data/test-html-data.txt", 'r', 'utf8') - - s = '我叫顏毅' - zh = 'ㄨㄛˇ ㄐㄧㄠˋ ㄧㄢˊ ㄧˋ' - pi = 'wǒ jiào yán yì' - - s2 = '你好,我媽媽對我叫“顏毅”。' - zh2 = 'ㄋㄧˇ ㄏㄠˇ,ㄨㄛˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄨㄛˇ ㄐㄧㄠˋ:“ㄧㄢˊ ㄧˋ”' - pi2 = 'nǐ hǎo,wǒ mā mā duì wǒ jiào:“yán yì”' - zh2_man = ['', '', '', '', '', '', '', '', '', '', 'yan2', 'yi4', '', ''] - - zh3 = "ㄨㄛˇ ㄉㄨㄟˋ ㄊㄚ ㄕㄨㄛ:“ㄋㄧˇ ㄇㄚ ㄇㄚ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ " +\ - "ㄅㄚˋ ㄅㄚˋ ㄉㄨㄟˋ ㄋㄧˇ ㄕㄨㄛ:“ㄋㄧˇ ㄏㄠˇ ㄋㄩˇ ㄦ˙”””" - - indented_5 = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - indented_0 = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - indented_3 = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - zhuyin_both_pinyin_both = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - pinyin_top = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - zhuyin_top = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - pinyin_bottom = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - manual_pinyin = f.readline()\ - .replace("\\n", "\n").replace("\\t", "\t").rstrip('\n') - - def test_indented_5(self): - self.assertEqual( - html.to_html( - self.s, bottom=self.pi, - left=self.zh, indentation=5), - self.indented_5) - - def test_indented_0(self): - self.assertEqual( - html.to_html( - self.s, bottom=self.pi, - right=self.zh, indentation=0), - self.indented_0) - - def test_indented_3(self): - self.assertEqual( - html.to_html( - self.s, bottom=self.pi, - top=self.zh, indentation=3), - self.indented_3) - - def test_zhuyin_both_pinyin_both(self): - self.assertEqual( - html.to_html( - self.s, bottom=self.pi, - top=self.pi, left=self.zh, - right=self.zh), - self.zhuyin_both_pinyin_both) - - def test_pinyin_top(self): - self.assertEqual(html.to_html(self.s, top=self.pi), self.pinyin_top) - - def test_zhuyin_top(self): - self.assertEqual(html.to_html(self.s, top=self.zh), self.zhuyin_top) - - def test_pinyin_bottom(self): - self.assertEqual( - html.to_html( - self.s, bottom=self.pi), - self.pinyin_bottom) - - def test_identify(self): - self.assertEqual(html._identify(","), 'punct') - self.assertEqual(html._identify("你好嗎?"), 'hanzi') - self.assertEqual(html._identify("wǒ mā mā"), 'pinyin') - self.assertEqual(html._identify("ㄨㄛˇ ㄐㄧㄠˋ ㄧㄢˊ ㄧˋ"), 'zhuyin') - self.assertEqual(html._identify("1"), 'tone-mark') - self.assertEqual(html._identify("ˋ"), 'tone-mark') - self.assertEqual(html._identify(":"), 'punct') - - def test_stackify(self): - self.assertEqual(html._stackify("ni3"), "n
i
3") - self.assertEqual(html._stackify("ㄨㄛˇ"), "ㄨ

ˇ") - self.assertEqual(html._stackify("小狗"), "小
狗") - self.assertEqual( - html._stackify("phantom"), - "p
h
a
n
t
o
m") - self.assertEqual( - html._stackify("gxF52f"), - "g
x
F
5
2
f") - - def test_split_punct(self): - self.assertEqual( - html._split_punct("ni3 hao3 ma5?"), - ['ni3', 'hao3', 'ma5', '']) - self.assertEqual( - html._split_punct("ㄨㄛˇ:ㄇㄚ ㄇㄚ"), - ['ㄨㄛˇ', '', 'ㄇㄚ', 'ㄇㄚ']) - self.assertEqual( - html._split_punct("wo3 jiao4:“yan2 yi4”"), - ['wo3', 'jiao4', '', '', 'yan2', 'yi4', '']) - self.assertEqual( - html._split_punct("ni3 shi4:wo3 de5 peng2 you5 ma5?"), - ['ni3', 'shi4', '', 'wo3', 'de5', 'peng2', 'you5', 'ma5', '']) - self.assertEqual( - html._split_punct( - self.zh3), - ['ㄨㄛˇ', 'ㄉㄨㄟˋ', 'ㄊㄚ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄇㄚ', 'ㄇㄚ', - 'ㄉㄨㄟˋ', 'ㄋㄧˇ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄅㄚˋ', 'ㄅㄚˋ', - 'ㄉㄨㄟˋ', 'ㄋㄧˇ', 'ㄕㄨㄛ', '', '', 'ㄋㄧˇ', 'ㄏㄠˇ', 'ㄋㄩˇ', - 'ㄦ˙', '', '', '']) - - def test_manual_phonetics_input(self): - self.assertEqual( - html.to_html( - self.s2, bottom=self.zh2_man), - self.manual_pinyin) - - def test_return_correct_sid(self): - self.assertEqual( - html._return_correct_side( - 2, 0, [], [], [], [], [], [], [], [], [] - ), - ([], html.TOP_RIGHT) - ) - self.assertEqual( - html._return_correct_side( - 2, 2, [], [], [], [], [], [], [], [], [] - ), - ([], html.LOW_RIGHT) - ) - self.assertEqual( - html._return_correct_side( - 1, 2, [], [], [], [], [], [], [], [], [] - ), - ([], html.BOTTOM) - ) - - def test_fix_empty_arrays(self): - self.assertEqual( - html._fix_empty_arrays( - None, 6 - ), - [""] * 6 - ) - - def test_is_phonetic_script(self): - self.assertEqual(html._is_phonetic_script("ni3"), True) - self.assertEqual(html._is_phonetic_script("老f22x9-\\"), False) - self.assertEqual(html._is_phonetic_script("ni˧˩˧ xɑʊ˧˩˧"), True) - self.assertEqual(html._is_phonetic_script("ㄨㄛˇ"), True) + zi = '你好' + pinyin = ['ni3', 'hao3'] + ruby = '\ +\ +ni3\ +\ +hao3' + + + def test_to_html(self): + self.assertEqual(html.to_html(self.zi, top=self.pinyin, minified=True), + self.ruby) From f49a8ede34713e781fe3b3400c23ccca7cdd9b1b Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 3 Aug 2016 15:05:57 -0600 Subject: [PATCH 82/88] PEP8 --- dragonmapper/html.py | 13 ++++++------- dragonmapper/tests/test-html.py | 10 ++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 6c408b1..0ba909c 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -15,14 +15,15 @@ CHINESE_TYPE_SAME = 3 TYPE_TO_CSS_CLASS = {0: 'unknown', -1: 'simplified', -2: 'traditional', -3: 'traditional-simplified-same'} + 1: 'simplified', + 2: 'traditional', + 3: 'traditional-simplified-same'} _indentation = 0 _line_html = '' punctuation = tuple(zhon.hanzi.punctuation + zhon.pinyin.punctuation) -_tones_marks = _tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] +_tones_marks = ['¯', 'ˊ', 'ˇ', 'ˋ', '˙', '1', '2', '3', '4', '5'] + def _identify(s): @@ -82,8 +83,6 @@ def is_what_type_of_chinese(s): return CHINESE_TYPE_UNKNOWN - - def to_html(characters, top=None, minified=False, @@ -94,7 +93,7 @@ def to_html(characters, and phonetic notations provided. *characters* is an string of the Chinese characters. - *top* is an array that will be displayed on top of their respective characters. + *top* an array that will be displayed on top of the respective characters. TODO: Add support for more sides... Waiting on browser support. *indentation* specifies how many extra tabs there should be. """ diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 26e226a..8f90999 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import codecs import unittest from dragonmapper import html @@ -20,7 +19,10 @@ class TestHtmlFuctions(unittest.TestCase): \ hao3' - def test_to_html(self): - self.assertEqual(html.to_html(self.zi, top=self.pinyin, minified=True), - self.ruby) + self.assertEqual( + html.to_html( + self.zi, + top=self.pinyin, + minified=True), + self.ruby) From 3d3d89da959e9fbfa3e9702cc2ce1398e76661b0 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 3 Aug 2016 16:02:36 -0600 Subject: [PATCH 83/88] Updated README with more accurate description of program --- README.rst | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/README.rst b/README.rst index 9fe0354..6305a02 100644 --- a/README.rst +++ b/README.rst @@ -22,10 +22,7 @@ Features Phonetic Alphabet. * Identify a string as Traditional or Simplified Chinese, Pinyin, Zhuyin, or the International Phonetic Alphabet. -* Output HTML based on the above. -* [HTML] You can even mix-and-match the different phonetic systems: -* [HTML] right=, and top= are also available. -* [HTML] See data/default-style.css +* Output HTML of characters with Pinyin attached to them. .. code:: python @@ -51,38 +48,16 @@ Features >>> s = "我是加拿大人" >>> zh = hanzi.to_zhuyin(s) - >>> zh - 'ㄨㄛˇ ㄕˋ ㄐㄧㄚ ㄋㄚˊ ㄉㄚˋ ㄖㄣˊ' - >>> h = dragonmapper.html.to_html(s, right=zh) - >>> print(h) - -.. image:: http://s25.postimg.org/82l3nbfrz/Screenshot_from_2016_06_03_11_16_14.png - :target: http://postimg.org/image/m90uijqmz/ - -.. code:: python - - >>> s = "我是加拿大人" - >>> zh = hanzi.to_zhuyin(s) - >>> pi = trans.zhuyin_to_pinyin(zh) + >>> pi = trans.zhuyin_to_pinyin(zh).split(' ') >>> pi - 'wǒ shì jiā ná dà rén' - >>> h = dragonmapper.html.to_html(s, bottom=pi) + ['wǒ', 'shì', 'jiā', 'ná', 'dà', 'rén'] + >>> h = dragonmapper.html.to_html(s, top=pi) >>> print(h) * The intermediate switch to Zhuyin, is because of spacing. You can space out the characters instead. -.. image:: http://s25.postimg.org/9vo0bn0yn/Screenshot_from_2016_06_03_11_16_39.png - :target: http://postimg.org/image/j3g8sc80r/ - -.. code:: python - - >>> s = "我是加拿大人" - >>> zh = hanzi.to_zhuyin(s) - >>> pi = trans.zhuyin_to_pinyin(zh) - >>> h = dragonmapper.html.to_html(s, bottom=pi, right=zh) - >>> print(h) - -.. image:: http://s25.postimg.org/9g854vpnj/Screenshot_from_2016_06_03_11_16_57.png - :target: http://postimg.org/image/m90uijqmz/ +* Note: only top is aviable right now, as browsers do not currently support having it elsewhere. +.. image:: https://s25.postimg.org/4s44wylcv/Screenshot_from_2016_08_03_15_59_03.png + :target: https://postimg.org/image/o9yscwiaj/ Getting Started --------------- From 7fdc46b4254642eb5ea918af04e9f3b7ae2b6f42 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 30 Nov 2016 14:12:13 -0700 Subject: [PATCH 84/88] Add slightly better to read code --- dragonmapper/hanzi.py | 52 ++++++++++++++++++++++++++++----- dragonmapper/html.py | 20 ++++--------- dragonmapper/tests/test-html.py | 4 +-- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/dragonmapper/hanzi.py b/dragonmapper/hanzi.py index bc67245..abf8b13 100644 --- a/dragonmapper/hanzi.py +++ b/dragonmapper/hanzi.py @@ -7,6 +7,7 @@ import hanzidentifier import zhon.hanzi import zhon.pinyin +import zhon.jyutping import dragonmapper.data from dragonmapper.transcriptions import ( @@ -34,7 +35,8 @@ def _load_data(): - """Load the word and character mapping data into a dictionary. + r""" + Load the word and character mapping data into a dictionary. In the data files, each line is formatted like this: HANZI PINYIN_READING/PINYIN_READING @@ -58,8 +60,9 @@ def _load_data(): _WORDS = _HANZI_PINYIN_MAP['words'] -def _hanzi_to_pinyin(hanzi): - """Return the Pinyin reading for a Chinese word. +def _hanzi_to_pinyin(hanzi, DICT=None): + """ + Return the Pinyin reading for a Chinese word. If the given string *hanzi* matches a CC-CEDICT word, the return value is formatted like this: [WORD_READING1, WORD_READING2, ...] @@ -71,10 +74,18 @@ def _hanzi_to_pinyin(hanzi): original character is returned, e.g. [[CHAR_READING1, ...], CHAR, ...] """ + if DICT is None: + DICT = _HANZI_PINYIN_MAP + try: - return _HANZI_PINYIN_MAP['words'][hanzi] + return DICT['words'][hanzi] except KeyError: - return [_CHARACTERS.get(character, character) for character in hanzi] + return [ + DICT['characters'].get( + character, + character) + for character in hanzi + ] def _enclose_readings(container, readings): @@ -88,7 +99,8 @@ def _enclose_readings(container, readings): def to_pinyin(s, delimiter=' ', all_readings=False, container='[]', accented=True): - """Convert a string's Chinese characters to Pinyin readings. + """ + Convert a string's Chinese characters to Pinyin readings. *s* is a string containing Chinese characters. *accented* is a boolean value indicating whether to return accented or numbered Pinyin @@ -169,7 +181,8 @@ def to_pinyin(s, delimiter=' ', all_readings=False, container='[]', def to_zhuyin(s, delimiter=' ', all_readings=False, container='[]'): - """Convert a string's Chinese characters to Zhuyin readings. + """ + Convert a string's Chinese characters to Zhuyin readings. *s* is a string containing Chinese characters. @@ -192,7 +205,8 @@ def to_zhuyin(s, delimiter=' ', all_readings=False, container='[]'): def to_ipa(s, delimiter=' ', all_readings=False, container='[]'): - """Convert a string's Chinese characters to IPA. + """ + Convert a string's Chinese characters to IPA. *s* is a string containing Chinese characters. @@ -212,3 +226,25 @@ def to_ipa(s, delimiter=' ', all_readings=False, container='[]'): numbered_pinyin = to_pinyin(s, delimiter, all_readings, container, False) ipa = pinyin_to_ipa(numbered_pinyin) return ipa + + +def to_jyutping(s, delimiter=' ', all_readings=False, container='[]'): + """ + Convert a string's Chinese characters to Jyutping. + + *s* is a string containing Chinese characters. + + *delimiter* is the character used to indicate word boundaries in *s*. + This is used to differentiate between words and characters so that a more + accurate reading can be returned. + + *all_readings* is a boolean value indicating whether or not to return all + possible readings in the case of words/characters that have multiple + readings. *container* is a two character string that is used to + enclose words/characters if *all_readings* is ``True``. The default + ``'[]'`` is used like this: ``'[READING1/READING2]'``. + + Characters not recognized as Chinese are left untouched. + + """ + pass diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 0ba909c..986cdfe 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -2,12 +2,10 @@ """Formatting Chinese into HTML with dragonmapper's functions""" +import zhon from __future__ import unicode_literals from dragonmapper import hanzi from dragonmapper import transcriptions as trans -import zhon - -"""See recomended CSS style: DRAGONMAPPER_DIR/style.css""" CHINESE_TYPE_UNKNOWN = 0 CHINESE_TYPE_SIMPLIFIED = 1 @@ -15,9 +13,9 @@ CHINESE_TYPE_SAME = 3 TYPE_TO_CSS_CLASS = {0: 'unknown', - 1: 'simplified', - 2: 'traditional', - 3: 'traditional-simplified-same'} + 1: 'simplified', + 2: 'traditional', + 3: 'traditional-simplified-same'} _indentation = 0 _line_html = '' @@ -26,9 +24,7 @@ def _identify(s): - - """ - Returns string of text type for HTML/CSS. + """ Returns string of text type for HTML/CSS. *s* is the string to identify. """ @@ -54,7 +50,6 @@ def _identify(s): def _html_add(s, tabs=0): - """ Wrapper for _line_html+="..." @@ -67,7 +62,6 @@ def _html_add(s, tabs=0): def is_what_type_of_chinese(s): - """ Returns values for diffent kinds of Chinese, see CHINESE_TYPE_... @@ -87,7 +81,6 @@ def to_html(characters, top=None, minified=False, indentation=0): - """ Returns (probably) valid HTML(5) for the Chinese characters, and phonetic notations provided. @@ -117,8 +110,7 @@ def to_html(characters, characters, characters[i], phonetic_script_type, - top[i] - ), 1) + top[i]), 1) _html_add("") if minified: diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 8f90999..517339e 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -1,12 +1,10 @@ +"""Unit tests for dragonmapper.html.""" # -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest from dragonmapper import html -"""Unit tests for dragonmapper.html.""" - - class TestHtmlFuctions(unittest.TestCase): maxDiff = None From 87a146b479fbf5ab7a6b9a9772ac585292723ec2 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 30 Nov 2016 14:17:37 -0700 Subject: [PATCH 85/88] Fix flake8 tests --- dragonmapper/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dragonmapper/html.py b/dragonmapper/html.py index 986cdfe..316db74 100644 --- a/dragonmapper/html.py +++ b/dragonmapper/html.py @@ -2,8 +2,8 @@ """Formatting Chinese into HTML with dragonmapper's functions""" -import zhon from __future__ import unicode_literals +import zhon from dragonmapper import hanzi from dragonmapper import transcriptions as trans From 03028f4542c36677633bc6e003c368ec02add973 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Wed, 30 Nov 2016 14:28:26 -0700 Subject: [PATCH 86/88] Fix python2.x errors --- dragonmapper/hanzi.py | 1 - dragonmapper/tests/test-html.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dragonmapper/hanzi.py b/dragonmapper/hanzi.py index abf8b13..be585ce 100644 --- a/dragonmapper/hanzi.py +++ b/dragonmapper/hanzi.py @@ -7,7 +7,6 @@ import hanzidentifier import zhon.hanzi import zhon.pinyin -import zhon.jyutping import dragonmapper.data from dragonmapper.transcriptions import ( diff --git a/dragonmapper/tests/test-html.py b/dragonmapper/tests/test-html.py index 517339e..e339541 100644 --- a/dragonmapper/tests/test-html.py +++ b/dragonmapper/tests/test-html.py @@ -1,5 +1,5 @@ -"""Unit tests for dragonmapper.html.""" # -*- coding: utf-8 -*- +"""Unit tests for dragonmapper.html.""" from __future__ import unicode_literals import unittest from dragonmapper import html From b0afd6fad5f539fcbcd302c5a2f53af29260a5bb Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 1 Dec 2016 12:19:30 -0700 Subject: [PATCH 87/88] =?UTF-8?q?Fix=20error=20with=20'=E5=97=B2'=20causin?= =?UTF-8?q?g=20ValueError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dragonmapper/data/transcriptions.csv | 1 + dragonmapper/tests/test-transcriptions.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/dragonmapper/data/transcriptions.csv b/dragonmapper/data/transcriptions.csv index d46350e..9f3377c 100644 --- a/dragonmapper/data/transcriptions.csv +++ b/dragonmapper/data/transcriptions.csv @@ -65,6 +65,7 @@ dei,ㄉㄟ,teɪ den,ㄉㄣ,tən deng,ㄉㄥ,tɤŋ di,ㄉㄧ,ti +dia,ㄉㄧㄚ,tjɑ dian,ㄉㄧㄢ,tjɛn diang,ㄉㄧㄤ,tjɑŋ diao,ㄉㄧㄠ,tjɑʊ diff --git a/dragonmapper/tests/test-transcriptions.py b/dragonmapper/tests/test-transcriptions.py index d460b47..ad3821f 100644 --- a/dragonmapper/tests/test-transcriptions.py +++ b/dragonmapper/tests/test-transcriptions.py @@ -179,3 +179,9 @@ def test_short_syllables(self): zhuyin = 'ㄧㄛ' self.assertEqual(zhuyin, trans.pinyin_to_zhuyin(pinyin)) + + def test_dia_conversion(self): + pinyin = 'dia3' + zhuyin = 'ㄉㄧㄚˇ' + + self.assertEqual(zhuyin, trans.pinyin_to_zhuyin(pinyin)) From f459638e1a8096699922f42252c849ca883d2e60 Mon Sep 17 00:00:00 2001 From: Tait Hoyem Date: Thu, 1 Dec 2016 12:31:49 -0700 Subject: [PATCH 88/88] Make examples in docs more readable --- README.rst | 19 ++++++++++++------- docs/index.rst | 14 ++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/README.rst b/README.rst index 6305a02..59c34dc 100644 --- a/README.rst +++ b/README.rst @@ -26,32 +26,37 @@ Features .. code:: python + >>> from dragonmapper import hanzi >>> s = '我是一个美国人。' - >>> dragonmapper.hanzi.is_simplified(s) + >>> hanzi.is_simplified(s) True - >>> dragonmapper.hanzi.to_pinyin(s) + >>> hanzi.to_pinyin(s) 'wǒshìyīgèměiguórén。' - >>> dragonmapper.hanzi.to_pinyin(s, all_readings=True) + >>> hanzi.to_pinyin(s, all_readings=True) '[wǒ][shì/shi/tí][yī][gè/ge/gě/gàn][měi][guó][rén/ren]。' .. code:: python + >>> from dragonmapper import transcriptions as trans >>> s = 'Wǒ shì yīgè měiguórén.' - >>> dragonmapper.transcriptions.is_pinyin(s) + >>> trans.is_pinyin(s) True - >>> dragonmapper.transcriptions.pinyin_to_zhuyin(s) + >>> trans.pinyin_to_zhuyin(s) 'ㄨㄛˇ ㄕˋ ㄧ ㄍㄜˋ ㄇㄟˇ ㄍㄨㄛˊ ㄖㄣˊ.' - >>> dragonmapper.transcriptions.pinyin_to_ipa(s) + >>> trans.pinyin_to_ipa(s) 'wɔ˧˩˧ ʂɨ˥˩ i˥ kɤ˥˩ meɪ˧˩˧ kwɔ˧˥ ʐən˧˥.' .. code:: python + >>> from dragonmapper import transcriptions as trans + >>> form dragonmapper import hanzi + >>> from dragonmapper import html >>> s = "我是加拿大人" >>> zh = hanzi.to_zhuyin(s) >>> pi = trans.zhuyin_to_pinyin(zh).split(' ') >>> pi ['wǒ', 'shì', 'jiā', 'ná', 'dà', 'rén'] - >>> h = dragonmapper.html.to_html(s, top=pi) + >>> h = html.to_html(s, top=pi) >>> print(h) * The intermediate switch to Zhuyin, is because of spacing. You can space out the characters instead. diff --git a/docs/index.rst b/docs/index.rst index 558b17c..a70297d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,22 +15,24 @@ functions for Chinese text processing: .. code:: python + >>> from dragonmapper import hanzi >>> s = '我是一个美国人。' - >>> dragonmapper.hanzi.is_simplified(s) + >>> hanzi.is_simplified(s) True - >>> dragonmapper.hanzi.to_pinyin(s) + >>> hanzi.to_pinyin(s) 'wǒshìyīgèměiguórén。' - >>> dragonmapper.hanzi.to_pinyin(s, all_readings=True) + >>> hanzi.to_pinyin(s, all_readings=True) '[wǒ][shì/shi/tí][yī][gè/ge/gě/gàn][měi][guó][rén/ren]。' .. code:: python + >>> from dragonmapper import transcriptions as trans >>> s = 'Wǒ shì yīgè měiguórén.' - >>> dragonmapper.transcriptions.is_pinyin(s) + >>> trans.is_pinyin(s) True - >>> dragonmapper.transcriptions.pinyin_to_zhuyin(s) + >>> trans.pinyin_to_zhuyin(s) 'ㄨㄛˇ ㄕˋ ㄧ ㄍㄜˋ ㄇㄟˇ ㄍㄨㄛˊ ㄖㄣˊ.' - >>> dragonmapper.transcriptions.pinyin_to_ipa(s) + >>> trans.pinyin_to_ipa(s) 'wɔ˧˩˧ ʂɨ˥˩ i˥ kɤ˥˩ meɪ˧˩˧ kwɔ˧˥ ʐən˧˥.' If this is your first time using Dragon Mapper, check out the :doc:`installation`.