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

Function isplit

pattern/metrics.py:448–459  ·  view source on GitHub ↗

Returns an iterator over string.split(). This is efficient in combination with cooccurrence(), since the string may be very long (e.g., Brown corpus).

(string, sep="\t\n\x0b\x0c\r ")

Source from the content-addressed store, hash-verified

446#--- WORD CO-OCCURRENCE ----------------------------------------------------------------------------
447
448def isplit(string, sep="\t\n\x0b\x0c\r "):
449 """ Returns an iterator over string.split().
450 This is efficient in combination with cooccurrence(),
451 since the string may be very long (e.g., Brown corpus).
452 """
453 a = []
454 for ch in string:
455 if ch not in sep:
456 a.append(ch)
457 continue
458 if a: yield "".join(a); a=[]
459 if a: yield "".join(a)
460
461def cooccurrence(iterable, window=(-1,-1), match=lambda x: False, filter=lambda x: True, normalize=lambda x: x):
462 """ Returns the co-occurence matrix of terms in the given iterable

Callers

nothing calls this directly

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…