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

PyThaiNLP / pythainlp / 4699361508

pending completion
4699361508

push

github

GitHub
Merge pull request #789 from PyThaiNLP/4.0

22 of 22 new or added lines in 6 files covered. (100.0%)

5749 of 6246 relevant lines covered (92.04%)

0.92 hits per line

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

90.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:
×
12
    raise ImportError("Import Error; Install esupar by pip install esupar")
×
13

14

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

21
    def __call__(
1✔
22
        self, text: str, tag: str = "str"
23
    ) -> Union[List[List[str]], str]:
24
        _data = str(self.nlp(text))
1✔
25
        if tag == "list":
1✔
26
            _temp = _data.splitlines()
1✔
27
            _tag_data = []
1✔
28
            for i in _temp:
1✔
29
                _tag_data.append(i.split())
1✔
30
            return _tag_data
1✔
31
        return _data
1✔
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

© 2025 Coveralls, Inc