Static method init

@param array $options # other options

@return void
164010
public static function init($options = array())
    {
        $defaults = array(
            'mode'=>'default'
        );

        $options = array_merge($defaults, $options);

        self::$prob_start = self::loadModel(dirname(dirname(__FILE__)).'/model/pos/prob_start.json');
        self::$prob_trans = self::loadModel(dirname(dirname(__FILE__)).'/model/pos/prob_trans.json');
        self::$prob_emit = self::loadModel(dirname(dirname(__FILE__)).'/model/pos/prob_emit.json');
        self::$char_state = self::loadModel(dirname(dirname(__FILE__)).'/model/pos/char_state.json');

        if (Jieba::$dictname!="") {
            $content = fopen(dirname(dirname(__FILE__))."/dict/".Jieba::$dictname, "r");
            while (($line = fgets($content)) !== false) {
                $explode_line = explode(" ", trim($line));
                $word = $explode_line[0];
                $freq = $explode_line[1];
                $tag = $explode_line[2];
                self::$word_tag[$word] = $tag;
            }
            fclose($content);
        }


        if (sizeof(Jieba::$user_dictname)!=0) {
            for ($i = 0; $i<sizeof(Jieba::$user_dictname); $i++) {
                $content = fopen(Jieba::$user_dictname[$i], "r");
                while (($line = fgets($content)) !== false) {
                    $explode_line = explode(" ", trim($line));
                    $word = $explode_line[0];
                    $freq = $explode_line[1];
                    $tag = $explode_line[2];
                    self::$word_tag[$word] = $tag;
                }
                fclose($content);
            }
        }

        $content = fopen(dirname(dirname(__FILE__))."/dict/pos_tag_readable.txt", "r");

        while (($line = fgets($content)) !== false) {
            $explode_line = explode(" ", trim($line));
            $tag = $explode_line[0];
            $meaning = $explode_line[1];
            self::$pos_tag_readable[$tag] = $meaning;
        }
        fclose($content);
    }
1076074
public static function init($options = array())
    {

        $defaults = array(
            'mode'=>'default',
            'dict'=>'normal'
        );

        $options = array_merge($defaults, $options);

        if ($options['dict']=='big') {
            $f_name = "idf.big.txt";
        } else {
            $f_name = "idf.txt";
        }
        $content = fopen(dirname(dirname(__FILE__))."/dict/idf.txt", "r");

        while (($line = fgets($content)) !== false) {
            $explode_line = explode(" ", trim($line));
            $word = $explode_line[0];
            $freq = $explode_line[1];
            $freq = (float) $freq;
            self::$idf_freq[$word] = $freq;
        }
        fclose($content);

        asort(self::$idf_freq);
        $keys = array_keys(self::$idf_freq);
        $middle_key = $keys[count(self::$idf_freq)/2];
        self::$max_idf = max(self::$idf_freq);
        self::$median_idf = self::$idf_freq[$middle_key];
    }
1111840
public static function init($options = array())
    {
        $defaults = array(
            'mode'=>'default',
            'dict'=>'normal',
            'cjk'=>'chinese'
        );

        $options = array_merge($defaults, $options);

        if ($options['mode']=='test') {
            echo "Building Trie...\n";
        }

        if ($options['dict']=='small') {
            $f_name = "dict.small.txt";
            self::$dictname="dict.small.txt";
        } elseif ($options['dict']=='big') {
            $f_name = "dict.big.txt";
            self::$dictname="dict.big.txt";
        } else {
            $f_name = "dict.txt";
            self::$dictname="dict.txt";
        }

        if ($options['cjk']=='all') {
            self::$cjk_all = true;
        } else {
            self::$cjk_all = false;
        }

        $t1 = microtime(true);
        self::$dag_cache = array();
        self::$trie = Jieba::genTrie(dirname(dirname(__FILE__))."/dict/".$f_name);
        self::__calcFreq();

        if ($options['mode']=='test') {
            echo "loading model cost ".(microtime(true) - $t1)." seconds.\n";
            echo "Trie has been built succesfully.\n";
        }
    }
