Exposes language classification functions
This commit is contained in:
@@ -3,9 +3,11 @@ libpostal_get_default_options
|
||||
libpostal_expand_address
|
||||
libpostal_expansion_array_destroy
|
||||
libpostal_address_parser_response_destroy
|
||||
libpostal_language_classifier_response_destroy
|
||||
libpostal_get_address_parser_default_options
|
||||
libpostal_parse_address
|
||||
libpostal_parser_print_features
|
||||
libpostal_classify_language
|
||||
libpostal_setup
|
||||
libpostal_setup_datadir
|
||||
libpostal_teardown
|
||||
|
||||
@@ -202,6 +202,30 @@ libpostal_fuzzy_duplicate_status_t libpostal_is_street_duplicate_fuzzy(size_t nu
|
||||
return is_street_duplicate_fuzzy(num_tokens1, tokens1, token_scores1, num_tokens2, tokens2, token_scores2, options);
|
||||
}
|
||||
|
||||
libpostal_language_classifier_response_t *libpostal_classify_language(char *address) {
|
||||
libpostal_language_classifier_response_t *response = classify_languages(address);
|
||||
|
||||
if (response == NULL) {
|
||||
log_error("Language classification returned NULL\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
void libpostal_language_classifier_response_destroy(libpostal_language_classifier_response_t *self) {
|
||||
if (self == NULL) return;
|
||||
if (self->languages != NULL) {
|
||||
free(self->languages);
|
||||
}
|
||||
|
||||
if (self->probs) {
|
||||
free(self->probs);
|
||||
}
|
||||
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
||||
void libpostal_address_parser_response_destroy(libpostal_address_parser_response_t *self) {
|
||||
if (self == NULL) return;
|
||||
|
||||
@@ -167,6 +167,19 @@ LIBPOSTAL_EXPORT libpostal_address_parser_response_t *libpostal_parse_address(ch
|
||||
|
||||
LIBPOSTAL_EXPORT bool libpostal_parser_print_features(bool print_features);
|
||||
|
||||
/*
|
||||
Language classification
|
||||
*/
|
||||
|
||||
typedef struct libpostal_language_classifier_response {
|
||||
size_t num_languages;
|
||||
char **languages;
|
||||
double *probs;
|
||||
} libpostal_language_classifier_response_t;
|
||||
|
||||
LIBPOSTAL_EXPORT libpostal_language_classifier_response_t *libpostal_classify_language(char *address);
|
||||
|
||||
LIBPOSTAL_EXPORT void libpostal_language_classifier_response_destroy(libpostal_language_classifier_response_t *self);
|
||||
|
||||
/*
|
||||
Deduping
|
||||
|
||||
Reference in New Issue
Block a user