MCPcopy Index your code
hub / github.com/clips/pattern / Sentence

Class Sentence

pattern/text/search.py:32–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 return self
31
32class Sentence(list):
33
34 def __init__(self, string="", token=["word"]):
35 """ A list of words, where punctuation marks are split from words.
36 """
37 for ch in PUNCTUATION: # Naive tokenization.
38 string = string.replace(ch, " %s " % ch)
39 string = re.sub(r"\s+", " ", string)
40 string = string.split(" ")
41 list.__init__(self, (Word(self, w, index=i) for i, w in enumerate(string)))
42
43 @property
44 def words(self):
45 return self
46
47 @property
48 def chunks(self):
49 return []
50
51class Word(object):
52

Callers 2

__init__Method · 0.70
matchMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…