Skip to content

Commit

Permalink
beautification - tabs to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
vinvinod committed Jan 24, 2017
1 parent cf6f24e commit aff1b07
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 37 deletions.
23 changes: 12 additions & 11 deletions mitielib/include/mitie.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ extern "C"
!*/
typedef struct mitie_total_word_feature_extractor mitie_total_word_feature_extractor;
MITIE_EXPORT mitie_named_entity_extractor* mitie_load_named_entity_extractor_pure_model_without_feature_extractor (
const char* filename
const char* filename
);
/*!
Added for Rasa_nlu multitenancy
Expand Down Expand Up @@ -209,9 +209,9 @@ extern "C"
!*/

MITIE_EXPORT mitie_named_entity_detections* mitie_extract_entities_with_extractor(
const mitie_named_entity_extractor* ner,
char** tokens,
const mitie_total_word_feature_extractor* fe_
const mitie_named_entity_extractor* ner,
char** tokens,
const mitie_total_word_feature_extractor* fe_
);

MITIE_EXPORT unsigned long mitie_ner_get_num_detections (
Expand Down Expand Up @@ -451,7 +451,8 @@ extern "C"
!*/

MITIE_EXPORT mitie_text_categorizer* mitie_load_text_categorizer_pure_model_without_feature_extractor(
const char* filename);
const char* filename
);
/*!
Added for Rasa_nlu multitenancy
!*/
Expand Down Expand Up @@ -484,12 +485,12 @@ extern "C"
!*/

MITIE_EXPORT int mitie_categorize_text_with_extractor (
const mitie_text_categorizer* tcat,
const char** tokens,
char** text_tag,
double* text_score,
const mitie_total_word_feature_extractor* fe_
);
const mitie_text_categorizer* tcat,
const char** tokens,
char** text_tag,
double* text_score,
const mitie_total_word_feature_extractor* fe_
);

// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
Expand Down
48 changes: 24 additions & 24 deletions mitielib/src/mitie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,39 +989,39 @@ extern "C"
double* text_score,
const mitie_total_word_feature_extractor* fe_
)
{
try
{
assert(text_tag);
assert(text_score);
{
try
{
assert(text_tag);
assert(text_score);

string tag;
double score;
std::vector<std::string> words;
string tag;
double score;
std::vector<std::string> words;

while(*tokens)
while(*tokens)
words.push_back(*tokens++);

total_word_feature_extractor* fe_temp = (total_word_feature_extractor *) fe_;
checked_cast<text_categorizer>(tcat_).predict(words,tag,score, *fe_temp);
total_word_feature_extractor* fe_temp = (total_word_feature_extractor *) fe_;
checked_cast<text_categorizer>(tcat_).predict(words,tag,score, *fe_temp);

char * writable = (char*)allocate_bytes(tag.size()+1);
std::copy(tag.begin(), tag.end(), writable);
writable[tag.size()] = '\0';
char * writable = (char*)allocate_bytes(tag.size()+1);
std::copy(tag.begin(), tag.end(), writable);
writable[tag.size()] = '\0';

*text_tag = writable;
*text_score = score;
*text_tag = writable;
*text_score = score;

return 0;
}
catch (...)
{
return 0;
}
catch (...)
{
#ifndef NDEBUG
cerr << "Error categorizing text: " << endl;
cerr << "Error categorizing text: " << endl;
#endif
return 1;
}
}
return 1;
}
}

// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions mitielib/src/named_entity_extractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ namespace mitie
named_entity_extractor::
named_entity_extractor(const std::string& pureModelName,
const std::string& extractorName
) {
)
{
std::string classname;
dlib::deserialize(pureModelName) >> classname;
if (classname != "mitie::named_entity_extractor_pure_model")
Expand All @@ -53,7 +54,8 @@ namespace mitie

named_entity_extractor::
named_entity_extractor(const std::string& pureModelName
) {
)
{
std::string classname;
dlib::deserialize(pureModelName) >> classname;
if (classname != "mitie::named_entity_extractor_pure_model")
Expand Down

0 comments on commit aff1b07

Please sign in to comment.