Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indent error #5

Open
siegfang opened this issue May 21, 2014 · 2 comments
Open

indent error #5

siegfang opened this issue May 21, 2014 · 2 comments

Comments

@siegfang
Copy link

Hi! There have some indent miss in the code file, when I download the entire project, like nut/bow.py L39:

    for fname in bowfnames:
        with open(fname) as f:
        for i, line in enumerate(f):
        if maxlines != -1 and i >= maxlines:
            break
        label, tokens = parse_bow(line)
        for token,freq in tokens:
            fd[token] += 1

other files have the same error:
bow.py: L63
pivotselection: L80, L102, L117, L136
util.py: L54, L71, L74

@pprett
Copy link
Owner

pprett commented May 21, 2014

hmm... this is strange - looks ok on github - maybe tabs? what error do you get when you run the Python interpreter?

@siegfang
Copy link
Author

Well, after I download the code from the GitHub, the diference was found when I compare with the code presented in the GitHub page. I got the following error while running the interpreter:

Traceback (most recent call last):
  File "clscl_train.py", line 7, in <module>
    import nut.structlearn.clscl
  File "Z:\CodeSpace\Python\crossLing\nut-master-py2\nut\structlearn\clscl.py",
line 29, in <module>
    from ..bow import vocabulary, disjoint_voc, load
  File "Z:\CodeSpace\Python\crossLing\nut-master-py2\nut\bow.py", line 39
    for i, line in enumerate(f):
      ^
IndentationError: expected an indented block

if you examine the number of the tab and space, you can find some error. For exampe, use "→" and "--" to note the tab and 4 space in the code. When select the space before the "for" in bow.py#L39, you may found there miss a indent.

--for fname in bowfnames:
----with open(fname) as f:
→--for i, line in enumerate(f):
→→if maxlines != -1 and i >= maxlines:
→→--break
→→label, tokens = parse_bow(line)
→→for token,freq in tokens:
→→--fd[token] += 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants