<commit_before># -*- coding: utf-8 -*-
"""
Wrapper for SEFR CUT Thai word segmentation. SEFR CUT is a
Thai Word Segmentation Models using Stacked Ensemble.

:See Also:
    * `GitHub repository <https://github.com/mrpeerat/SEFR_CUT>`_
"""
from typing import List

import sefr_cut

_engine = 'ws1000'
sefr_cut.load_model(engine=_engine)


def segment(text: str, engine: str = 'ws1000') -> List[str]:
    """
    
    """
    global _engine
    if engine != _engine:
        _engine = engine
        sefr_cut.load_model(engine=_engine)
    return sefr_cut.tokenize(text)[0]<commit_msg>Update sefr_cut.py<commit_after># -*- coding: utf-8 -*-
"""
Wrapper for SEFR CUT Thai word segmentation. SEFR CUT is a
Thai Word Segmentation Models using Stacked Ensemble.

:See Also:
    * `GitHub repository <https://github.com/mrpeerat/SEFR_CUT>`_
"""
from typing import List

import sefr_cut

_engine = 'ws1000'
sefr_cut.load_model(engine=_engine)


def segment(text: str, engine: str = 'ws1000') -> List[str]:
    """
    
    """
    global _engine
    if not text or not isinstance(text, str):
        return []
    if engine != _engine:
        _engine = engine
        sefr_cut.load_model(engine=_engine)
    return sefr_cut.tokenize(text)[0]
{'fraction_non_alphanumeric': 0.12246553122465531, 'fraction_numerical': 0.016220600162206, 'mean_word_length': 3.375886524822695, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5500964', 'n_tokens_mistral': 439, 'n_tokens_neox': 416, 'n_words': 112}