Home | History | Annotate | Download | only in compact_lang_det
      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.
      4 
      5 #ifndef ENCODINGS_COMPACT_LANG_DET_CLDUTIL_DBG_H_
      6 #define ENCODINGS_COMPACT_LANG_DET_CLDUTIL_DBG_H_
      7 
      8 #include "encodings/compact_lang_det/cldutil.h"
      9 #include <string>
     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"
     14 
     15 DECLARE_bool(dbgscore);
     16 DECLARE_bool(dbglookup);
     17 DECLARE_bool(dbgreli);
     18 
     19 using std::string;
     20 
     21 namespace cld {
     22 
     23 
     24 //------------------------------------------------------------------------------
     25 // Debugging. Not thread safe
     26 //------------------------------------------------------------------------------
     27 
     28   void DbgScoreInit(const char* src, int len);
     29 
     30   // Return a 3-byte + NUL code for language
     31   void DbgLangName3(Language lang, char* temp);
     32 
     33   // Show all per-language totals
     34   void DbgScoreState();
     35 
     36   void DbgScoreTop(const char* src, int srclen, Tote* chunk_tote);
     37 
     38   void DbgScoreFlush();
     39 
     40   // Allow additional scoring debug output
     41   void DbgScoreRecord(const char* src, uint32 probs, int len);
     42 
     43   void DbgScoreRecordUni(const char* src, int propval, int len);
     44 
     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);
     49 
     50   // Debug print language name(s)
     51   void PrintLang2(FILE* f,
     52                   const Language lang1, const Language lang2, bool diff_prior);
     53 
     54   // Debug print text span
     55   void PrintText(FILE* f, Language cur_lang, const string& str);
     56 
     57   // Debug print text span with speculative language
     58   void PrintTextSpeculative(FILE* f, Language cur_lang, const string& str);
     59 
     60   // Debug print ignored text span
     61   void PrintSkippedText(FILE* f, const string& str);
     62 
     63   void DbgProbsToStderr(uint32 probs);
     64   void DbgUniTermToStderr(int propval, const uint8* usrc, int len);
     65   // No pre/post space
     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);
     72 
     73 }       // End namespace cld
     74 
     75 
     76 #endif  // ENCODINGS_COMPACT_LANG_DET_CLDUTIL_DBG_H_
     77