Skip to content

Commit 5b1a20e

Browse files
committed
Update README with examples.
1 parent e745f25 commit 5b1a20e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ package.
4141
## Status
4242
The package exposes almost all functionality of the `fst` crate, except for:
4343

44-
- Combining the results of slicing, `search` and `search_re` with set operations
4544
- Using raw transducers
4645

4746

@@ -83,6 +82,24 @@ m = Map.from_iter( file_iterator('/your/input/file/'), '/your/mmapped/output.fst
8382

8483
# re-open a file you built previously with from_iter()
8584
m = Map(path='/path/to/existing.fst')
85+
86+
# slicing multiple sets efficiently
87+
a = Set.from_iter(["bar", "foo"])
88+
b = Set.from_iter(["baz", "foo"])
89+
list(UnionSet(a, b)['ba':'bb'])
90+
['bar', 'baz']
91+
92+
# searching multiple sets efficiently
93+
a = Set.from_iter(["bar", "foo"])
94+
b = Set.from_iter(["baz", "foo"])
95+
list(UnionSet(a, b).search('ba', 1)
96+
['bar', 'baz']
97+
98+
# searching multiple sets with a regex efficiently
99+
a = Set.from_iter(["bar", "foo"])
100+
b = Set.from_iter(["baz", "foo"])
101+
list(UnionSet(a, b).search_re(r'b\w{2}')
102+
['bar', 'baz']
86103
```
87104

88105

0 commit comments

Comments
 (0)