主持人要一份术语表和一个文本。它查找本文中的术语并用另一个表示形式替换它们。
anchorman的Python项目详细描述
#欢迎来到主持人
将文本转换为[超文本](http://en.wikipedia.org/wiki/Hypertext) 丰富内容。主持人在文本中查找术语并替换 他们有另一个代表。
替换是基于规则的。每个学期都要按规定检查 并将在有效时应用。
# How many items will be marked at all in the text. replaces_at_all: 5
# Input term has to be exact match in text. case_sensitive: true
##功能
- 替换规则
- 考虑规则中的文本单位(例如段落)
- 仅替换同一项目的n个项目
- 通过标签指定链接的限制区域:a,img
- 在应用元素之前按值对其排序
- 返回应用的元素
##用法
>>> from anchorman import annotate >>> text = 'The quick brown fox jumps over the lazy dog.' >>> elements = [{'fox': {'value': '/wiki/fox', 'data-type': 'animal'}}] >>> print annotate(text, elements) 'The quick brown <a href="/wiki/fox" data-type="animal">fox</a> jumps over the lazy dog.'
##安装
要安装Anchorman,只需:
pip install anchorman
##学分和贡献
我们在github和pypi上发布了这篇文章,为您提供我们的解决方案。 对反馈和贡献感到高兴。
感谢[@tarnacious](https://github.com/tarnacious)的启发 以及第一步。
##待办事项
-
检查输入中是否存在位置,并保存额外处理
- bs4中html.parser与lxml的比较-基准和缺点
<;img src=“https://raw.githubusercontent.com/rebeling/anchorman/master/docs/anchorman.png”width=“200”>;
敬请关注。