1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ENCODINGS_COMPACT_LANG_DET_CLDUTIL_DBG_H_
6 #define ENCODINGS_COMPACT_LANG_DET_CLDUTIL_DBG_H_
8 #include "encodings/compact_lang_det/cldutil.h"
10 #include "encodings/compact_lang_det/ext_lang_enc.h"
11 #include "encodings/compact_lang_det/tote.h"
12 #include "encodings/compact_lang_det/win/cld_basictypes.h"
13 #include "encodings/compact_lang_det/win/cld_commandlineflags.h"
15 DECLARE_bool(dbgscore
);
16 DECLARE_bool(dbglookup
);
17 DECLARE_bool(dbgreli
);
24 //------------------------------------------------------------------------------
25 // Debugging. Not thread safe
26 //------------------------------------------------------------------------------
28 void DbgScoreInit(const char* src
, int len
);
30 // Return a 3-byte + NUL code for language
31 void DbgLangName3(Language lang
, char* temp
);
33 // Show all per-language totals
36 void DbgScoreTop(const char* src
, int srclen
, Tote
* chunk_tote
);
40 // Allow additional scoring debug output
41 void DbgScoreRecord(const char* src
, uint32 probs
, int len
);
43 void DbgScoreRecordUni(const char* src
, int propval
, int len
);
45 // Debug print language name(s)
46 void PrintLang(FILE* f
, const Tote
* chunk_tote
,
47 const Language cur_lang
, const bool cur_unreliable
,
48 Language prior_lang
, bool prior_unreliable
);
50 // Debug print language name(s)
51 void PrintLang2(FILE* f
,
52 const Language lang1
, const Language lang2
, bool diff_prior
);
54 // Debug print text span
55 void PrintText(FILE* f
, Language cur_lang
, const string
& str
);
57 // Debug print text span with speculative language
58 void PrintTextSpeculative(FILE* f
, Language cur_lang
, const string
& str
);
60 // Debug print ignored text span
61 void PrintSkippedText(FILE* f
, const string
& str
);
63 void DbgProbsToStderr(uint32 probs
);
64 void DbgUniTermToStderr(int propval
, const uint8
* usrc
, int len
);
66 void DbgBiTermToStderr(uint32 bihash
, uint32 probs
,
67 const char* src
, int len
);
68 void DbgQuadTermToStderr(uint32 quadhash
, uint32 probs
,
69 const char* src
, int len
);
70 void DbgWordTermToStderr(uint64 wordhash
, uint32 probs
,
71 const char* src
, int len
);
73 } // End namespace cld
76 #endif // ENCODINGS_COMPACT_LANG_DET_CLDUTIL_DBG_H_