Enchant
Enchant (철자 검사)
여러 철자 검사 라이브러리를 하나의 통일된 인터페이스로 다루게 해 주는 확장이에요. 언어별 사전을 이용해 단어의 철자가 맞는지 확인하고, 대안 철자를 제안받을 수 있습니다.
본문
Enchant는 Enchant 라이브러리에 대한 PHP 바인딩입니다. Enchant는 각종 철자 검사 라이브러리 위에 통일성(uniformity)과 일관성(conformity) 을 제공하며, 개별 공급자 라이브러리에서 빠져 있을 수 있는 기능도 구현해요. 그 덕분에 어떤 정의의 "그냥 잘 동작한다(just works)"든 그에 맞춰 동작하게 됩니다.
Enchant는 다음 백엔드를 지원합니다.
- Aspell/Pspell (Ispell을 대체하려는 의도)
- Ispell (아주 오래됐지만 사실상 표준으로 통하는 경우가 많음)
- MySpell/Hunspell (OOo 프로젝트, Mozilla에서도 사용)
- Uspell (주로 이디시어·히브리어·동유럽 언어 - AbiWord의 CVS "uspell" 모듈)
- Hspell (히브리어)
- AppleSpell (macOS)
Enchant 함수
| 함수 | 설명 |
|---|---|
enchant_broker_describe |
Enchant 공급자(provider) 열거 |
enchant_broker_dict_exists |
사전이 존재하는지 여부 |
enchant_broker_free |
브로커 리소스와 그 사전들 해제 |
enchant_broker_free_dict |
사전 리소스 해제 |
enchant_broker_get_dict_path |
주어진 백엔드의 디렉터리 경로 가져옴 |
enchant_broker_get_error |
브로커의 마지막 오류 반환 |
enchant_broker_init |
새 브로커 객체 생성 |
enchant_broker_list_dicts |
사용 가능한 사전 목록 반환 |
enchant_broker_request_dict |
태그를 사용해 새 사전 생성 |
enchant_broker_request_pwl_dict |
PWL 파일을 사용해 사전 생성 |
enchant_broker_set_dict_path |
주어진 백엔드의 디렉터리 경로 설정 |
enchant_broker_set_ordering |
언어에 사용할 사전의 선호 순서 선언 |
enchant_dict_add |
개인 단어 목록에 단어 추가 |
enchant_dict_add_to_personal |
enchant_dict_add의 별칭 |
enchant_dict_add_to_session |
이 철자 검사 세션에 단어 추가 |
enchant_dict_check |
단어의 철자가 맞는지 확인 |
enchant_dict_describe |
개별 사전 설명 |
enchant_dict_get_error |
현재 철자 검사 세션의 마지막 오류 반환 |
enchant_dict_is_added |
단어가 이 철자 검사 세션에 존재하는지 여부 |
enchant_dict_is_in_session |
enchant_dict_is_added의 별칭 |
enchant_dict_quick_check |
단어 철자 검사 및 제안 제공 |
enchant_dict_remove |
제외 목록에 단어 추가하고 개인 사전에서 제거 |
enchant_dict_remove_from_session |
세션 사전에서 단어 제거 |
enchant_dict_store_replacement |
단어에 대한 수정(correction) 추가 |
enchant_dict_suggest |
단어에 대한 철자 제안 |
관련 클래스
- EnchantBroker — Enchant 브로커 클래스
- EnchantDictionary — Enchant 사전 클래스
흐름은 간단해요. enchant_broker_init()으로 브로커를 만들고, enchant_broker_request_dict()로 언어 태그를 붙인 사전을 연 다음, enchant_dict_check()로 검사하거나 enchant_dict_suggest()로 대안 철자를 받는 식입니다.