• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PyThaiNLP / pythainlp / 5539259120

pending completion
5539259120

Pull #818

github

web-flow
Merge f38c51a8e into b5292f029
Pull Request #818: Add pythainlp.wsd for Thai Word Sense Disambiguation

77 of 77 new or added lines in 3 files covered. (100.0%)

5373 of 6433 relevant lines covered (83.52%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.0
/pythainlp/parse/esupar_engine.py
1
# -*- coding: utf-8 -*-
2
"""
1✔
3
esupar: Tokenizer POS-tagger and Dependency-parser with BERT/RoBERTa/DeBERTa models for Japanese and other languages
4

5
GitHub: https://github.com/KoichiYasuoka/esupar
6
"""
7
from typing import List, Union
1✔
8

9
try:
1✔
10
    import esupar
1✔
11
except ImportError:
1✔
12
    raise ImportError("Import Error; Install esupar by pip install esupar")
1✔
13

14

15
class Parse:
×
16
    def __init__(self, model: str = "th") -> None:
×
17
        if model == None:
×
18
            model = "th"
×
19
        self.nlp = esupar.load(model)
×
20

21
    def __call__(
×
22
        self, text: str, tag: str = "str"
23
    ) -> Union[List[List[str]], str]:
24
        _data = str(self.nlp(text))
×
25
        if tag == "list":
×
26
            _temp = _data.splitlines()
×
27
            _tag_data = []
×
28
            for i in _temp:
×
29
                _tag_data.append(i.split())
×
30
            return _tag_data
×
31
        return _data
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc