tezaursapi

Crates.iotezaursapi
lib.rstezaursapi
version0.1.3
sourcesrc
created_at2024-02-15 20:44:17.255271
updated_at2024-02-19 15:48:40.573641
descriptionapi wrapper for tezaurs.lv
homepage
repositoryhttps://github.com/Teyllayka/tezaursapi
max_upload_size
id1141528
size20,663
Teyllay (Teyllayka)

documentation

README

TezaursApi

Crates.io Donate Crates.io

Async Rust wrapper of tezaurs

documentation

Please fell free to contribute

create api, call functions:

let api = TezaursApi::new();


let words = api.analyze("jūra".to_string()).await?;
println!("{:?}", words);
// [AnalyzedWord { number: Singular, id: None, word: "jūra", word_id: None, lexem: 1033983, free_text: None, end: 28, source: Some("VVC paplašinātais vārdadienu saraksts 2014-10-31"), part_of_speech: Noun, swap: 1, mention: "Nav", basic_form: "Jūris", case: Genitive, gender: Male, group: 3, declination: 2 }, AnalyzedWord { number: Singular, id: Some(134187), word: "jūra", word_id: Some("jūra:1"), lexem: 138064, free_text: None, end: 75, source: None, part_of_speech: Noun, swap: 0, mention: "Nav", basic_form: "jūra", case: Nominative, gender: Female, group: 7, declination: 4 }]

let tokens = api.tokenize(String::from("es domāju")).await?; //
println!("{:?}", tokens);
// [Token { word: "es", tag: "pp10snn", base_form: "es" }, Token { word: "domāju", tag: "vmnip_21san", base_form: "domāt" }]

let text = api.normalize_phrase(String::from("Latvijas Universitātes Matemātikas un Informātikas Institūtam")).await?;

println!("{:?}", text);
// Latvijas Universitātes Matemātikas un Informātikas Institūts

let inflections = api.inflect_phrase(String::from("Latvijas Universitātes Matemātikas un Informātikas Institūtam")).await?;
println!("{:?}", inflections);
//[Inflection { case: Accusative, sentence: "Latvijas Universitātes Matemātikas un Informātikas Institūtu" }, Inflection { case: Datīvs, sentence: "Latvijas Universitātes Matemātikas un Informātikas Institūtam" }, Inflection { case:Locative, sentence: "Latvijas Universitātes Matemātikas un Informātikas Institūtā" }, Inflection { case: Nominative, sentence: "Latvijas Universitātes Matemātikas un Informātikas Institūts" }, Inflection { case: Genitive, sentence: "Latvijas Universitātes Matemātikas un Informātikas Institūta" }]

let paradigms = api.suitable_paradigm(String::from("pokemonizators")).await?;
println!("{:?}", paradigms);
// [Paradigm { id: 1, description: "noun-1a" }, Paradigm { id: 13, description: "adj-1" }, Paradigm { id: 39, description: "foreign" }]

let morphs = api.morphotagger(String::from("vīrs ar cirvi.")).await?;
println!("{:?}", morphs);
// vīrs    ncmsn1  vīrs
// ar      spsa    ar
// cirvi   ncmsa2  cirvis
// .       zs      .

let inflcs = api.verbs(String::from("domai")).await?;
println!("{:?}", inflcs);
// ["Dat", "Nom", "Gen", "Acc", "Loc"]

implemented:

  • analyze
  • tokenize
  • normalize_phrase
  • inflect_phrase
  • suitable_paradigm
  • morphotagger
  • verbs
Commit count: 0

cargo fmt