rodricios / autocomplete

Autocomplete - an adult and kid friendly exercise in creating a predictive program
450 stars 74 forks source link

autocomplete.load() console output #3

Open ramAdam opened 8 years ago

ramAdam commented 8 years ago

training! Error in opening pickle object. Training on default corpus text. ('saving to:', '/usr/local/lib/python2.7/dist-packages/autocomplete/models_compressed.pkl') Traceback (most recent call last): File "/home/dev/Documents/atom-workspace/autocom.py", line 4, in autocomplete.load() File "/usr/local/lib/python2.7/dist-packages/autocomplete/init.py", line 69, in load models.load_models() File "/usr/local/lib/python2.7/dist-packages/autocomplete/models.py", line 108, in load_models train_bigtxt() File "/usr/local/lib/python2.7/dist-packages/autocomplete/models.py", line 71, in train_bigtxt train_models(str(bigtxtfile.read())) File "/usr/local/lib/python2.7/dist-packages/autocomplete/models.py", line 61, in train_models save_models(os.path.join(os.path.dirname(file), model_name)) File "/usr/local/lib/python2.7/dist-packages/autocomplete/models.py", line 85, in save_models open(path, 'wb'), IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/autocomplete/models_compressed.pkl' [Finished in 12.56s]

rhythm9229 commented 8 years ago

execute the script with root permissions, the error will go away.

bvanrijn commented 8 years ago

@rhythm9229 No! Don't do that. Instead, specify model_name in train_models. Give it an absolute path to where you want to save the database, for instance /home/guido/python/autocomplete/model.pkl:

models.train_models("big string of text", model_name="/home/guido/python/autocomplete/model.pkl")
ghost commented 6 years ago

@bvanrijn What does "models" refer to in your code ?

How you change the text file Autocomplete relies on to autocomplete words. I'd like to change the autocompletion language by changing the text file used as basis to autocomplete.

bvanrijn commented 6 years ago

Hello from the future @PLChevalier! I think it is

from autocomplete import models