Skip to content

Commit 7dca5c7

Browse files
committed
cleaning up, adapted apit-test
1 parent 50f57a1 commit 7dca5c7

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

demos/api_test5.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int main(){
3737
"test5" );
3838
My_Experiment->Learn( "dimin.train" );
3939
{
40-
string line = "=,=,=,=,+,k,e,=,-,r,@,l,T";
40+
icu::UnicodeString line = "=,=,=,=,+,k,e,=,-,r,@,l,T";
4141
const neighborSet *neighbours1 = My_Experiment->classifyNS( line );
4242
if ( neighbours1 ){
4343
cout << "Classify OK on " << line << endl;

include/timbl/TimblAPI.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@ namespace Timbl{
9797
const TargetValue *Classify( const icu::UnicodeString&,
9898
const ValueDistribution *&,
9999
double& );
100-
const neighborSet *classifyNS( const std::string& );
101-
bool classifyNS( const std::string&,
100+
const neighborSet *classifyNS( const icu::UnicodeString& );
101+
bool classifyNS( const icu::UnicodeString&,
102102
neighborSet& );
103+
bool classifyNS( const std::string& in,
104+
neighborSet& st ){
105+
return classifyNS( TiCC::UnicodeFromUTF8(in), st );
106+
}
103107
const Instance *lastHandledInstance() const;
104108
const Target *myTargets() const;
105109
bool Classify( const std::string&,

include/timbl/TimblExperiment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ namespace Timbl {
233233
return classifyString( Line, di );
234234
}
235235

236-
const neighborSet *NB_Classify( const std::string& );
236+
const neighborSet *NB_Classify( const icu::UnicodeString& );
237237

238238
virtual void initExperiment( bool = false );
239239

src/TimblAPI.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,15 +480,16 @@ namespace Timbl {
480480
return NULL;
481481
}
482482

483-
const neighborSet *TimblAPI::classifyNS( const string& s ){
483+
const neighborSet *TimblAPI::classifyNS( const icu::UnicodeString& s ){
484484
const neighborSet *ns = 0;
485485
if ( Valid() ){
486486
ns = pimpl->NB_Classify( s );
487487
}
488488
return ns;
489489
}
490490

491-
bool TimblAPI::classifyNS( const string& s, neighborSet& ns ){
491+
bool TimblAPI::classifyNS( const icu::UnicodeString& s,
492+
neighborSet& ns ){
492493
const neighborSet *b = classifyNS( s );
493494
if ( b != 0 ){
494495
ns = *b;

src/TimblExperiment.cxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,11 +1737,10 @@ namespace Timbl {
17371737
return BestT;
17381738
}
17391739

1740-
const neighborSet *TimblExperiment::NB_Classify( const string& _line ){
1740+
const neighborSet *TimblExperiment::NB_Classify( const UnicodeString& line ){
17411741
initExperiment();
1742-
UnicodeString Line = TiCC::UnicodeFromUTF8(_line);
1743-
if ( checkLine( Line ) &&
1744-
chopLine( Line ) ){
1742+
if ( checkLine( line ) &&
1743+
chopLine( line ) ){
17451744
chopped_to_instance( TestWords );
17461745
return LocalClassify( CurrInst );
17471746
}

0 commit comments

Comments
 (0)