Skip to content

Commit

Permalink
code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed May 2, 2024
1 parent a19c10a commit dd299b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions include/mbt/Tagger.h
Expand Up @@ -65,7 +65,7 @@ namespace Tagger {
public:
BeamData();
~BeamData();
bool Init( int, unsigned int );
void Init( int, unsigned int );
void InitPaths( Hash::UnicodeHash&,
const Timbl::TargetValue *,
const Timbl::ClassDistribution * );
Expand Down Expand Up @@ -96,7 +96,7 @@ namespace Tagger {
~TaggerClass();
bool InitTagging();
bool InitLearning();
bool InitBeaming( unsigned int );
void InitBeaming( unsigned int );
TaggerClass *clone() const;
int Run( );
std::vector<TagResult> tagLine( const icu::UnicodeString& );
Expand Down
2 changes: 1 addition & 1 deletion src/GenerateTagger.cxx
Expand Up @@ -119,7 +119,7 @@ namespace Tagger {
out_file.good() ) ){
COUT << " Creating lexicon: " << LexFileName << " of "
<< TagVect.size() << " entries." << endl;
for ( auto const& tv : TagVect ){
for ( auto const *tv : TagVect ){
out_file << tv->Freq() << " " << tv->Word
<< " " << tv->DisplayTagFreqs() << endl;
}
Expand Down
15 changes: 7 additions & 8 deletions src/RunTagger.cxx
Expand Up @@ -72,7 +72,7 @@ namespace Tagger {
BeamData::~BeamData(){
}

bool BeamData::Init( int Size, unsigned int noWords ){
void BeamData::Init( int Size, unsigned int noWords ){
// Beaming Stuff...
if ( path_prob.size() == 0 ){
// the first time
Expand All @@ -86,7 +86,6 @@ namespace Tagger {
temppaths[q].resize(noWords,0);
}
size = Size;
return true;
}

void BeamData::ClearBest(){
Expand Down Expand Up @@ -311,11 +310,11 @@ namespace Tagger {
}
}

bool TaggerClass::InitBeaming( unsigned int no_words ){
void TaggerClass::InitBeaming( unsigned int no_words ){
if ( !Beam ){
Beam = new BeamData();
}
return Beam->Init( Beam_Size, no_words );
Beam->Init( Beam_Size, no_words );
}

int TaggerClass::ProcessLines( istream &is, ostream& os ){
Expand Down Expand Up @@ -780,11 +779,11 @@ namespace Tagger {

vector<TagResult> TaggerClass::tagSentence( sentence& mySentence ){
vector<TagResult> result;
if ( !initialized ){
throw runtime_error( "Tagger not initialized" );
}
if ( mySentence.size() != 0 ){
if ( !initialized ||
!InitBeaming( mySentence.size() ) ){
throw runtime_error( "Tagger not initialized" );
}
InitBeaming( mySentence.size() );
DBG << mySentence << endl;
if ( mySentence.init_windowing( *MT_lexicon, TheLex ) ) {
// here the word window is looked up in the dictionary and the values
Expand Down
6 changes: 4 additions & 2 deletions src/TagLex.cxx
Expand Up @@ -45,7 +45,9 @@ namespace Tagger {

TagInfo::TagInfo( const UnicodeString& word,
const UnicodeString& tag ):
Word(word), WordFreq(0) {
Word(word),
WordFreq(0)
{
Update( tag );
}

Expand Down Expand Up @@ -143,7 +145,7 @@ namespace Tagger {
}

void StoreInVector( TagInfo *TI, void *arg ){
vector<TagInfo*> *vec = (vector<TagInfo*> *)arg;
vector<TagInfo*> *vec = static_cast<vector<TagInfo*>*>(arg);
vec->push_back( TI );
}

Expand Down

0 comments on commit dd299b1

Please sign in to comment.