Skip to content

Commit 354110a

Browse files
committed
numb improvements
1 parent e004d77 commit 354110a

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/Features.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ namespace Timbl {
272272
void Feature::NumStatistics( vector<FeatureValue *>& FVBin,
273273
double DBentropy ){
274274
size_t BinSize = FVBin.size();
275-
double Prob, FVEntropy;
276275
size_t TotalVals = TotalValues();
277276
entropy = 0.0;
278277
vector<D_D*> ddv;
@@ -311,9 +310,9 @@ namespace Timbl {
311310
if ( Freq > 0 ){
312311
// Entropy for this FV pair.
313312
//
314-
FVEntropy = 0.0;
313+
auto FVEntropy = 0.0;
315314
for ( const auto& it : pnt->TargetDist ){
316-
Prob = it.second->Freq()/(double)Freq;
315+
auto Prob = it.second->Freq()/(double)Freq;
317316
FVEntropy += Prob * Log2(Prob);
318317
}
319318
entropy += -FVEntropy * Freq / (double)TotalVals;
@@ -330,7 +329,7 @@ namespace Timbl {
330329
for ( size_t l=0; l < BinSize; ++l ){
331330
size_t Freq = FVBin[l]->ValFreq();
332331
if ( Freq > 0 ){
333-
Prob = Freq / (double)TotalVals;
332+
auto Prob = Freq / (double)TotalVals;
334333
split_info += Prob * Log2(Prob);
335334
}
336335
}

src/GetOptClass.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ namespace Timbl {
446446
inline bool GetOptClass::parse_range( string& line,
447447
string::iterator& it,
448448
MetricType Value ){
449-
size_t m;
450449
while( it != line.end() && *it != ':' ){
451450
auto eit = it;
452451
while( eit != line.end() && isdigit( *eit ) ) ++eit;
@@ -476,7 +475,7 @@ namespace Timbl {
476475
eit = it;
477476
while( eit != line.end() && isdigit( *eit ) ) ++eit;
478477
tmp = string( it, eit );
479-
m = TiCC::stringTo<int>(tmp);
478+
size_t m = TiCC::stringTo<int>(tmp);
480479
if ( m == 0 || m > metricsArray.size() ){
481480
Error( "illegal value in metric description: -m " + line );
482481
return false;

src/IBtree.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -962,12 +962,11 @@ namespace Timbl {
962962
unsigned long& cnt ){
963963
// remove branches with the same target as the Top, except when they
964964
// still have a subbranch, which means that they are an exception.
965-
IBtree **tmp, *dead, *result;
966-
result = this;
967-
tmp = &result;
965+
IBtree *result = this;
966+
IBtree **tmp = &result;
968967
while ( *tmp ){
969968
if ( (*tmp)->TValue == Top && (*tmp)->link == NULL ){
970-
dead = *tmp;
969+
IBtree *dead = *tmp;
971970
*tmp = (*tmp)->next;
972971
dead->next=NULL;
973972
--cnt;

0 commit comments

Comments
 (0)