int unk_replace_probability(Index word_idx)
 {
     if (word_idx == UNK) return UNK; // UNK is not in freq_records
     assert(static_cast<unsigned>(word_idx) < freq_records.size());
     if (freq_records[word_idx] <= freq_threshold && prob_rand() <= prob_threshold) return UNK;
     return word_idx;
 }
예제 #2
0
파일: dlist.c 프로젝트: triplekill/orchids
int
rand_range(int min, int max)
{
  return ( (int) (prob_rand() * (double)(max - min) + (double)min) );
}