#![warn(clippy::all)]
#![warn(missing_docs)]
#![warn(clippy::missing_docs_in_private_items)]
#![doc = include_str!("../README.md")]
mod language_names;
pub use language_names::LANGUAGE;
pub fn get<T: Into<String>>(input_language: T) -> Vec<String> {
let language_name_as_string = input_language.into();
let json_as_bytes: &[u8] = if cfg!(feature = "nltk") {
include_bytes!(concat!(env!("OUT_DIR"), "/stopwords-nltk.json"))
} else if cfg!(feature = "constructed") {
include_bytes!(concat!(env!("OUT_DIR"), "/stopwords-constructed.json"))
} else {
include_bytes!("iso/stopwords-iso.json")
};
let json: serde_json::Value = serde_json::from_slice(json_as_bytes)
.expect("Could not read JSON file from Stopwords ISO.");
json.get(language_name_as_string.clone())
.unwrap_or_else(|| panic!("The '{language_name_as_string}' language is not recognized. Please check the documentation for a supported list of languages."))
.clone()
.as_array_mut()
.expect("The referenced value is not a mutable array.")
.iter()
.map(serde_json::Value::to_string)
.map(|x| x.replace("\"", ""))
.collect()
}