-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
41b69e5
commit 5bddd4e
Showing
3 changed files
with
43 additions
and
14 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod network; | ||
pub mod semantics; | ||
|
||
pub mod conf {} | ||
|
||
|
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,28 @@ | ||
use whatlang::{detect, Lang}; | ||
|
||
/// Identify word language | ||
pub fn identify(words: String) -> &'static str { | ||
match detect(words.as_str()) { | ||
None => "en", | ||
Some(lang) => match lang.lang() { | ||
Lang::Eng => "en", | ||
Lang::Cmn => "zh", | ||
Lang::Spa => "es", | ||
Lang::Ita => "it", | ||
Lang::Fra => "fr", | ||
Lang::Jpn => "ja", | ||
Lang::Deu => "de", | ||
Lang::Kor => "ko", | ||
Lang::Rus => "ru", | ||
Lang::Vie => "vi", | ||
Lang::Tha => "th", | ||
Lang::Ukr => "uk", | ||
Lang::Por => "pt", | ||
Lang::Ara => "ar", | ||
Lang::Hin => "hi", | ||
Lang::Tur => "tr", | ||
Lang::Ind => "id", | ||
_ => "en", | ||
}, | ||
} | ||
} |
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