纯python模块连接文本
Pyphen的Python项目详细描述
Pyphen是一个纯python模块,用现有的HunScript来连接文本。 断字词典。
https://github.com/Kozea/Pyphen
这个模块是由wilbert berendsen编写的python断字器的叉。
https://code.google.com/p/python-hyphenator/
很多字典都包含在pyphen中,它们来自libreoffice git 存储库,并在gpl、lgpl和/或mpl下分发。见 字典和libreoffice的存储库了解更多详细信息。
http://cgit.freedesktop.org/libreoffice/dictionaries/tree/
用法:
>>> import pyphen >>> pyphen.language_fallback('nl_NL_variant1') 'nl_NL' >>> 'nl_NL' in pyphen.LANGUAGES True >>> dic = pyphen.Pyphen(lang='nl_NL') >>> dic.inserted('lettergrepen') 'let-ter-gre-pen' >>> dic.wrap('autobandventieldopje', 11) ('autoband-', 'ventieldopje') >>> for pair in dic.iterate('Amsterdam'): ... print(pair) ... ('Amster', 'dam') ('Am', 'sterdam') >>>
功能:
- 100%纯python,无依赖关系
- 包括许多词典
- 缓存dict文件和连字符单词
- 支持非标准连字符模式
许可证:
Pyphen是在GPL 2.0+/LGPL 2.1+/MPL 1.1三方许可下发布的。 有关详细信息,请参见copying.gpl、copying.lgpl和copying.mpl。