Skip to content

Commit 46fe81f

Browse files
committed
Update typing
- Update typing - Change my e-mail
1 parent 612509c commit 46fe81f

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

pythainlp/corpus/default_db.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"authors": [
99
"Wannaphong Phatthiyaphaibun"
1010
],
11-
"author_email": "wannaphong@kkumail.com",
11+
"author_email": "wannaphong@yahoo.com",
1212
"license": "cc-by-4.0",
1313
"versions": {
1414
"1.5.1": {

pythainlp/soundex/sound.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def word2audio(word: str) -> str:
4444
_ipa = [_clean_ipa(transliterate(phone, engine="thaig2p")) for phone in _phone]
4545
return '.'.join(_ipa)
4646

47-
def audio_vector(word:str) -> List[List[int]]:
47+
def audio_vector(word: str) -> List[List[int]]:
4848
"""
4949
Convert audio to vector list
5050
@@ -62,14 +62,14 @@ def audio_vector(word:str) -> List[List[int]]:
6262
"""
6363
return _ft.word_to_vector_list(word2audio(word), numeric=True)
6464

65-
def word_approximation(word:str, list_word:List[str]):
65+
def word_approximation(word: str, list_word: List[str]) -> List[float]:
6666
"""
6767
Thai Word Approximation
6868
6969
:param str word: Thai word
7070
:param str list_word: Thai word
7171
:return: List of approximation of words (The smaller the value, the closer)
72-
:rtype: List[str]
72+
:rtype: List[float]
7373
7474
:Example:
7575
::

pythainlp/spell/wanchanberta_thai_grammarly.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* GitHub: \
1212
https://github.com/bookpanda/Two-stage-Thai-Misspelling-Correction-Based-on-Pre-trained-Language-Models
1313
"""
14+
from typing import List
1415
import torch
1516
from transformers import (
1617
AutoModelForMaskedLM,
@@ -36,7 +37,7 @@ def forward(self, input_id, mask, label):
3637
tagging_model = tagging_model.to(device=device)
3738
ids_to_labels = {0: 'f', 1: 'i'}
3839

39-
def align_word_ids(texts):
40+
def align_word_ids(texts: str) -> List[int]:
4041
tokenized_inputs = tokenizer(texts, padding='max_length', max_length=512, truncation=True)
4142
word_ids = tokenized_inputs.word_ids()
4243
label_ids = []
@@ -70,7 +71,7 @@ def evaluate_one_text(model, sentence):
7071
if use_cuda:
7172
mlm_model = mlm_model.to(device=device)
7273

73-
def correct(text):
74+
def correct(text: str) -> str:
7475
ans = []
7576
i_f = evaluate_one_text(tagging_model, text)
7677
a = tokenizer(text)

pythainlp/tag/_tag_perceptron.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This tagger is a port of the Textblob Averaged Perceptron Tagger
99
Author: Matthew Honnibal <[email protected]>,
1010
Long Duong <[email protected]> (NLTK port)
11-
Wannaphong Phatthiyaphaibun <wannaphong@kkumail.com> (PyThaiNLP port)
11+
Wannaphong Phatthiyaphaibun <wannaphong@yahoo.com> (PyThaiNLP port)
1212
URL: <https://github.com/sloria/textblob-aptagger>
1313
<https://nltk.org/>
1414
Copyright 2013 Matthew Honnibal

0 commit comments

Comments
 (0)