From 5357a8ca35f1ea05a2a9c37b7598444ddd6e7f00 Mon Sep 17 00:00:00 2001 From: James Yin Date: Sun, 31 May 2020 06:57:00 +0800 Subject: [PATCH] prepare v3.0.8 --- README.md | 21 +++++++++++++++++++-- README.zh_cn.md | 21 +++++++++++++++++++-- actrie/__init__.py | 2 +- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7ab8778..37b4039 100644 --- a/README.md +++ b/README.md @@ -65,20 +65,37 @@ pip install dist/actrie-*.whl ## Python example +### vocab.txt + +```text +pattern0 +pattern1 +pattern2 +... +``` + +### example.py + ```python #!/usr/bin/env python # coding=utf-8 from actrie import * -pattern = "f|(a|b).{0,5}(e(?&!ef)|g)" +pattern = r"f|(a|b).{0,5}(e(?&!ef)|g) +abc +efg" + content = "abcdefg" def test(): global pattern, content - # create matcher + # create matcher by file + #matcher = Matcher.create_by_file("vocab.txt") + + # create matcher by string matcher = Matcher.create_by_string(pattern) # iterator diff --git a/README.zh_cn.md b/README.zh_cn.md index 796c810..6e322de 100644 --- a/README.zh_cn.md +++ b/README.zh_cn.md @@ -122,20 +122,37 @@ pip install dist/actrie-*.whl ## Python使用样例 +### vocab.txt + +```text +pattern0 +pattern1 +pattern2 +... +``` + +### example.py + ```python #!/usr/bin/env python # coding=utf-8 from actrie import * -pattern = "f|(a|b).{0,5}(e(?&!ef)|g)" +pattern = r"f|(a|b).{0,5}(e(?&!ef)|g) +abc +efg" + content = "abcdefg" def test(): global pattern, content - # 创建匹配器 + # 从文件创建匹配器 + #matcher = Matcher.create_by_file("vocab.txt") + + # 从字符串创建匹配器 matcher = Matcher.create_by_string(pattern) # 通过迭代器获取匹配结果 diff --git a/actrie/__init__.py b/actrie/__init__.py index 2d6c617..04663e6 100644 --- a/actrie/__init__.py +++ b/actrie/__init__.py @@ -5,4 +5,4 @@ __all__ = ['Matcher', 'Context', 'PrefixMatcher'] -__version__ = '3.0.7' +__version__ = '3.0.8'