Skip to content

Commit

Permalink
更新文档及更新日志
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Oct 28, 2017
1 parent 65fa317 commit 1309628
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 14 deletions.
13 changes: 11 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ Changelog
---------


0.26.1 (2017-10-25)
0.27.0 (2017-mm-dd)
+++++++++++++++++++++

* **[New]** 使用 `phrase-pinyin-data`_ v0.5.1 的词语拼音数据。
* **[New]** 命令行工具支持通过更简便的方式指定参数及拼音风格。
(详见 `#105`_, Thanks `@wdscxsj`_ )


0.26.1 (2017-10-25)
+++++++++++++++++++++

* **[Improved]** 使用 `phrase-pinyin-data`_ v0.5.1 的词语拼音数据。fixed `#106`_


0.26.0 (2017-10-12)
Expand Down Expand Up @@ -559,3 +565,6 @@ __ https://github.com/mozillazg/python-pinyin/issues/8
.. _#93: https://github.com/mozillazg/python-pinyin/issues/93
.. _#81: https://github.com/mozillazg/python-pinyin/issues/81
.. _#102: https://github.com/mozillazg/python-pinyin/issues/102
.. _#105: https://github.com/mozillazg/python-pinyin/issues/105
.. _#106: https://github.com/mozillazg/python-pinyin/issues/106
.. _@wdscxsj: https://github.com/wdscxsj
9 changes: 7 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
API
====

.. _style:

核心 API
-------------
拼音风格
-----------

.. autoclass:: pypinyin.Style
:members:
:undoc-members:
:member-order: bysource


核心 API
-------------

.. autofunction:: pypinyin.pinyin

.. autofunction:: pypinyin.lazy_pinyin
Expand Down
84 changes: 74 additions & 10 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@
['zhong', 'xin']
命令行工具
------------

.. code-block:: console
$ pypinyin 音乐
yīn yuè
$ pypinyin -h
处理不包含拼音的字符
---------------------

Expand Down Expand Up @@ -103,3 +93,77 @@
In [4]: lazy_pinyin('么么', style='kiss')
Out[4]: ['😘 me', '😘 me']
命令行工具
------------

程序内置了一个命令行工具 ``pypinyin`` :

.. code-block:: console
$ pypinyin 音乐
yīn yuè
$ pypinyin -h
命令行工具支持如下参数:

.. code-block:: console
$ pypinyin -h
usage: pypinyin [-h] [-V] [-f {pinyin,slug}]
[-s {NORMAL,zhao,TONE,zh4ao,TONE2,zha4o,TONE3,zhao4,INITIALS,zh,FIRST_LETTER,z,FINALS,ao,FINALS_TONE,4ao,FINALS_TONE2,a4o,FINALS_TONE3,ao4,BOPOMOFO,BOPOMOFO_FIRST,CYRILLIC,CYRILLIC_FIRST}]
[-p SEPARATOR] [-e {default,ignore,replace}] [-m]
hans
convert chinese to pinyin.
positional arguments:
hans chinese string
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-f {pinyin,slug}, --func {pinyin,slug}
function name (default: "pinyin")
-s {NORMAL,zhao,TONE,zh4ao,TONE2,zha4o,TONE3,zhao4,INITIALS,zh,FIRST_LETTER,z,FINALS,ao,FINALS_TONE,4ao,FINALS_TONE2,a4o,FINALS_TONE3,ao4,BOPOMOFO,BOPOMOFO_FIRST,CYRILLIC,CYRILLIC_FIRST}, --style {NORMAL,zhao,TONE,zh4ao,TONE2,zha4o,TONE3,zhao4,INITIALS,zh,FIRST_LETTER,z,FINALS,ao,FINALS_TONE,4ao,FINALS_TONE2,a4o,FINALS_TONE3,ao4,BOPOMOFO,BOPOMOFO_FIRST,CYRILLIC,CYRILLIC_FIRST}
pinyin style (default: "zh4ao")
-p SEPARATOR, --separator SEPARATOR
slug separator (default: "-")
-e {default,ignore,replace}, --errors {default,ignore,replace}
how to handle none-pinyin string (default: "default")
-m, --heteronym enable heteronym
``-s``, ``--style`` 参数可以选值的含义如下:

================== =========================================
-s 或 --style 的值 对应的拼音风格
================== =========================================
zhao :py:attr:`~pypinyin.Style.NORMAL`
zh4ao :py:attr:`~pypinyin.Style.TONE`
zha4o :py:attr:`~pypinyin.Style.TONE2`
zhao4 :py:attr:`~pypinyin.Style.TONE3`
zh :py:attr:`~pypinyin.Style.INITIALS`
z :py:attr:`~pypinyin.Style.FIRST_LETTER`
ao :py:attr:`~pypinyin.Style.FINALS`
4ao :py:attr:`~pypinyin.Style.FINALS_TONE`
a4o :py:attr:`~pypinyin.Style.FINALS_TONE2`
ao4 :py:attr:`~pypinyin.Style.FINALS_TONE3`
NORMAL :py:attr:`~pypinyin.Style.NORMAL`
TONE :py:attr:`~pypinyin.Style.TONE`
TONE2 :py:attr:`~pypinyin.Style.TONE2`
TONE3 :py:attr:`~pypinyin.Style.TONE3`
INITIALS :py:attr:`~pypinyin.Style.INITIALS`
FIRST_LETTER :py:attr:`~pypinyin.Style.FIRST_LETTER`
FINALS :py:attr:`~pypinyin.Style.FINALS`
FINALS_TONE :py:attr:`~pypinyin.Style.FINALS_TONE`
FINALS_TONE2 :py:attr:`~pypinyin.Style.FINALS_TONE2`
FINALS_TONE3 :py:attr:`~pypinyin.Style.FINALS_TONE3`
BOPOMOFO :py:attr:`~pypinyin.Style.BOPOMOFO`
BOPOMOFO_FIRST :py:attr:`~pypinyin.Style.BOPOMOFO_FIRST`
CYRILLIC :py:attr:`~pypinyin.Style.CYRILLIC`
CYRILLIC_FIRST :py:attr:`~pypinyin.Style.CYRILLIC_FIRST`
================== =========================================

0 comments on commit 1309628

Please sign in to comment.