Maps a list of phrases to the rows of the sparse matrix.
Takes an ArrayList containing the filtered phrases (originals and alternates) and maps them to the sparse matrix.

@param phrases an ArrayList containing the filtered phrases
@return void
344592
public void mapRows() {
            int index = 0;
            for (String a_phrase : filtered_phrases) {
                String[] curr = a_phrase.split(":");
                String A = curr[0];
                String B = curr[1];
                matrix_row_map.put(new Integer(index), A + ":" + B);
                index++;
                //add reverse pair as well
                matrix_row_map.put(new Integer(index), B + ":" + A);
                index++;
            }
    }
615676
public static Map<Integer, NerClassification> positionClassificationMap(final NerResultSet nerResultSet) {
        final Map<Integer, NerClassification> m = new HashMap<>();

        for (final List<Phrase> sentence : nerResultSet.phrases) {
            for (final Phrase p : sentence) {
                final int phraseStartIndex = p.phrase.get(0).startIndex;
                for (final Token t : p.phrase) {
                    final NerClassification clas =
                            new NerClassification(t.text, p.phraseType, phraseStartIndex, p.score);
                    final NerClassification replaced = m.put(t.startIndex, clas);
                    if (replaced != null) {
                        // since modifying the contents of the map this error should now never happen
                        System.err.println("########### Error start");
                        System.err.print(nerResultSet);
                        throw new IllegalStateException("Tried to add a Token to the position classification map " +
                                                        "with startIndex " + t.startIndex + " that is already there!");
                    }
                }
            }
        }

        return m;
    }
45418
void sortVocab()
    {
        Arrays.sort(vocab, 0, vocabSize);

        // re-build vocabIndexMap
        final int size = vocabSize;
        trainWords = 0;
        table = new int[size];
        for (int i = 0; i < size; i++)
        {
            VocabWord word = vocab[i];
            // Words occuring less than min_count times will be discarded from the vocab
            if (word.cn < config.getMinCount())
            {
                table[vocabIndexMap.get(word.word)] = -4;
                vocabSize--;
            }
            else
            {
                // Hash will be re-computed, as after the sorting it is not actual
                table[vocabIndexMap.get(word.word)] = i;
                setVocabIndexMap(word, i);
            }
        }
        // lose weight
        vocabIndexMap = null;

        VocabWord[] nvocab = new VocabWord[vocabSize];
        System.arraycopy(vocab, 0, nvocab, 0, vocabSize);

    }
432623
public function transform(array &$samples) : void
    {
        if ($this->idfs === null) {
            throw new RuntimeException('Transformer has not been fitted.');
        }

        foreach ($samples as &$sample) {
            foreach ($sample as $column => &$feature) {
                if ($feature > 0) {
                    $feature *= $this->idfs[$column];
                }
            }
        }
    }
703954
def phrases_map(data):
  """"""
  (entry, text_fn) = data
  text = text_fn()
  filename = entry.filename

  logging.debug("Got %s", filename)
  for s in split_into_sentences(text):
    words = split_into_words(s.lower())
    if len(words) < PHRASE_LENGTH:
      yield (":".join(words), filename)
      continue
    for i in range(0, len(words) - PHRASE_LENGTH):
      yield (":".join(words[i:i+PHRASE_LENGTH]), filename)
91689
protected function addFluentIndexes()
	{
		foreach ( $this->columns as $column )
		{
			foreach ( ['primary', 'unique', 'index'] as $index )
			{
				// If the index has been specified on the given column, but is simply
				// equal to "true" (boolean), no name has been specified for this
				// index, so we will simply call the index methods without one.
				if ( $column->$index === true )
				{
					$this->$index( $column->name );

					continue 2;
				}

				// If the index has been specified on the column and it is something
				// other than boolean true, we will assume a name was provided on
				// the index specification, and pass in the name to the method.
				elseif ( isset( $column->$index ) )
				{
					$this->$index( $column->name, $column->$index );

					continue 2;
				}
			}
		}
	}
