ViterbiBuilder builds word lattice (ViterbiLattice)
@param {DynamicDictionaries} dic dictionary
@constructor
433643
function ViterbiBuilder(dic) {
    this.trie = dic.trie;
    this.token_info_dictionary = dic.token_info_dictionary;
    this.unknown_dictionary = dic.unknown_dictionary;
}
626462
function createWordNode (item) {
      var wordNode = parser.createParentNode('Word')

      if (options && options.pos) {
        wordNode.data = item
      }

      var textNode = parser.createTextNode('Text', item.surface_form)

      parser.add(textNode, wordNode)

      return wordNode
    }
1133213
function buildSubNav(obj) {
    var longname = obj.longname;
    var members = find({
        kind: 'member',
        memberof: longname
    });
    var methods = find({
        kind: 'function',
        memberof: longname
    });
    var events = find({
        kind: 'event',
        memberof: longname
    });
    var typedef = find({
        kind: 'typedef',
        memberof: longname
    });

    var html = '<div class="hidden" id="' + obj.longname.replace(/"/g, '_') + '_sub">';
    html += buildSubNavMembers(members, 'Members');
    html += buildSubNavMembers(methods, 'Methods');
    html += buildSubNavMembers(events, 'Events');
    html += buildSubNavMembers(typedef, 'Typedef');
    html += '</div>';

    return html;
}
591638
private void createDictionaries(String file, String conllFormat) throws IOException
    {
        long start = System.currentTimeMillis();
        logger.debug("Creating dictionariesSet ... ");

        dictionariesSet.setCounters();

        DependencyReader reader = DependencyReader.createDependencyReader(conllFormat);

        reader.startReading(file);
        DependencyInstance dependencyInstance = reader.nextInstance();

        while (dependencyInstance != null) {
            //This loop sets values in dictionariesSet for later use
            dependencyInstance.setInstIds(dictionariesSet, coarseMap, conjWord);

            dependencyInstance = reader.nextInstance();
        }
        reader.close();

        dictionariesSet.closeCounters();

        synFactory.setTokenStart(dictionariesSet.lookupIndex(POS, "#TOKEN_START#"));
        synFactory.setTokenEnd(dictionariesSet.lookupIndex(POS, "#TOKEN_END#"));
        synFactory.setTokenMid(dictionariesSet.lookupIndex(POS, "#TOKEN_MID#"));

        dictionariesSet.stopGrowth(DEP_LABEL);
        dictionariesSet.stopGrowth(POS);
        dictionariesSet.stopGrowth(WORD);

        synFactory.setWordNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(WORD) + 1));
        synFactory.setTagNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(POS) + 1));
        synFactory.setDepNumBits(Utils.log2((long) dictionariesSet.getDictionarySize(DEP_LABEL) + 1));
        synFactory.setFlagBits(2*synFactory.getDepNumBits() + 4);

        types = new String[dictionariesSet.getDictionarySize(DEP_LABEL)];
        Dictionary labelDict = dictionariesSet.getDictionary(DEP_LABEL);
        Object[] keys = labelDict.toArray();
        for (Object key : keys) {
            int id = labelDict.lookupIndex(key);
            types[id - 1] = (String) key;
        }

        if(logger.isDebugEnabled()) {
            logger.debug(String.format("%d %d %n", NUM_WORD_FEAT_BITS, NUM_ARC_FEAT_BITS));
            logger.debug(String.format("Lexical items: %d (%d bits)%n",
                    dictionariesSet.getDictionarySize(WORD), synFactory.getWordNumBits()));
            logger.debug(String.format("Tag/label items: %d (%d bits)  %d (%d bits)%n",
                    dictionariesSet.getDictionarySize(POS), synFactory.getTagNumBits(),
                    dictionariesSet.getDictionarySize(DEP_LABEL), synFactory.getDepNumBits()));
            logger.debug(String.format("Flag Bits: %d%n", synFactory.getFlagBits()));
            logger.debug(String.format("Creation took [%d ms]%n", System.currentTimeMillis() - start));
        }

    }
