Skip to main content
  1. About
  2. For Teams
Asked
Viewed 2k times
0

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.