Quote:
Originally Posted by Phssthpok
Hmm, having done this I realise that what I really need is a way to *find* things which are not in the dictionary, not all hyphenated words.
|
Try to replace the sub-function
replace_word() that is inside the code of the example by this one, that does a replace when the compound word is NOT is the dict:
Code:
def replace_word(wmatch):
# if word1-word2 is not is not recognized by the dictionary, replace dash by em-dash
with_em_dash = wmatch.group(1) + "—" + wmatch.group(2)
if not dictionaries.recognized(wmatch.group()):
return with_em_dash
return wmatch.group()