@plac.annotations(<EOL>lang=("<STR_LIT>", "<STR_LIT>", None, str),<EOL>output_dir=("<STR_LIT>", "<STR_LIT>", None, Path),<EOL>freqs_loc=("<STR_LIT>", "<STR_LIT>", "<STR_LIT:f>", Path),<EOL>jsonl_loc=("<STR_LIT>", "<STR_LIT>", "<STR_LIT>", Path),<EOL>clusters_loc=("<STR_LIT>", "<STR_LIT>", "<STR_LIT:c>", str),<EOL>vectors_loc=("<STR_LIT>", "<STR_LIT>", "<STR_LIT:v>", str),<EOL>prune_vectors=("<STR_LIT>", "<STR_LIT>", "<STR_LIT>", int),<EOL>)<EOL>def init_model(<EOL>lang,<EOL>output_dir,<EOL>freqs_loc=None,<EOL>clusters_loc=None,<EOL>jsonl_loc=None,<EOL>vectors_loc=None,<EOL>prune_vectors=-<NUM_LIT:1>,<EOL>):
if jsonl_loc is not None:<EOL><INDENT>if freqs_loc is not None or clusters_loc is not None:<EOL><INDENT>settings = ["<STR_LIT>"]<EOL>if freqs_loc:<EOL><INDENT>settings.append("<STR_LIT>")<EOL><DEDENT>if clusters_loc:<EOL><INDENT>settings.append("<STR_LIT:-c>")<EOL><DEDENT>msg.warn(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>)<EOL><DEDENT>jsonl_loc = ensure_path(jsonl_loc)<EOL>lex_attrs = srsly.read_jsonl(jsonl_loc)<EOL><DEDENT>else:<EOL><INDENT>clusters_loc = ensure_path(clusters_loc)<EOL>freqs_loc = ensure_path(freqs_loc)<EOL>if freqs_loc is not None and not freqs_loc.exists():<EOL><INDENT>msg.fail("<STR_LIT>", freqs_loc, exits=<NUM_LIT:1>)<EOL><DEDENT>lex_attrs = read_attrs_from_deprecated(freqs_loc, clusters_loc)<EOL><DEDENT>with msg.loading("<STR_LIT>"):<EOL><INDENT>nlp = create_model(lang, lex_attrs)<EOL><DEDENT>msg.good("<STR_LIT>")<EOL>if vectors_loc is not None:<EOL><INDENT>add_vectors(nlp, vectors_loc, prune_vectors)<EOL><DEDENT>vec_added = len(nlp.vocab.vectors)<EOL>lex_added = len(nlp.vocab)<EOL>msg.good(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>".format(lex_added, vec_added),<EOL>)<EOL>if not output_dir.exists():<EOL><INDENT>output_dir.mkdir()<EOL><DEDENT>nlp.to_disk(output_dir)<EOL>return nlp<EOL>
Create a new model from raw data, like word frequencies, Brown clusters
and word vectors. If vectors are provided in Word2Vec format, they can
be either a .txt or zipped as a .zip or .tar.gz.