/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#include "vcwhdr.h"
/* Functions to compute n-gram frequencies, etc.
**
** Written by Kiem-Phong Vo (kpv@research.att.com)
*/
/* compute n-gram frequencies */
#if __STD_C
#else
#endif
{
for(n = 0; n < NG_FREQ; ++n)
freq[n] = 0;
return 0;
if(n >= size)
return 0;
}
}
/* compute the position in "data" whose frequency vector sfreq
** is closest to the frequency vector dfreq.
*/
#if __STD_C
#else
int* mtch; /* to return the best match */
double stop; /* stop search criterion */
#endif
{
double bestd;
return 1.;
/* initial frequency vector */
for(r = 0; r < NG_FREQ; ++r)
}
else
}
}
goto done;
/* starting boundaries of data */
{ for(l = 0; l < NG_FREQ; ++l)
}
}
if(l != r)
ldif += 1;
else ldif -= 1;
goto done;
}
}
}
if(l != r)
rdif += 1;
else rdif -= 1;
goto done;
}
}
}
}
return bestd;
}
/* The signature of a segment of data is the sum of all its n-grams.
Thus, each 1K (2^10) segment has a maximum signature of size 2^25.
*/
#if __STD_C
#else
size_t n;
#endif
{
}
return sig;
}