960472
function createBlobEncoder(schema, opts) {
  var encoder = new containers.streams.BlockEncoder(schema, opts);
  var builder = new BlobWriter();
  encoder.pipe(builder);
  return new stream.Duplex({
    objectMode: true,
    read: function () {
      // Not the fastest implementation, but it will only be called at most
      // once (since the builder only ever emits a single value) so it'll do.
      // It's also likely impractical to create very large blobs.
      var val = builder.read();
      if (val) {
        done(val);
      } else {
        builder.once('readable', done);
      }
      var self = this;
      function done(val) {
        self.push(val || builder.read());
        self.push(null);
      }
    },
    write: function (val, encoding, cb) {
      return encoder.write(val, encoding, cb);
    }
  }).on('finish', function () { encoder.end(); });
}
1190086
function deflateSetDictionary(strm, dictionary) {
  var dictLength = dictionary.length;

  var s;
  var str, n;
  var wrap;
  var avail;
  var next;
  var input;
  var tmpDict;

  if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {
    return Z_STREAM_ERROR;
  }

  s = strm.state;
  wrap = s.wrap;

  if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
    return Z_STREAM_ERROR;
  }

  /* when using zlib wrappers, compute Adler-32 for provided dictionary */
  if (wrap === 1) {
    /* adler32(strm->adler, dictionary, dictLength); */
    strm.adler = adler32(strm.adler, dictionary, dictLength, 0);
  }

  s.wrap = 0;   /* avoid computing Adler-32 in read_buf */

  /* if dictionary would fill window, just replace the history */
  if (dictLength >= s.w_size) {
    if (wrap === 0) {            /* already empty otherwise */
      /*** CLEAR_HASH(s); ***/
      zero(s.head); // Fill with NIL (= 0);
      s.strstart = 0;
      s.block_start = 0;
      s.insert = 0;
    }
    /* use the tail */
    // dictionary = dictionary.slice(dictLength - s.w_size);
    tmpDict = new utils.Buf8(s.w_size);
    utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);
    dictionary = tmpDict;
    dictLength = s.w_size;
  }
  /* insert dictionary into window and hash */
  avail = strm.avail_in;
  next = strm.next_in;
  input = strm.input;
  strm.avail_in = dictLength;
  strm.next_in = 0;
  strm.input = dictionary;
  fill_window(s);
  while (s.lookahead >= MIN_MATCH) {
    str = s.strstart;
    n = s.lookahead - (MIN_MATCH - 1);
    do {
      /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */
      s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;

      s.prev[str & s.w_mask] = s.head[s.ins_h];

      s.head[s.ins_h] = str;
      str++;
    } while (--n);
    s.strstart = str;
    s.lookahead = MIN_MATCH - 1;
    fill_window(s);
  }
  s.strstart += s.lookahead;
  s.block_start = s.strstart;
  s.insert = s.lookahead;
  s.lookahead = 0;
  s.match_length = s.prev_length = MIN_MATCH - 1;
  s.match_available = 0;
  strm.next_in = next;
  strm.input = input;
  strm.avail_in = avail;
  s.wrap = wrap;
  return Z_OK;
}
738327
function addVocabAsProperties(schema, terms_array) {
  if (!schema.properties) schema.properties = {};
  var propertySchema = schema.propertySchema || {};
  _.each(terms_array, function(term) {
    schema.properties[term] = vocab(term)
    if (propertySchema) {
      if (propertySchema.known) {
        propertySchema.known.push(term);
      }
      if (propertySchema.enum) {
        propertySchema.enum.push(term);
      }
    }
  });
}
37862
def _build(self, lexer):
        
        key = ''
        while key != 'EndOfFile':

            token = next(lexer)
            key = token.__class__.__name__

            if key == 'HeaderBlock':
                self[key].update(token._asdict())

            elif key == 'CtabBlockStart':
                ctab = Ctab()
                ctab._build(lexer)
                self['Ctab'] = ctab

            elif key == 'MolfileStart':
                pass

            elif key in ('MolfileEnd', 'EndOfFile'):
                break

            else:
                raise KeyError('Molfile object does not supposed to have any other information: "{}".'.format(key))

        return self
