Search result returned from Pattern.match(sentence), containing a sequence of Word objects.
(self, pattern, words=[], map={})
| 907 | class Match(object): |
| 908 | |
| 909 | def __init__(self, pattern, words=[], map={}): |
| 910 | """ Search result returned from Pattern.match(sentence), |
| 911 | containing a sequence of Word objects. |
| 912 | """ |
| 913 | self.pattern = pattern |
| 914 | self.words = words |
| 915 | self._map1 = dict() # Word index to Constraint. |
| 916 | self._map2 = dict() # Constraint index to list of Word indices. |
| 917 | for w in self.words: |
| 918 | self._map1[w.index] = map[w.index] |
| 919 | for k,v in self._map1.items(): |
| 920 | self._map2.setdefault(self.pattern.sequence.index(v),[]).append(k) |
| 921 | for k,v in self._map2.items(): |
| 922 | v.sort() |
| 923 | |
| 924 | def __len__(self): |
| 925 | return len(self.words) |
nothing calls this directly
no test coverage detected