#text #thai #nlp #c #lao

wordcutw

A C-interface wrapper for Wordcut - a Lao/Thai word segmentation/breaking library

3 unstable releases

0.2.1 Feb 28, 2024
0.2.0 Dec 6, 2023
0.1.0 Apr 23, 2021

#5 in #thai

Download history 3/week @ 2023-12-02 119/week @ 2024-02-24 18/week @ 2024-03-02 3/week @ 2024-03-09

140 downloads per month

LGPL-3.0

12KB
235 lines

wordcutw

A C-interface wrapper for Wordcut - a Lao/Thai word segmentation/breaking library

Install

git clone git@github.com:veer66/wordcutw.git
cd wordcutw
cargo build --release
sudo cp target/release/libwordcutw.so /usr/local/lib

Example

#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;
}

Dependencies

~7MB
~109K SLoC