Kaydet (Commit) 1ea8f156 authored tarafından Michael Jaumann's avatar Michael Jaumann Kaydeden (comit) Chris Sherlock

fdo#39468 tranlation German to English

Change-Id: Icafab1c345a3a5291e4b19821710f439a1c70048
Reviewed-on: https://gerrit.libreoffice.org/11338Reviewed-by: 's avatarChris Sherlock <chris.sherlock79@gmail.com>
Tested-by: 's avatarChris Sherlock <chris.sherlock79@gmail.com>
üst 0eaeb927
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
#endif #endif
#define LEVDISBIG (nLimit + 1) // Return value if distance > nLimit #define LEVDISBIG (nLimit + 1) // Return value if distance > nLimit
#define LEVDISDOUBLEBUF 2048 // dadrueber wird nicht mehr gedoppelt #define LEVDISDOUBLEBUF 2048 // no doubling atop this border
static sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr ) static sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr )
{ {
...@@ -84,19 +84,18 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -84,19 +84,18 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
int nSPMin = 0; // penalty point Minimum int nSPMin = 0; // penalty point Minimum
int nRepS = 0; // for SplitCount int nRepS = 0; // for SplitCount
// Laengendifferenz von Pattern und String // length difference between pattern and string
int nLenDiff = nPatternLen - nStars - nStringLen; int nLenDiff = nPatternLen - nStars - nStringLen;
// mehr Einfuegungen oder Loeschungen noetig als Limit? => raus hier // more insertions or deletions necessary as the limit? Then leave
if ( (nLenDiff * nInsQ0 > nLimit) if ( (nLenDiff * nInsQ0 > nLimit)
|| ((nStars == 0) && (nLenDiff * nDelR0 < -nLimit)) ) || ((nStars == 0) && (nLenDiff * nDelR0 < -nLimit)) )
return(LEVDISBIG); return(LEVDISBIG);
// wenn der zu vergleichende String groesser ist als das bisherige Array // comparative String greater than instantaneous array
// muss dieses angepasst werden // -> adapt array size
if ( nStringLen >= nArrayLen ) if ( nStringLen >= nArrayLen )
{ {
// gib ihm moeglichst mehr, damit nicht gleich naechstesmal // increase size much more to avoid reallocation
// wieder realloziert werden muss
if ( nStringLen < LEVDISDOUBLEBUF ) if ( nStringLen < LEVDISDOUBLEBUF )
nArrayLen = 2 * nStringLen; nArrayLen = 2 * nStringLen;
else else
...@@ -104,18 +103,18 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -104,18 +103,18 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
npDistance = aDisMem.NewMem( nArrayLen ); npDistance = aDisMem.NewMem( nArrayLen );
} }
// Anfangswerte der zweiten Spalte (erstes Pattern-Zeichen) berechnen // calculate start values of the second column(first Pattern-value)
// die erste Spalte (0-Len Pattern) ist immer 0 .. nStringLen * nInsQ0, // first column (0-Len Pattern) is always zero .. nStringLen * nInsQ0,
// deren Minimum also 0 // therefore the minimum is 0
if ( nPatternLen == 0 ) if ( nPatternLen == 0 )
{ {
// Anzahl der Loeschungen, um auf Pattern zu kommen // Count of deletions, to determine the Pattern
for ( sal_Int32 i=0; i <= nStringLen; i++ ) for ( sal_Int32 i=0; i <= nStringLen; i++ )
npDistance[i] = i * nDelR0; npDistance[i] = i * nDelR0;
} }
else if ( cpPattern[0] == '*' && bpPatIsWild[0] ) else if ( cpPattern[0] == '*' && bpPatIsWild[0] )
{ {
// statt einem '*' ist alles einsetzbar // instead of a '*' you can fit in anything
for ( sal_Int32 i=0; i <= nStringLen; i++ ) for ( sal_Int32 i=0; i <= nStringLen; i++ )
npDistance[i] = 0; npDistance[i] = 0;
} }
...@@ -125,11 +124,11 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -125,11 +124,11 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
int nP; int nP;
c = cpPattern[0]; c = cpPattern[0];
if ( c == '?' && bpPatIsWild[0] ) if ( c == '?' && bpPatIsWild[0] )
nP = 0; // ein '?' kann jedes Zeichen sein nP = 0; // a '?' could be any character.
else else
// Minimum von Ersetzen und Loeschen+Einfuegen Gewichtung // Minimum replace and delete +insert weighting
nP = Min3( nRepP0, nRepP0, nDelR0 + nInsQ0 ); nP = Min3( nRepP0, nRepP0, nDelR0 + nInsQ0 );
npDistance[0] = nInsQ0; // mit einfachem Einfuegen geht's los npDistance[0] = nInsQ0; // start with simple insert
npDistance[1] = nInsQ0; npDistance[1] = nInsQ0;
npDistance[2] = nInsQ0; npDistance[2] = nInsQ0;
int nReplacePos = -1; // tristate flag int nReplacePos = -1; // tristate flag
...@@ -137,22 +136,22 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -137,22 +136,22 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
for ( sal_Int32 i=1; i <= nStringLen; i++, nDelCnt += nDelR0 ) for ( sal_Int32 i=1; i <= nStringLen; i++, nDelCnt += nDelR0 )
{ {
if ( cString[i-1] == c ) if ( cString[i-1] == c )
nP = 0; // Replace ab dieser Stelle ist 0 nP = 0; // Replace from this postion with 0
// Loeschungen um auf Pattern zu kommen + Replace // Deletion to determine the Pattern + Replace
npDistance[i] = nDelCnt + nP; npDistance[i] = nDelCnt + nP;
if ( bSplitCount ) if ( bSplitCount )
{ {
if ( nReplacePos < 0 && nP ) if ( nReplacePos < 0 && nP )
{ // diese Stelle wird ersetzt { // this Postion will be replaced
nRepS++; nRepS++;
nReplacePos = i; nReplacePos = i;
} }
else if ( nReplacePos > 0 && !nP ) else if ( nReplacePos > 0 && !nP )
{ {
// gleiche Anzahl c // same count c
int nBalance = levdisbalance( 0, i-1, c, cString, nStringLen ); int nBalance = levdisbalance( 0, i-1, c, cString, nStringLen );
if ( !nBalance ) if ( !nBalance )
{ // einer wurde ersetzt, der ein Insert war { // an insert was replaced
nRepS--; nRepS--;
nReplacePos = 0; nReplacePos = 0;
} }
...@@ -162,8 +161,8 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -162,8 +161,8 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
nSPMin = Min3( npDistance[0], npDistance[1], npDistance[2] ); nSPMin = Min3( npDistance[0], npDistance[1], npDistance[2] );
} }
// Distanzmatrix berechnen // calculate distance matrix
sal_Int32 j = 0; // fuer alle Spalten des Pattern, solange nicht Limit sal_Int32 j = 0; //for all columns of the pattern, till limit is not reached
while ( (j < nPatternLen-1) while ( (j < nPatternLen-1)
&& nSPMin <= (bSplitCount ? 2 * nLimit : nLimit) ) && nSPMin <= (bSplitCount ? 2 * nLimit : nLimit) )
{ {
...@@ -172,26 +171,26 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -172,26 +171,26 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
j++; j++;
c = cpPattern[j]; c = cpPattern[j];
if ( bpPatIsWild[j] ) // '*' oder '?' nicht escaped if ( bpPatIsWild[j] ) // '*' or '?' not escaped
nP = 0; // kann ohne Strafpunkte ersetzt werden nP = 0; // could be replaced without penalty
else else
nP = nRepP0; nP = nRepP0;
if ( c == '*' && bpPatIsWild[j] ) if ( c == '*' && bpPatIsWild[j] )
{ {
nQ = 0; // Einfuegen und Loeschen ohne Strafpunkte nQ = 0; // instertion/deletion without penalty
nR = 0; nR = 0;
} }
else else
{ {
nQ = nInsQ0; // normale Gewichtung nQ = nInsQ0; //usual weighting
nR = nDelR0; nR = nDelR0;
} }
d2 = npDistance[0]; d2 = npDistance[0];
// Anzahl Einfuegungen um von Null-String auf Pattern zu kommen erhoehen // increase insert count to get from null sting to pattern
npDistance[0] = npDistance[0] + nQ; npDistance[0] = npDistance[0] + nQ;
nSPMin = npDistance[0]; nSPMin = npDistance[0];
int nReplacePos = -1; // tristate Flag int nReplacePos = -1; // tristate Flag
// fuer jede Patternspalte den String durchgehen // for each pattern column run though the string
for ( sal_Int32 i=1; i <= nStringLen; i++ ) for ( sal_Int32 i=1; i <= nStringLen; i++ )
{ {
d1 = d2; // WLD( X(i-1), Y(j-1) ) d1 = d2; // WLD( X(i-1), Y(j-1) )
...@@ -204,7 +203,7 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -204,7 +203,7 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
// same quantity c // same quantity c
int nBalance = levdisbalance( j, i-1, c, cString, nStringLen ); int nBalance = levdisbalance( j, i-1, c, cString, nStringLen );
if ( !nBalance ) if ( !nBalance )
nReplacePos = 0; // keine Ersetzung mehr nReplacePos = 0; // no replacement
} }
} }
else else
...@@ -223,17 +222,21 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) ...@@ -223,17 +222,21 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen )
nReplacePos = i; nReplacePos = i;
} }
else if ( nReplacePos > 0 && !nPij ) else if ( nReplacePos > 0 && !nPij )
{ // Zeichen in String und Pattern gleich. {
// wenn ab hier die gleiche Anzahl dieses Zeichens // character is equal in string and pattern
// sowohl in Pattern als auch in String ist, und vor //
// dieser Stelle das Zeichen gleich oft vorkommt, war das //If from this point:
// Replace keins. Buchstabendreher werden hier erfasst //* pattern and string have the same count of this character
// und der ReplaceS zurueckgenommen, wodurch das doppelte //* and character count is the same before this position
// Limit zum Tragen kommt. //the replace was none.
// same quantity c //
//Scrambled letters are recognized and the replace is withdrawed.
//Whereby the double limit comes to fuition.
//
//Same quantity c
int nBalance = levdisbalance( j, i-1, c, cString, nStringLen ); int nBalance = levdisbalance( j, i-1, c, cString, nStringLen );
if ( !nBalance ) if ( !nBalance )
{ // einer wurde ersetzt, der ein Insert war { // insert was replaced
nRepS--; nRepS--;
nReplacePos = 0; nReplacePos = 0;
} }
...@@ -284,8 +287,8 @@ int WLevDistance::CalcLPQR( int nX, int nY, int nZ, bool bRelaxed ) ...@@ -284,8 +287,8 @@ int WLevDistance::CalcLPQR( int nX, int nY, int nZ, bool bRelaxed )
return( nLimit ); return( nLimit );
} }
// Groesster Gemeinsamer Teiler nach Euklid (Kettendivision) // greatest common divisior according to Euklid (chaindivision)
// Sonderfall: 0 und irgendwas geben 1 // special case: 0 plus anything produces 1
int WLevDistance::GGT( int a, int b ) int WLevDistance::GGT( int a, int b )
{ {
if ( !a || !b ) if ( !a || !b )
...@@ -302,10 +305,10 @@ int WLevDistance::GGT( int a, int b ) ...@@ -302,10 +305,10 @@ int WLevDistance::GGT( int a, int b )
return( a ? a : b); return( a ? a : b);
} }
// Kleinstes Gemeinsames Vielfaches: a * b / GGT(a,b) // least common multiple : a * b / GGT(a,b)
int WLevDistance::KGV( int a, int b ) int WLevDistance::KGV( int a, int b )
{ {
if ( a > b ) // Ueberlauf unwahrscheinlicher machen if ( a > b ) // decrease owerflow chance
return( (a / GGT(a,b)) * b ); return( (a / GGT(a,b)) * b );
else else
return( (b / GGT(a,b)) * a ); return( (b / GGT(a,b)) * a );
...@@ -341,7 +344,7 @@ int WLevDistance::Max3( int x, int y, int z ) ...@@ -341,7 +344,7 @@ int WLevDistance::Max3( int x, int y, int z )
return( y > z ? y : z ); return( y > z ? y : z );
} }
// Daten aus CTor initialisieren // initialize data from CTOR
void WLevDistance::InitData( const sal_Unicode* cPattern ) void WLevDistance::InitData( const sal_Unicode* cPattern )
{ {
cpPattern = aPatMem.GetcPtr(); cpPattern = aPatMem.GetcPtr();
...@@ -366,7 +369,7 @@ void WLevDistance::InitData( const sal_Unicode* cPattern ) ...@@ -366,7 +369,7 @@ void WLevDistance::InitData( const sal_Unicode* cPattern )
else if ( *cp1 == '*' || *cp1 == '?' ) // Joker else if ( *cp1 == '*' || *cp1 == '?' ) // Joker
{ {
if ( *cp1 == '*' ) if ( *cp1 == '*' )
nStars++; // Sternchenzaehler erhoehen nStars++;
*bp++ = true; *bp++ = true;
} }
else else
......
...@@ -132,8 +132,8 @@ class WLevDistance ...@@ -132,8 +132,8 @@ class WLevDistance
inline int Min3( int x, int y, int z ); // inline wegen Schleife inline int Min3( int x, int y, int z ); // inline wegen Schleife
int Mid3( int x, int y, int z ); int Mid3( int x, int y, int z );
int Max3( int x, int y, int z ); int Max3( int x, int y, int z );
int GGT( int a, int b ); // Groesster Gemeinsamer Teiler int GGT( int a, int b ); // Groesster Gemeinsamer Teiler
int KGV( int a, int b ); // Kleinstes Gemeinsames Vielfaches int KGV( int a, int b ); // Kleinstes Gemeinsames Vielfaches
public: public:
// CToren mit Userangaben, danach mit GetLimit() Limit holen // CToren mit Userangaben, danach mit GetLimit() Limit holen
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment