Skip to content

Commit 1fa0667

Browse files
author
Alexandre van Beurden
committed
update README.md
1 parent 1e99571 commit 1fa0667

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed

README.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,167 @@ result = term1.intersection(term2, term3)\
3636

3737
print(result)
3838
```
39+
40+
## Features
41+
42+
- [Intersection](#intersection)
43+
- [Union](#union)
44+
- [Subtraction / Difference](#subtraction--difference)
45+
- [Equivalence](#equivalence)
46+
- [Subset](#subset)
47+
- [Details](#details)
48+
- [Generate Strings](#generate-strings)
49+
50+
### Intersection
51+
52+
#### Request
53+
54+
Compute the intersection of the provided terms and return the resulting term.
55+
56+
The maximum number of terms is currently limited to 10.
57+
58+
```python
59+
term1 = Term.regex(r"(abc|de){2}")
60+
term2 = Term.regex(r"de.*")
61+
term3 = Term.regex(r".*abc")
62+
63+
result = term1.intersection(term2, term3)
64+
print(result)
65+
```
66+
67+
#### Response
68+
69+
```
70+
regex=deabc
71+
```
72+
73+
### Union
74+
75+
Compute the union of the provided terms and return the resulting term.
76+
77+
The maximum number of terms is currently limited to 10.
78+
79+
#### Request
80+
81+
```python
82+
term1 = Term.regex(r"abc")
83+
term2 = Term.regex(r"de")
84+
term3 = Term.regex(r"fghi")
85+
86+
result = term1.union(term2, term3)
87+
print(result)
88+
```
89+
90+
#### Response
91+
92+
```
93+
regex=(abc|de|fghi)
94+
```
95+
96+
### Subtraction / Difference
97+
98+
Compute the first term minus the second and return the resulting term.
99+
100+
#### Request
101+
102+
```python
103+
term1 = Term.regex(r"(abc|de)")
104+
term2 = Term.regex(r"de")
105+
106+
result = term1.subtraction(term2)
107+
print(result)
108+
```
109+
110+
#### Response
111+
112+
```
113+
regex=abc
114+
```
115+
116+
### Equivalence
117+
118+
Analyze if the two provided terms are equivalent.
119+
120+
#### Request
121+
122+
```python
123+
term1 = Term.regex(r"(abc|de)")
124+
term2 = Term.regex(r"(abc|de)*")
125+
126+
result = term1.is_equivalent_to(term2)
127+
print(result)
128+
```
129+
130+
#### Response
131+
132+
```
133+
False
134+
```
135+
136+
### Subset
137+
138+
Analyze if the second term is a subset of the first.
139+
140+
#### Request
141+
142+
```java
143+
term1 = Term.regex(r"de")
144+
term2 = Term.regex(r"(abc|de)")
145+
146+
result = term1.is_subset_of(term2)
147+
print(result)
148+
```
149+
150+
#### Response
151+
152+
```
153+
True
154+
```
155+
156+
### Details
157+
158+
Compute the details of the provided term.
159+
160+
The computed details are:
161+
162+
- **Cardinality:** the number of possible values.
163+
- **Length:** the minimum and maximum length of possible values.
164+
- **Empty:** true if is an empty set (does not contain any value), false otherwise.
165+
- **Total:** true if is a total set (contains all values), false otherwise.
166+
167+
#### Request
168+
169+
```python
170+
term = Term.regex(r"(abc|de)")
171+
172+
details = term.get_details()
173+
print(details)
174+
```
175+
176+
#### Response
177+
178+
```
179+
Details[cardinality=Integer(2), length=Length[minimum=2, maximum=3], empty=false, total=false]
180+
```
181+
182+
### Generate Strings
183+
184+
Generate the given number of strings that can be matched by the provided term.
185+
186+
The maximum number of strings to generate is currently limited to 200.
187+
188+
#### Request
189+
190+
```python
191+
term = Term.regex(r"(abc|de){2}")
192+
193+
strings = term.generate_strings(3)
194+
print(strings)
195+
```
196+
197+
#### Response
198+
199+
```
200+
['deabc', 'abcde', 'dede']
201+
```
202+

0 commit comments

Comments
 (0)