168703
def setup_data_split(X, y, tokenizer, proc_data_dir, **kwargs):
    
    X_train, X_val, X_test, y_train, y_val, y_test = split_data(X, y)

    # only build vocabulary on training data
    tokenizer.build_vocab(X_train)

    process_save(X_train, y_train, tokenizer, path.join(
        proc_data_dir, 'train.bin'), train=True, **kwargs)
    process_save(X_val, y_val, tokenizer, path.join(
        proc_data_dir, 'val.bin'), **kwargs)
    process_save(X_test, y_test, tokenizer, path.join(
        proc_data_dir, 'test.bin'), **kwargs)
968434
function createDefaultBuildJson(content) {
    if (!content.ios) {
      content.ios = {};
    }
    if (!content.ios.debug) {
      content.ios.debug = {};
    }
    if (!content.ios.release) {
      content.ios.release = {};
    }
  }
189388
def _build_data_block(self, lexer):
        
        data_block = OrderedDict()
        header = ''

        while True:
            token = next(lexer)
            key = token.__class__.__name__

            if key == 'DataHeader':
                header = token.header[1:-1]
                data_block.setdefault(header, [])

            elif key == 'DataItem':
                data_block[header].append(token.data_item)

            elif key == 'DataBlockEnd':
                break

            else:
                raise KeyError('SDfile data block does not supposed to have any other information: "{}".'.format(key))

        return data_block
1235972
function build (instFile) {
  var dir = path.dirname(instFile)
  var inst = JSON.parse(fs.readFileSync(instFile))
  inst.samples = samples(path.join(dir, 'samples'), true)
  return JSON.stringify(inst, null, 2)
}
938931
function writeDictionary( dictionary, errBuf ) {
	var writeSuccess = true,
		dict = new Dictionary();

	dict.dictionary = dictionary;
	dict.compile();

	Object.keys( dict.getAll() ).forEach( function( localeID ){
		var locale = dict.getLocale( localeID ),
			localePath = path.join( dictionary.meta.dest, localeID );

		if ( !fs.existsSync( localePath ) ) {
			mkdirp.sync( localePath );
			fs.writeFileSync(
				path.join( localePath, 'messages.json' ),
				JSON.stringify( locale, null, 2 )
			);
		} else {
			errBuf.push( 'Error (dest): directory "' + localePath + '" is not empty!' );
			writeSuccess = false;
		} // if..else
	});

	return writeSuccess;
}
360330
function runDisambiguator(disambiguateRules, word){
		var result = undefined;
	
		for(var i in disambiguateRules){
	    	result = disambiguateRules[i](word);
	    	if(find(result)){
	    		break;
	    	}
	    }
	    
	    if(result==undefined){
	    	this.current_word = word;
	    	this.removal = undefined;
	    	return this;
	    }

	    return createResultObject(result, word, "DP");
	}
658311
protected function buildDictionary()
    {
        // Build dictionary.
        $this->dictionary = array();

        foreach ($this->objects as $id => $object) {
            $type = $object->getHeader()->get('Type')->getContent();

            if (!empty($type)) {
                $this->dictionary[$type][$id] = $id;
            }
        }
    }
713639
def dictapply(d, fn):
    
    for k, v in d.items():
        if isinstance(v, dict):
            v = dictapply(v, fn)
        else:
            d[k] = fn(v)
    return d
1169884
function Words(superwords, classwords) {
	this.classwords = getwords(classwords, ['extend', 'mixin']);
	this.superwords = getwords(superwords, ['this._super']).map(function dot(
		word
	) {
		return word + '.';
	});
}