일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- aggs
- sort
- API
- Kafka
- plugin
- springboot
- license delete
- flask
- TensorFlow
- high level client
- 파이썬
- Java
- zip 파일 암호화
- query
- matplotlib
- Elasticsearch
- docker
- Test
- licence delete curl
- License
- Mac
- analyzer test
- 차트
- token filter test
- zip 암호화
- ELASTIC
- MySQL
- 900gle
- aggregation
- Python
Archives
- Today
- Total
개발잡부
[python] 오탈자 교정 - SymSpellpy 본문
반응형
symspellpy 테스트 해보고
구글 코랩 접속 -> 새노트
We can use load_dictionary():
모듈 설치하고
pip install symspellpy
from itertools import islice
import pkg_resources
from symspellpy import SymSpell
sym_spell = SymSpell()
dictionary_path = pkg_resources.resource_filename(
"symspellpy", "frequency_dictionary_en_82_765.txt"
)
sym_spell.load_dictionary(dictionary_path, 0, 1)
# Print out first 5 elements to demonstrate that dictionary is
# successfully loaded
print(list(islice(sym_spell.words.items(), 5)))
We can use load_bigram_dictionary():
from itertools import islice
import pkg_resources
from symspellpy import SymSpell
sym_spell = SymSpell()
dictionary_path = pkg_resources.resource_filename(
"symspellpy", "frequency_bigramdictionary_en_243_342.txt"
)
sym_spell.load_bigram_dictionary(dictionary_path, 0, 2)
# Print out first 5 elements to demonstrate that dictionary is
# successfully loaded
print(list(islice(sym_spell.bigrams.items(), 5)))
from itertools import islice
from symspellpy import SymSpell
sym_spell = SymSpell()
dictionary_path = <path/to/dictionary>
sym_spell.load_dictionary(dictionary_path, 0, 1, separator="$")
# Print out first 5 elements to demonstrate that dictionary is
# successfully loaded
print(list(islice(sym_spell.words.items(), 5)))
from itertools import islice
from symspellpy import SymSpell
sym_spell = SymSpell()
dictionary_path = <path/to/dictionary>
sym_spell.load_bigram_dictionary(dictionary_path, 0, 1, separator="$")
# Print out first 5 elements to demonstrate that dictionary is
# successfully loaded
print(list(islice(sym_spell.bigrams.items(), 5)))
from symspellpy import SymSpell
sym_spell = SymSpell()
corpus_path = <path/to/plain/text/file>
sym_spell.create_dictionary(corpus_path)
print(sym_spell.words)
https://symspellpy.readthedocs.io/en/latest/examples/index.html
반응형
'Python' 카테고리의 다른 글
[python] 날짜계산 (datetime) (0) | 2024.02.06 |
---|---|
[python] DB data to json (0) | 2023.09.04 |
[python] .txt 파일 라인 카운트 (1) | 2023.05.19 |
[python] 데이터검증 (0) | 2023.05.17 |
[python] API 응답시간 확인 (0) | 2023.05.04 |
Comments