martan
martan

Reputation: 95

using ngram in python

i'm trying to run the following code

       from ngram import NGram
       NGram.compare('foo', 'foobar')

But i'm getting the error

    Traceback (most recent call last):
    File "E:/pt/tandra", line 1, in <module>
    from ngram import Ngram
    ImportError: No module named ngram

what could be the possible reason. The ngram folder is in the same directory as the file

Upvotes: 0

Views: 2474

Answers (1)

CuriousD
CuriousD

Reputation: 1775

You don't have module called ngram. You need to install it. Just use

easy_install ngram

or

pip install ngram

in terminal (for Linux, Mac OS, Cygwin in Windows) if you have python setuptools.

Upvotes: 2

Related Questions