1230609
public function init($words = array())
    {
        if ($words)
        {
            $this->words = array();
            foreach ($words as $word) {
                $this->words[$this->prepare_word($word)] = $word;
            }
        }
        foreach ($this->words as $word)
        {
            $word = $this->prepare_word($word);
            $parts = $this->get_parts($word);

            $this->wordInfo[$word] = array("word" => $word, "num_parts" => count($parts));

            foreach ($parts as $part)
            {
                $size = mb_strlen($part);
                $skey = $size;
                if (!isset($this->wordParts[$skey]))
                {
                    $this->wordParts[$skey] = array();
                }
                if (!isset($this->wordParts[$skey][$part]))
                {
                    $this->wordParts[$skey][$part] = array("words" => array());
                }
                $this->wordParts[$skey][$part]["words"][$word] = $word;
            }
        }
        $this->isInitialized = true;
    }
972803
public void localize(final String[] longNames, final String[] shortNames) {
        assert longNames != null && longNames.length == 12;
        assert shortNames != null && shortNames.length == 12;
        final JsArrayString longOnes = (JsArrayString) JsArrayString.createArray();
        for (final String name : longNames) {
            longOnes.push(name);
        }

        final JsArrayString shortOnes = (JsArrayString) JsArrayString.createArray();
        for (final String name : shortNames) {
            shortOnes.push(name);
        }
        localize(longOnes, shortOnes);
    }
1191311
public static void replaceWords(StringBuilder input, String[] words, String[] replaces) {
        replaceWords(input, words, replaces, false);
    }
590062
public void setStatements(List<AstNode> statements) {
        if (this.statements != null) {
            this.statements.clear();
        }
        for (AstNode s : statements) {
            addStatement(s);
        }
    }
946354
public void setRows(int rows)
    {
        if (rows < 0)
        {
            throw new IllegalArgumentException("rows: " + rows);
        }
        getStateHelper().put(PropertyKeys.rows, rows ); 
    }
612597
public void setLocales(Locale... locales) {

    String[] array = new String[locales.length];
    for (int i = 0; i < locales.length; i++) {
      array[i] = locales[i].toString();
    }
    setLocales(array);
  }
1035839
public void applyIndexes(VocabCache<? extends SequenceElement> cache) {
        if (!buildTrigger)
            build();

        for (int a = 0; a < words.size(); a++) {
            if (words.get(a).getLabel() != null) {
                cache.addWordToIndex(a, words.get(a).getLabel());
            } else {
                cache.addWordToIndex(a, words.get(a).getStorageId());
            }

            words.get(a).setIndex(a);
        }
    }
163520
protected void addContextTerms(SparseDoubleVector meaning,
                                   Queue<String> words,
                                   int distance) {
        // Iterate through each of the context words.
        for (String term : words) {
            if (!term.equals(IteratorFactory.EMPTY_TOKEN)) {
                // Ignore any features that have no valid dimension.
                int dimension = basis.getDimension(term);
                if (dimension == -1)
                    continue;

                // Add the feature to the context vector and increase the
                // distance from the focus word.
                meaning.set(dimension, weighting.weight(distance, windowSize));
                ++distance;
            }
        }
    }
82170
public function actionManage($phrase=null) 
	{
		$model=new Message('search');
		$model->unsetAttributes();	// clear any default values
		if(isset($_GET['Message'])) {
			$model->attributes=$_GET['Message'];
		}

		$columns = $model->getGridColumn($this->gridColumnTemp());

		$pageTitle = Yii::t('phrase', 'Translates');
		if($phrase != null) {
			$data = SourceMessage::model()->findByPk($phrase);
			$pageTitle = Yii::t('phrase', 'Translates: {phrase}', array ('{phrase}'=>$data->message));
		}
		
		$this->pageTitle = $pageTitle;
		$this->pageDescription = '';
		$this->pageMeta = '';
		$this->render('admin_manage', array(
			'model'=>$model,
			'columns' => $columns,
		));
	}
294555
public void setCaptionLanguageMappings(java.util.Collection<HlsCaptionLanguageMapping> captionLanguageMappings) {
        if (captionLanguageMappings == null) {
            this.captionLanguageMappings = null;
            return;
        }

        this.captionLanguageMappings = new java.util.ArrayList<HlsCaptionLanguageMapping>(captionLanguageMappings);
    }
1197959
public function setPhrase($phrase) {
		if(!$this->setModified('phrase', $phrase)->isModified()) {
			return $this;
		}
		$this->phrase = $phrase;
		return $this;
	}