Crates.io | wordcutw |
lib.rs | wordcutw |
version | 0.2.1 |
source | src |
created_at | 2021-04-23 02:59:34.024871 |
updated_at | 2024-02-28 14:09:59.152878 |
description | A C-interface wrapper for Wordcut - a Lao/Thai word segmentation/breaking library |
homepage | https://github.com/veer66/wordcutw |
repository | https://github.com/veer66/wordcutw |
max_upload_size | |
id | 388399 |
size | 20,539 |
A C-interface wrapper for Wordcut - a Lao/Thai word segmentation/breaking library
git clone git@github.com:veer66/wordcutw.git
cd wordcutw
cargo build --release
sudo cp target/release/libwordcutw.so /usr/local/lib
#include <stdio.h>
#include "wordcutw.h"
int
main()
{
Wordcut *wordcut = wordcut_new_with_dict_from_default_dir("data/thai.txt");
size_t range_count = 0;
TextRange* text_ranges = wordcut_into_text_ranges(wordcut, "ลากา", &range_count);
printf("COUNT = %zu\n", range_count);
printf("R0 %zu_%zu\n", text_ranges[0].s, text_ranges[0].e);
printf("R1 %zu_%zu\n", text_ranges[1].s, text_ranges[1].e);
delete_text_ranges(text_ranges, range_count);
delete_wordcut(wordcut);
return 0;
}