472708
public function setOptions(array $options)
    {
        foreach ($options as $k => $v) {
            $this->setOption($k, $v);
        }
    }
828780
protected function childInitialize(array $options = array())
    {
        $this->prepared = false;
        $this->removeAllListeners();
        $this->master = false;
        $pid = posix_getpid();
        $this->ppid = $this->pid;
        $this->pid = $pid;
        $this->queue = null;
        $this->process = new Process($this, $this->pid, $this->ppid);
        $this->children = array();
        $this->prepared = true;

        $options = $options + self::$child_options;

        $this->childProcessOptions($options);
    }
931619
protected function applyOptions(array $options): void
    {
        $this->logger->info('Applying options...', ['options' => $options]);

        $this->options = array_merge($this->options, $options);

        $this->logger->debug('Options applied and merged with defaults', ['options' => $this->options]);
    }
1274240
public function fromOptions(array $options)
    {
        $this->seo = $this->setupSeo($options);
        if (null !== $this->seo) {
            $this->language = $this->seo->getLanguage();
            $this->page = $this->seo->getPage();
        }
    }
250087
private function applyOptions(array $options)
    {
        foreach ($options as $option => $value) {
            if (isset($this->$option) && isset($value)) {
                $this->$option = $value;
            }
        }
    }
399270
protected function initTransaction(array $options = [])
    {
        if (!isset($options['transactionId'])) {
            $this->transactionId = IdGenerator::generateId();
            $this->getClient()->sendFrame(
                $this->getProtocol()->getBeginFrame($this->transactionId)
            );
        } else {
            $this->transactionId = $options['transactionId'];
        }
    }
1055651
public function setOptions($options)
    {
        if (!is_array($options)) {
            throw new Exception\InvalidArgumentException(sprintf(
                '[%s] expects array; received [%s]',
                __METHOD__,
                gettype($options)
            ));
        }

        $this->options = $options;
    }
219860
private static function initialize($files, $options)
    {
        if ($options != null && $options instanceof Options) {
            self::$options = $options;
        } else {
            self::$options = new Options();
        }
        self::$fileLoader = new ConfigurationFileLoader($files, self::$options);
        self::$data = self::$fileLoader->getData();
    }
1131240
public function setOptions(array $options = []): void
    {
        $this->options = $this->shortcuts = [];
        $this->addOptions($options);
    }
1006361
public function initMailer($options) {
		$this->options = $options;
		
		if (isset($this->options['format'])) {
			$this->formatoptions = $this->options['format'];
			unset($this->options['format']);
		}
		
		if (isset($this->options['logger'])) {
			$this->setLogger($this->options['logger']);
			
			if (!isset($this->formatoptions['logger'])) {
				$this->formatoptions['logger'] = $this->options['logger'];
			}
			
			unset($this->options['logger']);
		}
		
		
	}
1010302
public static function init($options) {
		self::$debug = !empty($options['debug']) ? true : false;
		if (self::$debug) {
			self::$email = !empty($options['email']) ? $options['email'] : null;
			self::$toolbar = !empty($options['toolbar']) ? true : false;
			self::benchmark('application start');
		}
	}
490784
public function setOptions(array $options)
    {
        $this->validateOptions($options, $this->type);

        $this->options = $options;

        return $this;
    }
568090
public function initialize(array $options)
    {
        $controller = $this->_registry->getController();

        $this->authUser = $controller->Auth->user();
        Configure::write('GlobalAuth', $this->authUser);
    }
143898
public function setOptions(array $options)
    {
        parent::setOptions($options);

        if ($this->hasOption('min') && $this->hasOption('max') ) {
            $this->setMessage(__('Invalid file size (minimum %1$s bytes, maximum %2$s bytes)', $this->getOption('min'), $this->getOption('max')));
        } elseif ($this->hasOption('max')) {
            $this->setMessage(__('The uploaded file is too large (maximum %s bytes)', $this->getOption('max')));
            $this->setOption('min', 0);
        } else {
            throw new common_Exception("Please set 'min' and/or 'max' options!");
        }
    }