File: example.py

package info (click to toggle)
tre 0.8.0-6
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 6,620 kB
  • ctags: 1,032
  • sloc: sh: 12,217; ansic: 9,894; makefile: 159; python: 44; sed: 16
file content (20 lines) | stat: -rw-r--r-- 477 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import tre

fz = tre.Fuzzyness(maxerr = 3)
print fz

pt = tre.compile("Don(ald( Ervin)?)? Knuth", tre.EXTENDED)
data = """
In addition to fundamental contributions in several branches of
theoretical computer science, Donnald Erwin Kuth is the creator of the
TeX computer typesetting system, the related METAFONT font definition
language and rendering system, and the Computer Modern family of
typefaces.

"""

m = pt.search(data, fz)

if m:
    print m.groups()
    print m[0]