Skip to content

Commit

Permalink
Fixed docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wannaphong committed Apr 21, 2024
1 parent 75bff1d commit 13a6c7c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions docs/api/el.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Example
Here's a simple example of how to use the `EntityLinker` class:

::
from pythainlp.el import EntityLinker
from pythainlp.el import EntityLinker
text = "กรุงเทพเป็นเมืองหลวงของประเทศไทย"
el = EntityLinker()
linked_entities = el.get_el(text)
print(linked_entities)
text = "กรุงเทพเป็นเมืองหลวงของประเทศไทย"
el = EntityLinker()
linked_entities = el.get_el(text)
print(linked_entities)
42 changes: 21 additions & 21 deletions pythainlp/corpus/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,27 @@ def revise_wordset(
:Example::
::
from pythainlp.corpus import thai_words
from pythainlp.corpus.util import revise_wordset
from pythainlp.tokenize.longest import segment
base_words = thai_words()
more_words = {
"ถวิล อุดล", "ทองอินทร์ ภูริพัฒน์", "เตียง ศิริขันธ์", "จำลอง ดาวเรือง"
}
base_words = base_words.union(more_words)
dict_trie = Trie(wordlist)
tokenize = lambda text: segment(text, dict_trie)
training_data = [
[str, str, str. ...],
[str, str, str, str, ...],
...
]
revised_words = revise_wordset(tokenize, wordlist, training_data)
from pythainlp.corpus import thai_words
from pythainlp.corpus.util import revise_wordset
from pythainlp.tokenize.longest import segment
base_words = thai_words()
more_words = {
"ถวิล อุดล", "ทองอินทร์ ภูริพัฒน์", "เตียง ศิริขันธ์", "จำลอง ดาวเรือง"
}
base_words = base_words.union(more_words)
dict_trie = Trie(wordlist)
tokenize = lambda text: segment(text, dict_trie)
training_data = [
[str, str, str. ...],
[str, str, str, str, ...],
...
]
revised_words = revise_wordset(tokenize, wordlist, training_data)
"""
bad_words = find_badwords(tokenize, training_data)
return set(orig_words) - bad_words
Expand Down

0 comments on commit 13a6c7c

Please sign in to comment.