public function __construct($dir, $lang = null, $options = array()) { $this->options = $options + $this->options; $options =& $this->options; $this->bundle = new Bundles\File($dir, $lang); $this->factory = new Storages\Factory($options); // fsa $commonAutomat = $this->bundle->getCommonAutomatFile(); $storage = $this->factory->open($options['storage'], $commonAutomat); $this->commonFsa = Fsa::create($storage); $predictAutomat = $this->bundle->getPredictAutomatFile(); $storage = $this->factory->open($options['storage'], $predictAutomat, true); $this->predictFsa = Fsa::create($storage, true); // graminfo $gramInfoFile = $this->bundle->getGramInfoFile(); $storage = $this->factory->open($options['storage'], $gramInfoFile, true); $gramInfo = $this->createGramInfo($storage); $gramTabPath = $this->bundle->getGramTabFile(); if ($options['graminfo_as_text']) { $gramTabPath = $this->bundle->getGramTabFileWithTextIds(); } // gramtab $gramTab = $this->createGramTab($this->factory->open($options['storage'], $gramTabPath, true)); // always lazy // common source //$this->__common_source = $this->createCommonSource($bundle, $this->options['common_source']); $this->helper = $this->createMorphierHelper($gramInfo, $gramTab, $options['graminfo_as_text']); }