Als Heuristik kann man das machen. Aber natürliche Sprache ist halt sehr komplex und es kommen diverse Sonderfälle vor, die man oft nicht alle auf dem Schirm hat. Im Originaltext kommt zum Beispiel in größerer Zahl so etwas vor:
Code: Alles auswählen
In [1]: words = open('./nltk_data/corpora/gutenberg/carroll-alice.txt').read().split()
In [2]: [word for word in words if "--" in word]
Out[2]:
'rabbit-hole--and',
…
'particular--Here,',
…
'muchness--you',
'muchness"--did',
…
"Alice)--'and",
…
"eyes.--'Tell",
'adventures--beginning',
…
"'important--unimportant--unimportant--important--'",
…
'again--"BEFORE',
…
'farm-yard--while']
Da bietet es sich an, eine Bibliothek zu verwenden, in der so etwas sauber einmal implementiert wurde. Und es ist doch schön, dass das mit Python so einfach geht.