inaka-sheldonErlang 拼寫檢查器
Sheldon 是一個非常簡單的 Erlang 拼寫檢查器。當某些單詞拼寫錯誤時,Sheldon會建議正確的單詞。該功能的靈感來自 Elixir 項目拼寫檢查。
安裝
注意 sheldon僅適用于 Erlang 21 或更高版本
- 克隆倉庫
rebar3 compile
用法
Erlang Shell
首先 Sheldon 是一個應(yīng)用程序,需要啟動??梢允褂?code>rebar3 shell來設(shè)置必要的路徑,然后使用sheldon:start/0或application:ensure_all_started(sheldon)來啟動 Sheldon,但如果使用 Sheldon 作為依賴項,也可以讓 OTP 從 your_app.app 文件中啟動它。
Sheldon 只有兩個主要方法,sheldon:check/1和sheldon:check/2. 作為用戶只需要使用這些。
1> sheldon:check("I want to check this correct text"). ok 2> sheldon:check("I want to check this misspeled text"). #{bazinga => <<"That's no reason to cry. One cries because one is sad. For example, I cry because others are stupid, and that ma"...>>, misspelled_words => [#{candidates => ["misspeed","misspelled"], line_number => 1, word => "misspeled"}]}
配置
sheldon:check/2工作原理與sheldon:check/1類似,但它接受配置參數(shù)。使用此 Conf 參數(shù),我們可以對要檢查的文本應(yīng)用一些規(guī)則。這些規(guī)則是忽略單詞、忽略模式和忽略塊。
這是格式:
#{ ignore_words => [string()]
, ignore_patterns => [regex()]
, ignore_blocks => [ignore_block()]
, adapters => [adapter()]
}.
依賴關(guān)系
- Erlang/OTP 23+
評論
圖片
表情
