Skip to main content

No project description provided

Project description

SEFR CUT

Domain Adaptation of Thai Word Segmentation Models using Stacked Ensemble (EMNLP 2020)
CRF as Stacked Model and DeepCut as Baseline model

Read more:

Install

pip install sefr_cut

How To use

Requirements

  • python >= 3.6
  • python-crfsuite >= 0.9.7
  • pyahocorasick == 1.4.0

Example

You can play the example on SEFR Example notebook

Load Engine & Engine Mode

  • ws1000, tnhc
    • ws1000: Model trained on Wisesight-1000 and test on Wisesight-160
    • tnhc: Model trained on TNHC (80:20 train&test split with random seed 42)
    • BEST: Trained on BEST-2010 Corpus (NECTEC)
    SEFR_CUT.load_model(engine='ws1000')
    # OR
    SEFR_CUT.load_model(engine='tnhc')
    # OR
    SEFR_CUT.load_model(engine='best')
    
  • tl-deepcut-XXXX
    • We also provide transfer learning of deepcut on 'Wisesight' as tl-deepcut-ws1000 and 'TNHC' as tl-deepcut-tnhc
    SEFR_CUT.load_model(engine='tl-deepcut-ws1000')
    # OR
    SEFR_CUT.load_model(engine='tl-deepcut-tnhc')
    
  • deepcut
    • We also provide the original deepcut
    SEFR_CUT.load_model(engine='deepcut')
    

Segment Example

  • Segment with default k
    SEFR_CUT.load_model(engine='ws1000')
    print(sefr_cut.tokenize(['สวัสดีประเทศไทย','ลุงตู่สู้ๆ']))
    print(sefr_cut.tokenize(['สวัสดีประเทศไทย']))
    print(sefr_cut.tokenize('สวัสดีประเทศไทย'))
    
    [['สวัสดี', 'ประเทศ', 'ไทย'], ['ลุง', 'ตู่', 'สู้', 'ๆ']]
    [['สวัสดี', 'ประเทศ', 'ไทย']]
    [['สวัสดี', 'ประเทศ', 'ไทย']]
    
  • Segment with different k
    SEFR_CUT.load_model(engine='ws1000')
    print(sefr_cut.tokenize(['สวัสดีประเทศไทย','ลุงตู่สู้ๆ'],k=5)) # refine only 5% of character number
    print(sefr_cut.tokenize(['สวัสดีประเทศไทย','ลุงตู่สู้ๆ'],k=100)) # refine 100% of character number
    
    [['สวัสดี', 'ประเทศไทย'], ['ลุงตู่', 'สู้', 'ๆ']]
    [['สวัสดี', 'ประเทศ', 'ไทย'], ['ลุง', 'ตู่', 'สู้', 'ๆ']]
    

Evaluation

  • Character & Word Evaluation is provided by call fuction evaluation()
    • For example
    
    

Performance

How to re-train?

  • You can re-train model in folder Notebooks We provided everything for you!!

    Re-train Model

    • You need to XXXXXXXXXXX
    • Link:HERE

    Filter and Refine Example

    • You need to XXXXXXXXXXX
    • Link:HERE

    Use your own model?

    • You need to XXXXXXXXXXX

Citation

  • Wait our paper shown in ACL Anthology

Thank you many code from

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

SEFR_CUT-0.1.dev0-py3-none-any.whl (8.7 MB view details)

Uploaded Python 3

File details

Details for the file SEFR_CUT-0.1.dev0-py3-none-any.whl.

File metadata

  • Download URL: SEFR_CUT-0.1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for SEFR_CUT-0.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2269277686b6922192db7095c9bbd6aa54838e7dd271f81931e2522d945ae6c
MD5 004fa7f641de638b606672985c457606
BLAKE2b-256 8963c48e894593367cc388868ba42308ed308f33ba6e6d4ae72ac96741f2eee3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page