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

wordrank_comparisions typeerror #1276

Closed
luoyangen opened this issue Apr 12, 2017 · 3 comments
Closed

wordrank_comparisions typeerror #1276

luoyangen opened this issue Apr 12, 2017 · 3 comments
Labels
bug Issue described a bug difficulty easy Easy issue: required small fix documentation Current issue related to documentation

Comments

@luoyangen
Copy link

hi,
I'm trying to run the wordrank_comparisions, but while training the wordrank model, got the error: TypeError: train() takes at least 4 arguments (7 given).
I can't figure out whether the code error or my python environment, but other wordrank models is successes trained. waiting for help. thx.

@tmylk
Copy link
Contributor

tmylk commented Apr 12, 2017

Hi, could you please past the exact line and the full error message?

@luoyangen
Copy link
Author

@tmylk the line is
get_ipython().magic(u'time wr_model = Wordrank.train(WR_HOME, corpus_file, **wr_params); wr_model')

the error log is:

TypeError Traceback (most recent call last)
in ()
75 print('\nUsing existing model file {:s}.vec'.format(output_file))
76
---> 77 train_models(corpus_file='proc_brown_corp.txt', output_name='brown')

in train_models(corpus_file, output_name)
59 if not os.path.isfile(os.path.join(MODELS_DIR, '{:s}.vec'.format(output_file))):
60 print('\nTraining wordrank on {:s} corpus..'.format(corpus_file))
---> 61 get_ipython().magic(u'time wr_model = Wordrank.train(WR_HOME, corpus_file, **wr_params); wr_model')
62 locals()['wr_model'].wv.save_word2vec_format(os.path.join(MODELS_DIR, '{:s}.vec'.format(output_file)))
63 print('\nSaved wordrank model as {:s}.vec'.format(output_file))

/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2156 magic_name, _, magic_arg_s = arg_s.partition(' ')
2157 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2158 return self.run_line_magic(magic_name, magic_arg_s)
2159
2160 #-------------------------------------------------------------------------

/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2077 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2078 with self.builtin_trap:
-> 2079 result = fn(*args,**kwargs)
2080 return result
2081

in time(self, line, cell, local_ns)

/usr/local/lib/python2.7/dist-packages/IPython/core/magic.pyc in (f, *a, **k)
186 # but it's overkill for just that one bit of state.
187 def magic_deco(arg):
--> 188 call = lambda f, *a, **k: f(*a, **k)
189
190 if callable(arg):

/usr/local/lib/python2.7/dist-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
1178 else:
1179 st = clock2()
-> 1180 exec(code, glob, local_ns)
1181 end = clock2()
1182 out = None

in ()

TypeError: train() takes at least 4 arguments (7 given)

@tmylk tmylk added bug Issue described a bug documentation Current issue related to documentation difficulty easy Easy issue: required small fix labels May 2, 2017
@tmylk
Copy link
Contributor

tmylk commented May 2, 2017

Thanks for spotting this. Agree that a positional argument is missing
Wordrank.train(WR_HOME, corpus_file, 'output_dir', **wr_params)

CC @parulsethi

parulsethi added a commit to parulsethi/gensim that referenced this issue May 3, 2017
@tmylk tmylk closed this as completed in 1c2a7d8 May 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue described a bug difficulty easy Easy issue: required small fix documentation Current issue related to documentation
Projects
None yet
Development

No branches or pull requests

2 participants