Giter Club home page Giter Club logo

Comments (10)

myint avatar myint commented on June 24, 2024

Seems to work okay for me. What is the contents of your ~/.scspell/dictionary.txt?

from scspell.

k4rtik avatar k4rtik commented on June 24, 2024

Looks like some default dictionary:

$ cat .scspell/dictionary.txt
FILETYPE: C/C++; .h, .hh, .hpp, .hxx, .c, .cc, .cpp, .cxx
acos
ansi
...
wostream
wprintf
wscanf

from scspell.

myint avatar myint commented on June 24, 2024

Is there a line NATURAL: in there? If not, that might explain the problem.

For example, I can reproduce the problem if I remove NATURAL: from my dictionary.txt.

from scspell.

k4rtik avatar k4rtik commented on June 24, 2024

Nope, content of that file had just one header (FILETYPE) and all terms related to programming:

k4rtik at PlatiniumAir in ~
$ cat .scspell/dictionary.txt | grep NATURAL
k4rtik at PlatiniumAir in ~

Do I need to include some natural language dictionary myself? Or did scspell fail to automatically find any on my OS X 10.10.3 system and hence it is missing in this file?

from scspell.

myint avatar myint commented on June 24, 2024

Remove the ~/.scspell directory and run scspell again against any file. It should detect that the directory is missing and recreate a correct dictionary file for you.

If the above doesn't work, then maybe your installation of scspell is corrupted. In that case, reinstall scspell and do the above again.

from scspell.

k4rtik avatar k4rtik commented on June 24, 2024
$ scspell tp-dialog.rkt
Warning: unable to read dictionary file "/Users/k4rtik/.scspell/dictionary.txt". (Reason: [Errno 2] No such file or directory: '/Users/k4rtik/.scspell/dictionary.txt')
Continuing with empty dictionary.

tp-dialog.rkt:1: Unmatched 'lang' --> {lang}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

tp-dialog.rkt:1: Unmatched 'racket' --> {racket}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
      Subtoken 'racket':
         (b)ack, (i)gnore, add to (p)rogramming language dictionary, or add to
         (n)atural language dictionary? [i]
            Extension ".rkt" is not registered.  With which programming language
            should ".rkt" be associated?
                 0: (Create new language file-type)
            Enter number of desired file-type: Racket
            Enter number of desired file-type: 0
            Enter a descriptive name for the programming language: Racket

tp-dialog.rkt:1: Unmatched 'base' --> {base}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
   1: #lang racket/base
   2: (require racket/gui/base
   3:          racket/class

   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

tp-dialog.rkt:2: Unmatched 'require' --> {require}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

tp-dialog.rkt:3: Unmatched 'class' --> {class}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
User abort.
Warning: unable to write dictionary file "/Users/k4rtik/.scspell/dictionary.txt". (Reason: [Errno 2] No such file or directory: '/Users/k4rtik/.scspell/dictionary.txt')

Without dictionary file, all words started getting flagged. Ctrl-C interrupt resulted in [Errno 2] as shown.

I will try reinstalling.

from scspell.

k4rtik avatar k4rtik commented on June 24, 2024

Post-reinstall log:

  1. Dictionary was restored, had C/C++, Python and Natural language words.
  2. I could run scspell on tp-dialog.rkt correctly
  3. I added a word to a new programming dictionary "Racket", few more additions.
  4. Continue spellcheck, program crashed.
  5. dictionary.txt now had just the C/C++ words, rest of the file was gone.

I think it's a bug somewhere in writing to the dictionary file (after adding a new language). Trimmed shell log follows:

$ scspell tp-dialog.rkt
tp-dialog.rkt:9: Unmatched 'getinfo' --> {getinfo}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

[...]
tp-dialog.rkt:17: Unmatched 'htdp' --> {htdp}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
      Subtoken 'htdp':
         (b)ack, (i)gnore, add to (p)rogramming language dictionary, or add to
         (n)atural language dictionary? [i]
            Extension ".rkt" is not registered.  With which programming language
            should ".rkt" be associated?
                 0: C/C++
                 1: Python
                 2: (Create new language file-type)
            Enter number of desired file-type: 2
            Enter a descriptive name for the programming language: Racket

tp-dialog.rkt:19: Unmatched 'teachpack' --> {teachpack}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
      Subtoken 'teachpack':
         (b)ack, (i)gnore, add to (p)rogramming language dictionary, or add to
         (n)atural language dictionary? [i]

tp-dialog.rkt:21: Unmatched 'teachpacks' --> {teachpacks}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
      Subtoken 'teachpacks':
         (b)ack, (i)gnore, add to (p)rogramming language dictionary, or add to
         (n)atural language dictionary? [i]

tp-dialog.rkt:25: Unmatched 'syms' --> {syms}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

[...]
tp-dialog.rkt:88: Unmatched 'dclick' --> {dclick}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
  86:                    (λ (this evt)
  87:                      (case (send evt get-event-type)
  88:                        [(list-box-dclick)
  89:                         (update-button-and-conflict)
  90:                         (selected this)]

   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

tp-dialog.rkt:179: Unmatched 'parameterize' --> {parameterize}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]
      Subtoken 'parameterize':
         (b)ack, (i)gnore, add to (p)rogramming language dictionary, or add to
         (n)atural language dictionary? [i]

[...]
tp-dialog.rkt:412: Unmatched 'rackunit' --> {rackunit}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

tp-dialog.rkt:415: Unmatched 'lkup' --> {lkup}
   (i)gnore, (I)gnore all, (r)eplace, (R)eplace all, (a)dd to dictionary, or
   show (c)ontext? [i]

Traceback (most recent call last):
  File "/usr/local/bin/scspell", line 85, in <module>
    scspell.spell_check(files, opts.override_filename, opts.report)
  File "/usr/local/lib/python2.7/site-packages/scspell/__init__.py", line 621, in spell_check
    spell_check_file(f, dicts, ignores, report_only)
  File "/usr/local/lib/python2.7/site-packages/scspell/_corpus.py", line 511, in __exit__
    self.close()
  File "/usr/local/lib/python2.7/site-packages/scspell/_corpus.py", line 356, in close
    corpus.write(f)
  File "/usr/local/lib/python2.7/site-packages/scspell/_corpus.py", line 143, in write
    f.write('\n')
TypeError: must be unicode, not str

from scspell.

myint avatar myint commented on June 24, 2024

I see. This is a Python 2 related issue, which would explain why I never saw this on my installation. Thanks for the stack trace.

from scspell.

myint avatar myint commented on June 24, 2024

It should be fixed now. Install the latest version and then remove the ~/.scspell and run scspell once again.

from scspell.

k4rtik avatar k4rtik commented on June 24, 2024

Great, no crash now. Thanks for the quick fix. 😄

from scspell.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.