class_docstr: Set expansion module, given a trained np2vec model.
class_docstr_tok: ["Set","expansion","module",",","given","a","trained","np2vec","model","."]
docstr: Load the np2vec model for set expansion.
  
  Args:
      np2vec_model_file (str): the file containing the np2vec model to load
      binary (bool): boolean indicating whether the np2vec model to load is in binary format
      word_ngrams (int {1,0}): If 1, np2vec model to load uses word vectors with subword (
      ngrams) information.
      light_grouping (bool): boolean indicating whether to load all maps for grouping.
      grouping_map_dir (str): path to the directory containing maps for grouping.
  Returns:
      np2vec model to load
docstr_tok: ["Load","the","np2vec","model","for","set","expansion",".","Args",":","np2vec_model_file","(","str",")",":","the","file","containing","the","np2vec","model","to","load","binary","(","bool",")",":","boolean","indicating","whether","the","np2vec","model","to","load","is","in","binary","format","word_ngrams","(","int","{","1,0","}",")",":","If","1",",","np2vec","model","to","load","uses","word","vectors","with","subword","(","ngrams",")","information",".","light_grouping","(","bool",")",":","boolean","indicating","whether","to","load","all","maps","for","grouping",".","grouping_map_dir","(","str",")",":","path","to","the","directory","containing","maps","for","grouping",".","Returns",":","np2vec","model","to","load"]
code: def __init__(
      self,
      np2vec_model_file,
      binary=False,
      word_ngrams=False,
      grouping=False,
      light_grouping=False,
      grouping_map_dir=None,
  ):
      """
      Load the np2vec model for set expansion.
  
      Args:
          np2vec_model_file (str): the file containing the np2vec model to load
          binary (bool): boolean indicating whether the np2vec model to load is in binary format
          word_ngrams (int {1,0}): If 1, np2vec model to load uses word vectors with subword (
          ngrams) information.
          light_grouping (bool): boolean indicating whether to load all maps for grouping.
          grouping_map_dir (str): path to the directory containing maps for grouping.
      Returns:
          np2vec model to load
      """
      self.grouping = grouping
      if grouping:
          # load grouping info
          logger.info("loading grouping data")
          if not grouping_map_dir:
              grouping_map_dir = path.dirname(np2vec_model_file)
          self.np2id = load_json_file(
              path.join(grouping_map_dir, "np2id")
          )
          if not light_grouping:
              self.id2rep = load_json_file(
                  path.join(grouping_map_dir, "id2rep")
              )
              self.id2group = load_json_file(
                  path.join(grouping_map_dir, "id2group")
              )
      logger.info("loadind model...")
      self.np2vec_model = NP2vec.load(
          np2vec_model_file, binary=binary, word_ngrams=word_ngrams
      )
      # extract the first term of the model in order to get the marking character
      logger.info("compute L2 norm")
      first_term = next(iter(self.np2vec_model.vocab.keys()))
      self.mark_char = first_term[-1]
      # Precompute L2-normalized vectors.
      self.np2vec_model.init_sims()
      logger.info("done init")
  
file_path: nlp-architect/solutions/set_expansion/set_expand.py
imports: import logging
  import sys
  from argparse import ArgumentParser
  from os import path
  from nlp_architect.models.np2vec import NP2vec
  from nlp_architect.utils.io import validate_existing_filepath, check_size, load_json_file
label_desc: Use image node_id 1 to create a new SetExpand object from inherited base classes: object with example: obj = SetExpand(np2vec_model_file, binary, word_ngrams, grouping, light_grouping, grouping_map_dir)