File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ crate-type = ["cdylib"]
1515divvunspell = { git = " https://github.com/divvun/divvunspell" , branch = " main" , features = [" compression" ] }
1616
1717[dependencies .pyo3 ]
18- version = " 0.13.4 "
18+ version = " 0.13.2 "
1919features = [" extension-module" ]
2020
2121[package .metadata .maturin ]
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ struct SpellerArchive {
4646impl SpellerArchive {
4747 #[ new]
4848 fn new ( path : String ) -> PyResult < Self > {
49- let ar = archive:: open ( std:: path:: Path :: new ( & path) ) . unwrap ( ) ;
49+ let ar = archive:: open ( std:: path:: Path :: new ( & path) )
50+ . map_err ( |e| PyErr :: new :: < pyo3:: exceptions:: PyException , _ > ( format ! ( "{}" , e) ) ) ?;
5051 Ok ( SpellerArchive { archive : ar } )
5152 }
5253
@@ -87,4 +88,10 @@ impl Speller {
8788 . map ( |x| ( x. value . to_string ( ) , x. weight ) )
8889 . collect :: < Vec < _ > > ( ) )
8990 }
91+
92+ /// Returns whether a word is spelt correctly.
93+ fn is_correct ( & self , word : String ) -> PyResult < bool > {
94+ let speller = Arc :: clone ( & self . speller ) ;
95+ Ok ( speller. is_correct ( & word) )
96+ }
9097}
You can’t perform that action at this time.
0 commit comments