Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ok.

    import dawg
    with open('/usr/share/dict/words','r') as words:
        d = dawg.DAWG(w.strip() for w in words)


a minor remark: with the current `dawg` module implementation this should be

    import dawg
    with open('/usr/share/dict/words','r') as f:
        words = (w.strip() for w in f)
        d = dawg.DAWG(words, input_is_sorted=True)


I assume GP meant, don't store all the words in memory at once.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: