-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
387 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use ahnlich_types::similarity::{Algorithm, NonLinearAlgorithm}; | ||
|
||
use crate::error::DslError; | ||
|
||
pub(crate) fn to_non_linear(input: &str) -> Option<NonLinearAlgorithm> { | ||
match input.to_lowercase().trim() { | ||
"kdtree" => Some(NonLinearAlgorithm::KDTree), | ||
_ => None, | ||
} | ||
} | ||
|
||
pub(crate) fn to_algorithm(input: &str) -> Result<Algorithm, DslError> { | ||
match input.to_lowercase().trim() { | ||
"kdtree" => Ok(Algorithm::KDTree), | ||
"cosinesimilarity" => Ok(Algorithm::CosineSimilarity), | ||
"dotproductsimilarity" => Ok(Algorithm::DotProductSimilarity), | ||
"euclideandistance" => Ok(Algorithm::EuclideanDistance), | ||
e => Err(DslError::UnsupportedAlgorithm(e.to_string())), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
mod algorithm; | ||
pub mod db; | ||
pub mod error; | ||
mod metadata; | ||
mod parser; | ||
mod predicate; | ||
#[cfg(test)] | ||
mod tests; |
Oops, something went wrong.