#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Dialect {
Hokkaido,
Kansai,
Kantou,
Kyoto,
Kyuushuu,
Nagano,
Osaka,
Ryuukyuu,
Touhoku,
Tosa,
Tsugaru,
}
impl Enum for Dialect {
fn code(&self) -> &'static str {
match *self {
Dialect::Hokkaido => "hob",
Dialect::Kansai => "ksb",
Dialect::Kantou => "ktb",
Dialect::Kyoto => "kyb",
Dialect::Kyuushuu => "kyu",
Dialect::Nagano => "nab",
Dialect::Osaka => "osb",
Dialect::Ryuukyuu => "rkb",
Dialect::Touhoku => "thb",
Dialect::Tosa => "tsb",
Dialect::Tsugaru => "tsug",
}
}
fn constant_name(&self) -> &'static str {
match *self {
Dialect::Hokkaido => "Hokkaido",
Dialect::Kansai => "Kansai",
Dialect::Kantou => "Kantou",
Dialect::Kyoto => "Kyoto",
Dialect::Kyuushuu => "Kyuushuu",
Dialect::Nagano => "Nagano",
Dialect::Osaka => "Osaka",
Dialect::Ryuukyuu => "Ryuukyuu",
Dialect::Touhoku => "Touhoku",
Dialect::Tosa => "Tosa",
Dialect::Tsugaru => "Tsugaru",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"hob" => Some(Dialect::Hokkaido),
"ksb" => Some(Dialect::Kansai),
"ktb" => Some(Dialect::Kantou),
"kyb" => Some(Dialect::Kyoto),
"kyu" => Some(Dialect::Kyuushuu),
"nab" => Some(Dialect::Nagano),
"osb" => Some(Dialect::Osaka),
"rkb" => Some(Dialect::Ryuukyuu),
"thb" => Some(Dialect::Touhoku),
"tsb" => Some(Dialect::Tosa),
"tsug" => Some(Dialect::Tsugaru),
_ => None,
}
}
}
impl std::fmt::Display for Dialect {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for Dialect {
fn to_u32(&self) -> u32 {
match *self {
Dialect::Hokkaido => 0,
Dialect::Kansai => 1,
Dialect::Kantou => 2,
Dialect::Kyoto => 3,
Dialect::Kyuushuu => 4,
Dialect::Nagano => 5,
Dialect::Osaka => 6,
Dialect::Ryuukyuu => 7,
Dialect::Touhoku => 8,
Dialect::Tosa => 9,
Dialect::Tsugaru => 10,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => Dialect::Hokkaido,
1 => Dialect::Kansai,
2 => Dialect::Kantou,
3 => Dialect::Kyoto,
4 => Dialect::Kyuushuu,
5 => Dialect::Nagano,
6 => Dialect::Osaka,
7 => Dialect::Ryuukyuu,
8 => Dialect::Touhoku,
9 => Dialect::Tosa,
10 => Dialect::Tsugaru,
_ => panic!("unknown Dialect code: {}", code),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum AllGlossLanguage {
English,
Dutch,
French,
German,
Hungarian,
Russian,
Slovenian,
Spanish,
Swedish,
}
impl Enum for AllGlossLanguage {
fn code(&self) -> &'static str {
match *self {
AllGlossLanguage::English => "eng",
AllGlossLanguage::Dutch => "dut",
AllGlossLanguage::French => "fre",
AllGlossLanguage::German => "ger",
AllGlossLanguage::Hungarian => "hun",
AllGlossLanguage::Russian => "rus",
AllGlossLanguage::Slovenian => "slv",
AllGlossLanguage::Spanish => "spa",
AllGlossLanguage::Swedish => "swe",
}
}
fn constant_name(&self) -> &'static str {
match *self {
AllGlossLanguage::English => "English",
AllGlossLanguage::Dutch => "Dutch",
AllGlossLanguage::French => "French",
AllGlossLanguage::German => "German",
AllGlossLanguage::Hungarian => "Hungarian",
AllGlossLanguage::Russian => "Russian",
AllGlossLanguage::Slovenian => "Slovenian",
AllGlossLanguage::Spanish => "Spanish",
AllGlossLanguage::Swedish => "Swedish",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"eng" => Some(AllGlossLanguage::English),
"dut" => Some(AllGlossLanguage::Dutch),
"fre" => Some(AllGlossLanguage::French),
"ger" => Some(AllGlossLanguage::German),
"hun" => Some(AllGlossLanguage::Hungarian),
"rus" => Some(AllGlossLanguage::Russian),
"slv" => Some(AllGlossLanguage::Slovenian),
"spa" => Some(AllGlossLanguage::Spanish),
"swe" => Some(AllGlossLanguage::Swedish),
_ => None,
}
}
}
impl std::fmt::Display for AllGlossLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for AllGlossLanguage {
fn to_u32(&self) -> u32 {
match *self {
AllGlossLanguage::English => 0,
AllGlossLanguage::Dutch => 1,
AllGlossLanguage::French => 2,
AllGlossLanguage::German => 3,
AllGlossLanguage::Hungarian => 4,
AllGlossLanguage::Russian => 5,
AllGlossLanguage::Slovenian => 6,
AllGlossLanguage::Spanish => 7,
AllGlossLanguage::Swedish => 8,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => AllGlossLanguage::English,
1 => AllGlossLanguage::Dutch,
2 => AllGlossLanguage::French,
3 => AllGlossLanguage::German,
4 => AllGlossLanguage::Hungarian,
5 => AllGlossLanguage::Russian,
6 => AllGlossLanguage::Slovenian,
7 => AllGlossLanguage::Spanish,
8 => AllGlossLanguage::Swedish,
_ => panic!("unknown AllGlossLanguage code: {}", code),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum GlossLanguage {
}
impl Enum for GlossLanguage {
fn code(&self) -> &'static str {
match *self {
}
}
fn constant_name(&self) -> &'static str {
match *self {
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
_ => None,
}
}
}
impl std::fmt::Display for GlossLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for GlossLanguage {
fn to_u32(&self) -> u32 {
match *self {
}
}
fn from_u32(code: u32) -> Self {
match code {
_ => panic!("unknown GlossLanguage code: {}", code),
}
}
}
impl std::convert::TryFrom<AllGlossLanguage> for GlossLanguage {
type Error = DisabledVariant;
fn try_from(value: AllGlossLanguage) -> Result<GlossLanguage, DisabledVariant> {
match value {
AllGlossLanguage::English => Err(DisabledVariant),
AllGlossLanguage::Dutch => Err(DisabledVariant),
AllGlossLanguage::French => Err(DisabledVariant),
AllGlossLanguage::German => Err(DisabledVariant),
AllGlossLanguage::Hungarian => Err(DisabledVariant),
AllGlossLanguage::Russian => Err(DisabledVariant),
AllGlossLanguage::Slovenian => Err(DisabledVariant),
AllGlossLanguage::Spanish => Err(DisabledVariant),
AllGlossLanguage::Swedish => Err(DisabledVariant),
}
}
}
impl std::convert::From<GlossLanguage> for AllGlossLanguage {
fn from(value: GlossLanguage) -> AllGlossLanguage {
match value {
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum GlossType {
RegularTranslation,
Explanation,
FigurativeSpeech,
LiteralTranslation,
}
impl Enum for GlossType {
fn code(&self) -> &'static str {
match *self {
GlossType::RegularTranslation => "",
GlossType::Explanation => "expl",
GlossType::FigurativeSpeech => "fig",
GlossType::LiteralTranslation => "lit",
}
}
fn constant_name(&self) -> &'static str {
match *self {
GlossType::RegularTranslation => "RegularTranslation",
GlossType::Explanation => "Explanation",
GlossType::FigurativeSpeech => "FigurativeSpeech",
GlossType::LiteralTranslation => "LiteralTranslation",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"" => Some(GlossType::RegularTranslation),
"expl" => Some(GlossType::Explanation),
"fig" => Some(GlossType::FigurativeSpeech),
"lit" => Some(GlossType::LiteralTranslation),
_ => None,
}
}
}
impl std::fmt::Display for GlossType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for GlossType {
fn to_u32(&self) -> u32 {
match *self {
GlossType::RegularTranslation => 0,
GlossType::Explanation => 1,
GlossType::FigurativeSpeech => 2,
GlossType::LiteralTranslation => 3,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => GlossType::RegularTranslation,
1 => GlossType::Explanation,
2 => GlossType::FigurativeSpeech,
3 => GlossType::LiteralTranslation,
_ => panic!("unknown GlossType code: {}", code),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum KanjiInfo {
Ateji,
IrregularKanjiUsage,
IrregularKanaUsage,
IrregularOkuriganaUsage,
OutdatedKanji,
}
impl Enum for KanjiInfo {
fn code(&self) -> &'static str {
match *self {
KanjiInfo::Ateji => "ateji",
KanjiInfo::IrregularKanjiUsage => "iK",
KanjiInfo::IrregularKanaUsage => "ik",
KanjiInfo::IrregularOkuriganaUsage => "io",
KanjiInfo::OutdatedKanji => "oK",
}
}
fn constant_name(&self) -> &'static str {
match *self {
KanjiInfo::Ateji => "Ateji",
KanjiInfo::IrregularKanjiUsage => "IrregularKanjiUsage",
KanjiInfo::IrregularKanaUsage => "IrregularKanaUsage",
KanjiInfo::IrregularOkuriganaUsage => "IrregularOkuriganaUsage",
KanjiInfo::OutdatedKanji => "OutdatedKanji",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"ateji" => Some(KanjiInfo::Ateji),
"iK" => Some(KanjiInfo::IrregularKanjiUsage),
"ik" => Some(KanjiInfo::IrregularKanaUsage),
"io" => Some(KanjiInfo::IrregularOkuriganaUsage),
"oK" => Some(KanjiInfo::OutdatedKanji),
_ => None,
}
}
}
impl std::fmt::Display for KanjiInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for KanjiInfo {
fn to_u32(&self) -> u32 {
match *self {
KanjiInfo::Ateji => 0,
KanjiInfo::IrregularKanjiUsage => 1,
KanjiInfo::IrregularKanaUsage => 2,
KanjiInfo::IrregularOkuriganaUsage => 3,
KanjiInfo::OutdatedKanji => 4,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => KanjiInfo::Ateji,
1 => KanjiInfo::IrregularKanjiUsage,
2 => KanjiInfo::IrregularKanaUsage,
3 => KanjiInfo::IrregularOkuriganaUsage,
4 => KanjiInfo::OutdatedKanji,
_ => panic!("unknown KanjiInfo code: {}", code),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum AllPartOfSpeech {
NounOrVerbActingPrenominally,
Adjective,
YoiAdjective,
KariAdjective,
KuAdjective,
AdjectivalNoun,
NariAdjective,
NoAdjective,
PreNounAdjectival,
ShikuAdjective,
TaruAdjective,
Adverb,
AdverbTakingToParticle,
Auxiliary,
AuxiliaryAdjective,
AuxiliaryVerb,
Conjunction,
Copula,
Counter,
Expression,
Interjection,
CommonNoun,
AdverbialNoun,
ProperNoun,
NounPrefix,
NounSuffix,
TemporalNoun,
Numeric,
Pronoun,
Prefix,
Particle,
Suffix,
Unclassified,
UnspecifiedVerb,
IchidanVerb,
IchidanKureruVerb,
NidanUVerb,
UpperNidanBuVerb,
LowerNidanBuVerb,
UpperNidanDzuVerb,
LowerNidanDzuVerb,
UpperNidanGuVerb,
LowerNidanGuVerb,
UpperNidanFuVerb,
LowerNidanFuVerb,
UpperNidanKuVerb,
LowerNidanKuVerb,
UpperNidanMuVerb,
LowerNidanMuVerb,
LowerNidanNuVerb,
UpperNidanRuVerb,
LowerNidanRuVerb,
LowerNidanSuVerb,
UpperNidanTsuVerb,
LowerNidanTsuVerb,
LowerNidanUWeVerb,
UpperNidanYuVerb,
LowerNidanYuVerb,
LowerNidanZuVerb,
YodanBuVerb,
YodanGuVerb,
YodanFuVerb,
YodanKuVerb,
YodanMuVerb,
YodanNuVerb,
YodanRuVerb,
YodanSuVerb,
YodanTsuVerb,
GodanAruVerb,
GodanBuVerb,
GodanGuVerb,
GodanKuVerb,
GodanIkuVerb,
GodanMuVerb,
GodanNuVerb,
GodanRuVerb,
IrregularGodanRuVerb,
GodanSuVerb,
GodanTsuVerb,
GodanUVerb,
IrregularGodanUVerb,
IntransitiveVerb,
KuruVerb,
IrregularGodanNuVerb,
IrregularGodanRuVerbWithPlainRiForm,
SuruVerb,
SuruPrecursorVerb,
IncludedSuruVerb,
SpecialSuruVerb,
TransitiveVerb,
IchidanZuruVerb,
}
impl Enum for AllPartOfSpeech {
fn code(&self) -> &'static str {
match *self {
AllPartOfSpeech::NounOrVerbActingPrenominally => "adj-f",
AllPartOfSpeech::Adjective => "adj-i",
AllPartOfSpeech::YoiAdjective => "adj-ix",
AllPartOfSpeech::KariAdjective => "adj-kari",
AllPartOfSpeech::KuAdjective => "adj-ku",
AllPartOfSpeech::AdjectivalNoun => "adj-na",
AllPartOfSpeech::NariAdjective => "adj-nari",
AllPartOfSpeech::NoAdjective => "adj-no",
AllPartOfSpeech::PreNounAdjectival => "adj-pn",
AllPartOfSpeech::ShikuAdjective => "adj-shiku",
AllPartOfSpeech::TaruAdjective => "adj-t",
AllPartOfSpeech::Adverb => "adv",
AllPartOfSpeech::AdverbTakingToParticle => "adv-to",
AllPartOfSpeech::Auxiliary => "aux",
AllPartOfSpeech::AuxiliaryAdjective => "aux-adj",
AllPartOfSpeech::AuxiliaryVerb => "aux-v",
AllPartOfSpeech::Conjunction => "conj",
AllPartOfSpeech::Copula => "cop",
AllPartOfSpeech::Counter => "ctr",
AllPartOfSpeech::Expression => "exp",
AllPartOfSpeech::Interjection => "int",
AllPartOfSpeech::CommonNoun => "n",
AllPartOfSpeech::AdverbialNoun => "n-adv",
AllPartOfSpeech::ProperNoun => "n-pr",
AllPartOfSpeech::NounPrefix => "n-pref",
AllPartOfSpeech::NounSuffix => "n-suf",
AllPartOfSpeech::TemporalNoun => "n-t",
AllPartOfSpeech::Numeric => "num",
AllPartOfSpeech::Pronoun => "pn",
AllPartOfSpeech::Prefix => "pref",
AllPartOfSpeech::Particle => "prt",
AllPartOfSpeech::Suffix => "suf",
AllPartOfSpeech::Unclassified => "unc",
AllPartOfSpeech::UnspecifiedVerb => "v-unspec",
AllPartOfSpeech::IchidanVerb => "v1",
AllPartOfSpeech::IchidanKureruVerb => "v1-s",
AllPartOfSpeech::NidanUVerb => "v2a-s",
AllPartOfSpeech::UpperNidanBuVerb => "v2b-k",
AllPartOfSpeech::LowerNidanBuVerb => "v2b-s",
AllPartOfSpeech::UpperNidanDzuVerb => "v2d-k",
AllPartOfSpeech::LowerNidanDzuVerb => "v2d-s",
AllPartOfSpeech::UpperNidanGuVerb => "v2g-k",
AllPartOfSpeech::LowerNidanGuVerb => "v2g-s",
AllPartOfSpeech::UpperNidanFuVerb => "v2h-k",
AllPartOfSpeech::LowerNidanFuVerb => "v2h-s",
AllPartOfSpeech::UpperNidanKuVerb => "v2k-k",
AllPartOfSpeech::LowerNidanKuVerb => "v2k-s",
AllPartOfSpeech::UpperNidanMuVerb => "v2m-k",
AllPartOfSpeech::LowerNidanMuVerb => "v2m-s",
AllPartOfSpeech::LowerNidanNuVerb => "v2n-s",
AllPartOfSpeech::UpperNidanRuVerb => "v2r-k",
AllPartOfSpeech::LowerNidanRuVerb => "v2r-s",
AllPartOfSpeech::LowerNidanSuVerb => "v2s-s",
AllPartOfSpeech::UpperNidanTsuVerb => "v2t-k",
AllPartOfSpeech::LowerNidanTsuVerb => "v2t-s",
AllPartOfSpeech::LowerNidanUWeVerb => "v2w-s",
AllPartOfSpeech::UpperNidanYuVerb => "v2y-k",
AllPartOfSpeech::LowerNidanYuVerb => "v2y-s",
AllPartOfSpeech::LowerNidanZuVerb => "v2z-s",
AllPartOfSpeech::YodanBuVerb => "v4b",
AllPartOfSpeech::YodanGuVerb => "v4g",
AllPartOfSpeech::YodanFuVerb => "v4h",
AllPartOfSpeech::YodanKuVerb => "v4k",
AllPartOfSpeech::YodanMuVerb => "v4m",
AllPartOfSpeech::YodanNuVerb => "v4n",
AllPartOfSpeech::YodanRuVerb => "v4r",
AllPartOfSpeech::YodanSuVerb => "v4s",
AllPartOfSpeech::YodanTsuVerb => "v4t",
AllPartOfSpeech::GodanAruVerb => "v5aru",
AllPartOfSpeech::GodanBuVerb => "v5b",
AllPartOfSpeech::GodanGuVerb => "v5g",
AllPartOfSpeech::GodanKuVerb => "v5k",
AllPartOfSpeech::GodanIkuVerb => "v5k-s",
AllPartOfSpeech::GodanMuVerb => "v5m",
AllPartOfSpeech::GodanNuVerb => "v5n",
AllPartOfSpeech::GodanRuVerb => "v5r",
AllPartOfSpeech::IrregularGodanRuVerb => "v5r-i",
AllPartOfSpeech::GodanSuVerb => "v5s",
AllPartOfSpeech::GodanTsuVerb => "v5t",
AllPartOfSpeech::GodanUVerb => "v5u",
AllPartOfSpeech::IrregularGodanUVerb => "v5u-s",
AllPartOfSpeech::IntransitiveVerb => "vi",
AllPartOfSpeech::KuruVerb => "vk",
AllPartOfSpeech::IrregularGodanNuVerb => "vn",
AllPartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => "vr",
AllPartOfSpeech::SuruVerb => "vs",
AllPartOfSpeech::SuruPrecursorVerb => "vs-c",
AllPartOfSpeech::IncludedSuruVerb => "vs-i",
AllPartOfSpeech::SpecialSuruVerb => "vs-s",
AllPartOfSpeech::TransitiveVerb => "vt",
AllPartOfSpeech::IchidanZuruVerb => "vz",
}
}
fn constant_name(&self) -> &'static str {
match *self {
AllPartOfSpeech::NounOrVerbActingPrenominally => "NounOrVerbActingPrenominally",
AllPartOfSpeech::Adjective => "Adjective",
AllPartOfSpeech::YoiAdjective => "YoiAdjective",
AllPartOfSpeech::KariAdjective => "KariAdjective",
AllPartOfSpeech::KuAdjective => "KuAdjective",
AllPartOfSpeech::AdjectivalNoun => "AdjectivalNoun",
AllPartOfSpeech::NariAdjective => "NariAdjective",
AllPartOfSpeech::NoAdjective => "NoAdjective",
AllPartOfSpeech::PreNounAdjectival => "PreNounAdjectival",
AllPartOfSpeech::ShikuAdjective => "ShikuAdjective",
AllPartOfSpeech::TaruAdjective => "TaruAdjective",
AllPartOfSpeech::Adverb => "Adverb",
AllPartOfSpeech::AdverbTakingToParticle => "AdverbTakingToParticle",
AllPartOfSpeech::Auxiliary => "Auxiliary",
AllPartOfSpeech::AuxiliaryAdjective => "AuxiliaryAdjective",
AllPartOfSpeech::AuxiliaryVerb => "AuxiliaryVerb",
AllPartOfSpeech::Conjunction => "Conjunction",
AllPartOfSpeech::Copula => "Copula",
AllPartOfSpeech::Counter => "Counter",
AllPartOfSpeech::Expression => "Expression",
AllPartOfSpeech::Interjection => "Interjection",
AllPartOfSpeech::CommonNoun => "CommonNoun",
AllPartOfSpeech::AdverbialNoun => "AdverbialNoun",
AllPartOfSpeech::ProperNoun => "ProperNoun",
AllPartOfSpeech::NounPrefix => "NounPrefix",
AllPartOfSpeech::NounSuffix => "NounSuffix",
AllPartOfSpeech::TemporalNoun => "TemporalNoun",
AllPartOfSpeech::Numeric => "Numeric",
AllPartOfSpeech::Pronoun => "Pronoun",
AllPartOfSpeech::Prefix => "Prefix",
AllPartOfSpeech::Particle => "Particle",
AllPartOfSpeech::Suffix => "Suffix",
AllPartOfSpeech::Unclassified => "Unclassified",
AllPartOfSpeech::UnspecifiedVerb => "UnspecifiedVerb",
AllPartOfSpeech::IchidanVerb => "IchidanVerb",
AllPartOfSpeech::IchidanKureruVerb => "IchidanKureruVerb",
AllPartOfSpeech::NidanUVerb => "NidanUVerb",
AllPartOfSpeech::UpperNidanBuVerb => "UpperNidanBuVerb",
AllPartOfSpeech::LowerNidanBuVerb => "LowerNidanBuVerb",
AllPartOfSpeech::UpperNidanDzuVerb => "UpperNidanDzuVerb",
AllPartOfSpeech::LowerNidanDzuVerb => "LowerNidanDzuVerb",
AllPartOfSpeech::UpperNidanGuVerb => "UpperNidanGuVerb",
AllPartOfSpeech::LowerNidanGuVerb => "LowerNidanGuVerb",
AllPartOfSpeech::UpperNidanFuVerb => "UpperNidanFuVerb",
AllPartOfSpeech::LowerNidanFuVerb => "LowerNidanFuVerb",
AllPartOfSpeech::UpperNidanKuVerb => "UpperNidanKuVerb",
AllPartOfSpeech::LowerNidanKuVerb => "LowerNidanKuVerb",
AllPartOfSpeech::UpperNidanMuVerb => "UpperNidanMuVerb",
AllPartOfSpeech::LowerNidanMuVerb => "LowerNidanMuVerb",
AllPartOfSpeech::LowerNidanNuVerb => "LowerNidanNuVerb",
AllPartOfSpeech::UpperNidanRuVerb => "UpperNidanRuVerb",
AllPartOfSpeech::LowerNidanRuVerb => "LowerNidanRuVerb",
AllPartOfSpeech::LowerNidanSuVerb => "LowerNidanSuVerb",
AllPartOfSpeech::UpperNidanTsuVerb => "UpperNidanTsuVerb",
AllPartOfSpeech::LowerNidanTsuVerb => "LowerNidanTsuVerb",
AllPartOfSpeech::LowerNidanUWeVerb => "LowerNidanUWeVerb",
AllPartOfSpeech::UpperNidanYuVerb => "UpperNidanYuVerb",
AllPartOfSpeech::LowerNidanYuVerb => "LowerNidanYuVerb",
AllPartOfSpeech::LowerNidanZuVerb => "LowerNidanZuVerb",
AllPartOfSpeech::YodanBuVerb => "YodanBuVerb",
AllPartOfSpeech::YodanGuVerb => "YodanGuVerb",
AllPartOfSpeech::YodanFuVerb => "YodanFuVerb",
AllPartOfSpeech::YodanKuVerb => "YodanKuVerb",
AllPartOfSpeech::YodanMuVerb => "YodanMuVerb",
AllPartOfSpeech::YodanNuVerb => "YodanNuVerb",
AllPartOfSpeech::YodanRuVerb => "YodanRuVerb",
AllPartOfSpeech::YodanSuVerb => "YodanSuVerb",
AllPartOfSpeech::YodanTsuVerb => "YodanTsuVerb",
AllPartOfSpeech::GodanAruVerb => "GodanAruVerb",
AllPartOfSpeech::GodanBuVerb => "GodanBuVerb",
AllPartOfSpeech::GodanGuVerb => "GodanGuVerb",
AllPartOfSpeech::GodanKuVerb => "GodanKuVerb",
AllPartOfSpeech::GodanIkuVerb => "GodanIkuVerb",
AllPartOfSpeech::GodanMuVerb => "GodanMuVerb",
AllPartOfSpeech::GodanNuVerb => "GodanNuVerb",
AllPartOfSpeech::GodanRuVerb => "GodanRuVerb",
AllPartOfSpeech::IrregularGodanRuVerb => "IrregularGodanRuVerb",
AllPartOfSpeech::GodanSuVerb => "GodanSuVerb",
AllPartOfSpeech::GodanTsuVerb => "GodanTsuVerb",
AllPartOfSpeech::GodanUVerb => "GodanUVerb",
AllPartOfSpeech::IrregularGodanUVerb => "IrregularGodanUVerb",
AllPartOfSpeech::IntransitiveVerb => "IntransitiveVerb",
AllPartOfSpeech::KuruVerb => "KuruVerb",
AllPartOfSpeech::IrregularGodanNuVerb => "IrregularGodanNuVerb",
AllPartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => "IrregularGodanRuVerbWithPlainRiForm",
AllPartOfSpeech::SuruVerb => "SuruVerb",
AllPartOfSpeech::SuruPrecursorVerb => "SuruPrecursorVerb",
AllPartOfSpeech::IncludedSuruVerb => "IncludedSuruVerb",
AllPartOfSpeech::SpecialSuruVerb => "SpecialSuruVerb",
AllPartOfSpeech::TransitiveVerb => "TransitiveVerb",
AllPartOfSpeech::IchidanZuruVerb => "IchidanZuruVerb",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"adj-f" => Some(AllPartOfSpeech::NounOrVerbActingPrenominally),
"adj-i" => Some(AllPartOfSpeech::Adjective),
"adj-ix" => Some(AllPartOfSpeech::YoiAdjective),
"adj-kari" => Some(AllPartOfSpeech::KariAdjective),
"adj-ku" => Some(AllPartOfSpeech::KuAdjective),
"adj-na" => Some(AllPartOfSpeech::AdjectivalNoun),
"adj-nari" => Some(AllPartOfSpeech::NariAdjective),
"adj-no" => Some(AllPartOfSpeech::NoAdjective),
"adj-pn" => Some(AllPartOfSpeech::PreNounAdjectival),
"adj-shiku" => Some(AllPartOfSpeech::ShikuAdjective),
"adj-t" => Some(AllPartOfSpeech::TaruAdjective),
"adv" => Some(AllPartOfSpeech::Adverb),
"adv-to" => Some(AllPartOfSpeech::AdverbTakingToParticle),
"aux" => Some(AllPartOfSpeech::Auxiliary),
"aux-adj" => Some(AllPartOfSpeech::AuxiliaryAdjective),
"aux-v" => Some(AllPartOfSpeech::AuxiliaryVerb),
"conj" => Some(AllPartOfSpeech::Conjunction),
"cop" => Some(AllPartOfSpeech::Copula),
"ctr" => Some(AllPartOfSpeech::Counter),
"exp" => Some(AllPartOfSpeech::Expression),
"int" => Some(AllPartOfSpeech::Interjection),
"n" => Some(AllPartOfSpeech::CommonNoun),
"n-adv" => Some(AllPartOfSpeech::AdverbialNoun),
"n-pr" => Some(AllPartOfSpeech::ProperNoun),
"n-pref" => Some(AllPartOfSpeech::NounPrefix),
"n-suf" => Some(AllPartOfSpeech::NounSuffix),
"n-t" => Some(AllPartOfSpeech::TemporalNoun),
"num" => Some(AllPartOfSpeech::Numeric),
"pn" => Some(AllPartOfSpeech::Pronoun),
"pref" => Some(AllPartOfSpeech::Prefix),
"prt" => Some(AllPartOfSpeech::Particle),
"suf" => Some(AllPartOfSpeech::Suffix),
"unc" => Some(AllPartOfSpeech::Unclassified),
"v-unspec" => Some(AllPartOfSpeech::UnspecifiedVerb),
"v1" => Some(AllPartOfSpeech::IchidanVerb),
"v1-s" => Some(AllPartOfSpeech::IchidanKureruVerb),
"v2a-s" => Some(AllPartOfSpeech::NidanUVerb),
"v2b-k" => Some(AllPartOfSpeech::UpperNidanBuVerb),
"v2b-s" => Some(AllPartOfSpeech::LowerNidanBuVerb),
"v2d-k" => Some(AllPartOfSpeech::UpperNidanDzuVerb),
"v2d-s" => Some(AllPartOfSpeech::LowerNidanDzuVerb),
"v2g-k" => Some(AllPartOfSpeech::UpperNidanGuVerb),
"v2g-s" => Some(AllPartOfSpeech::LowerNidanGuVerb),
"v2h-k" => Some(AllPartOfSpeech::UpperNidanFuVerb),
"v2h-s" => Some(AllPartOfSpeech::LowerNidanFuVerb),
"v2k-k" => Some(AllPartOfSpeech::UpperNidanKuVerb),
"v2k-s" => Some(AllPartOfSpeech::LowerNidanKuVerb),
"v2m-k" => Some(AllPartOfSpeech::UpperNidanMuVerb),
"v2m-s" => Some(AllPartOfSpeech::LowerNidanMuVerb),
"v2n-s" => Some(AllPartOfSpeech::LowerNidanNuVerb),
"v2r-k" => Some(AllPartOfSpeech::UpperNidanRuVerb),
"v2r-s" => Some(AllPartOfSpeech::LowerNidanRuVerb),
"v2s-s" => Some(AllPartOfSpeech::LowerNidanSuVerb),
"v2t-k" => Some(AllPartOfSpeech::UpperNidanTsuVerb),
"v2t-s" => Some(AllPartOfSpeech::LowerNidanTsuVerb),
"v2w-s" => Some(AllPartOfSpeech::LowerNidanUWeVerb),
"v2y-k" => Some(AllPartOfSpeech::UpperNidanYuVerb),
"v2y-s" => Some(AllPartOfSpeech::LowerNidanYuVerb),
"v2z-s" => Some(AllPartOfSpeech::LowerNidanZuVerb),
"v4b" => Some(AllPartOfSpeech::YodanBuVerb),
"v4g" => Some(AllPartOfSpeech::YodanGuVerb),
"v4h" => Some(AllPartOfSpeech::YodanFuVerb),
"v4k" => Some(AllPartOfSpeech::YodanKuVerb),
"v4m" => Some(AllPartOfSpeech::YodanMuVerb),
"v4n" => Some(AllPartOfSpeech::YodanNuVerb),
"v4r" => Some(AllPartOfSpeech::YodanRuVerb),
"v4s" => Some(AllPartOfSpeech::YodanSuVerb),
"v4t" => Some(AllPartOfSpeech::YodanTsuVerb),
"v5aru" => Some(AllPartOfSpeech::GodanAruVerb),
"v5b" => Some(AllPartOfSpeech::GodanBuVerb),
"v5g" => Some(AllPartOfSpeech::GodanGuVerb),
"v5k" => Some(AllPartOfSpeech::GodanKuVerb),
"v5k-s" => Some(AllPartOfSpeech::GodanIkuVerb),
"v5m" => Some(AllPartOfSpeech::GodanMuVerb),
"v5n" => Some(AllPartOfSpeech::GodanNuVerb),
"v5r" => Some(AllPartOfSpeech::GodanRuVerb),
"v5r-i" => Some(AllPartOfSpeech::IrregularGodanRuVerb),
"v5s" => Some(AllPartOfSpeech::GodanSuVerb),
"v5t" => Some(AllPartOfSpeech::GodanTsuVerb),
"v5u" => Some(AllPartOfSpeech::GodanUVerb),
"v5u-s" => Some(AllPartOfSpeech::IrregularGodanUVerb),
"vi" => Some(AllPartOfSpeech::IntransitiveVerb),
"vk" => Some(AllPartOfSpeech::KuruVerb),
"vn" => Some(AllPartOfSpeech::IrregularGodanNuVerb),
"vr" => Some(AllPartOfSpeech::IrregularGodanRuVerbWithPlainRiForm),
"vs" => Some(AllPartOfSpeech::SuruVerb),
"vs-c" => Some(AllPartOfSpeech::SuruPrecursorVerb),
"vs-i" => Some(AllPartOfSpeech::IncludedSuruVerb),
"vs-s" => Some(AllPartOfSpeech::SpecialSuruVerb),
"vt" => Some(AllPartOfSpeech::TransitiveVerb),
"vz" => Some(AllPartOfSpeech::IchidanZuruVerb),
_ => None,
}
}
}
impl std::fmt::Display for AllPartOfSpeech {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for AllPartOfSpeech {
fn to_u32(&self) -> u32 {
match *self {
AllPartOfSpeech::NounOrVerbActingPrenominally => 0,
AllPartOfSpeech::Adjective => 1,
AllPartOfSpeech::YoiAdjective => 2,
AllPartOfSpeech::KariAdjective => 3,
AllPartOfSpeech::KuAdjective => 4,
AllPartOfSpeech::AdjectivalNoun => 5,
AllPartOfSpeech::NariAdjective => 6,
AllPartOfSpeech::NoAdjective => 7,
AllPartOfSpeech::PreNounAdjectival => 8,
AllPartOfSpeech::ShikuAdjective => 9,
AllPartOfSpeech::TaruAdjective => 10,
AllPartOfSpeech::Adverb => 11,
AllPartOfSpeech::AdverbTakingToParticle => 12,
AllPartOfSpeech::Auxiliary => 13,
AllPartOfSpeech::AuxiliaryAdjective => 14,
AllPartOfSpeech::AuxiliaryVerb => 15,
AllPartOfSpeech::Conjunction => 16,
AllPartOfSpeech::Copula => 17,
AllPartOfSpeech::Counter => 18,
AllPartOfSpeech::Expression => 19,
AllPartOfSpeech::Interjection => 20,
AllPartOfSpeech::CommonNoun => 21,
AllPartOfSpeech::AdverbialNoun => 22,
AllPartOfSpeech::ProperNoun => 23,
AllPartOfSpeech::NounPrefix => 24,
AllPartOfSpeech::NounSuffix => 25,
AllPartOfSpeech::TemporalNoun => 26,
AllPartOfSpeech::Numeric => 27,
AllPartOfSpeech::Pronoun => 28,
AllPartOfSpeech::Prefix => 29,
AllPartOfSpeech::Particle => 30,
AllPartOfSpeech::Suffix => 31,
AllPartOfSpeech::Unclassified => 32,
AllPartOfSpeech::UnspecifiedVerb => 33,
AllPartOfSpeech::IchidanVerb => 34,
AllPartOfSpeech::IchidanKureruVerb => 35,
AllPartOfSpeech::NidanUVerb => 36,
AllPartOfSpeech::UpperNidanBuVerb => 37,
AllPartOfSpeech::LowerNidanBuVerb => 38,
AllPartOfSpeech::UpperNidanDzuVerb => 39,
AllPartOfSpeech::LowerNidanDzuVerb => 40,
AllPartOfSpeech::UpperNidanGuVerb => 41,
AllPartOfSpeech::LowerNidanGuVerb => 42,
AllPartOfSpeech::UpperNidanFuVerb => 43,
AllPartOfSpeech::LowerNidanFuVerb => 44,
AllPartOfSpeech::UpperNidanKuVerb => 45,
AllPartOfSpeech::LowerNidanKuVerb => 46,
AllPartOfSpeech::UpperNidanMuVerb => 47,
AllPartOfSpeech::LowerNidanMuVerb => 48,
AllPartOfSpeech::LowerNidanNuVerb => 49,
AllPartOfSpeech::UpperNidanRuVerb => 50,
AllPartOfSpeech::LowerNidanRuVerb => 51,
AllPartOfSpeech::LowerNidanSuVerb => 52,
AllPartOfSpeech::UpperNidanTsuVerb => 53,
AllPartOfSpeech::LowerNidanTsuVerb => 54,
AllPartOfSpeech::LowerNidanUWeVerb => 55,
AllPartOfSpeech::UpperNidanYuVerb => 56,
AllPartOfSpeech::LowerNidanYuVerb => 57,
AllPartOfSpeech::LowerNidanZuVerb => 58,
AllPartOfSpeech::YodanBuVerb => 59,
AllPartOfSpeech::YodanGuVerb => 60,
AllPartOfSpeech::YodanFuVerb => 61,
AllPartOfSpeech::YodanKuVerb => 62,
AllPartOfSpeech::YodanMuVerb => 63,
AllPartOfSpeech::YodanNuVerb => 64,
AllPartOfSpeech::YodanRuVerb => 65,
AllPartOfSpeech::YodanSuVerb => 66,
AllPartOfSpeech::YodanTsuVerb => 67,
AllPartOfSpeech::GodanAruVerb => 68,
AllPartOfSpeech::GodanBuVerb => 69,
AllPartOfSpeech::GodanGuVerb => 70,
AllPartOfSpeech::GodanKuVerb => 71,
AllPartOfSpeech::GodanIkuVerb => 72,
AllPartOfSpeech::GodanMuVerb => 73,
AllPartOfSpeech::GodanNuVerb => 74,
AllPartOfSpeech::GodanRuVerb => 75,
AllPartOfSpeech::IrregularGodanRuVerb => 76,
AllPartOfSpeech::GodanSuVerb => 77,
AllPartOfSpeech::GodanTsuVerb => 78,
AllPartOfSpeech::GodanUVerb => 79,
AllPartOfSpeech::IrregularGodanUVerb => 80,
AllPartOfSpeech::IntransitiveVerb => 81,
AllPartOfSpeech::KuruVerb => 82,
AllPartOfSpeech::IrregularGodanNuVerb => 83,
AllPartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => 84,
AllPartOfSpeech::SuruVerb => 85,
AllPartOfSpeech::SuruPrecursorVerb => 86,
AllPartOfSpeech::IncludedSuruVerb => 87,
AllPartOfSpeech::SpecialSuruVerb => 88,
AllPartOfSpeech::TransitiveVerb => 89,
AllPartOfSpeech::IchidanZuruVerb => 90,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => AllPartOfSpeech::NounOrVerbActingPrenominally,
1 => AllPartOfSpeech::Adjective,
2 => AllPartOfSpeech::YoiAdjective,
3 => AllPartOfSpeech::KariAdjective,
4 => AllPartOfSpeech::KuAdjective,
5 => AllPartOfSpeech::AdjectivalNoun,
6 => AllPartOfSpeech::NariAdjective,
7 => AllPartOfSpeech::NoAdjective,
8 => AllPartOfSpeech::PreNounAdjectival,
9 => AllPartOfSpeech::ShikuAdjective,
10 => AllPartOfSpeech::TaruAdjective,
11 => AllPartOfSpeech::Adverb,
12 => AllPartOfSpeech::AdverbTakingToParticle,
13 => AllPartOfSpeech::Auxiliary,
14 => AllPartOfSpeech::AuxiliaryAdjective,
15 => AllPartOfSpeech::AuxiliaryVerb,
16 => AllPartOfSpeech::Conjunction,
17 => AllPartOfSpeech::Copula,
18 => AllPartOfSpeech::Counter,
19 => AllPartOfSpeech::Expression,
20 => AllPartOfSpeech::Interjection,
21 => AllPartOfSpeech::CommonNoun,
22 => AllPartOfSpeech::AdverbialNoun,
23 => AllPartOfSpeech::ProperNoun,
24 => AllPartOfSpeech::NounPrefix,
25 => AllPartOfSpeech::NounSuffix,
26 => AllPartOfSpeech::TemporalNoun,
27 => AllPartOfSpeech::Numeric,
28 => AllPartOfSpeech::Pronoun,
29 => AllPartOfSpeech::Prefix,
30 => AllPartOfSpeech::Particle,
31 => AllPartOfSpeech::Suffix,
32 => AllPartOfSpeech::Unclassified,
33 => AllPartOfSpeech::UnspecifiedVerb,
34 => AllPartOfSpeech::IchidanVerb,
35 => AllPartOfSpeech::IchidanKureruVerb,
36 => AllPartOfSpeech::NidanUVerb,
37 => AllPartOfSpeech::UpperNidanBuVerb,
38 => AllPartOfSpeech::LowerNidanBuVerb,
39 => AllPartOfSpeech::UpperNidanDzuVerb,
40 => AllPartOfSpeech::LowerNidanDzuVerb,
41 => AllPartOfSpeech::UpperNidanGuVerb,
42 => AllPartOfSpeech::LowerNidanGuVerb,
43 => AllPartOfSpeech::UpperNidanFuVerb,
44 => AllPartOfSpeech::LowerNidanFuVerb,
45 => AllPartOfSpeech::UpperNidanKuVerb,
46 => AllPartOfSpeech::LowerNidanKuVerb,
47 => AllPartOfSpeech::UpperNidanMuVerb,
48 => AllPartOfSpeech::LowerNidanMuVerb,
49 => AllPartOfSpeech::LowerNidanNuVerb,
50 => AllPartOfSpeech::UpperNidanRuVerb,
51 => AllPartOfSpeech::LowerNidanRuVerb,
52 => AllPartOfSpeech::LowerNidanSuVerb,
53 => AllPartOfSpeech::UpperNidanTsuVerb,
54 => AllPartOfSpeech::LowerNidanTsuVerb,
55 => AllPartOfSpeech::LowerNidanUWeVerb,
56 => AllPartOfSpeech::UpperNidanYuVerb,
57 => AllPartOfSpeech::LowerNidanYuVerb,
58 => AllPartOfSpeech::LowerNidanZuVerb,
59 => AllPartOfSpeech::YodanBuVerb,
60 => AllPartOfSpeech::YodanGuVerb,
61 => AllPartOfSpeech::YodanFuVerb,
62 => AllPartOfSpeech::YodanKuVerb,
63 => AllPartOfSpeech::YodanMuVerb,
64 => AllPartOfSpeech::YodanNuVerb,
65 => AllPartOfSpeech::YodanRuVerb,
66 => AllPartOfSpeech::YodanSuVerb,
67 => AllPartOfSpeech::YodanTsuVerb,
68 => AllPartOfSpeech::GodanAruVerb,
69 => AllPartOfSpeech::GodanBuVerb,
70 => AllPartOfSpeech::GodanGuVerb,
71 => AllPartOfSpeech::GodanKuVerb,
72 => AllPartOfSpeech::GodanIkuVerb,
73 => AllPartOfSpeech::GodanMuVerb,
74 => AllPartOfSpeech::GodanNuVerb,
75 => AllPartOfSpeech::GodanRuVerb,
76 => AllPartOfSpeech::IrregularGodanRuVerb,
77 => AllPartOfSpeech::GodanSuVerb,
78 => AllPartOfSpeech::GodanTsuVerb,
79 => AllPartOfSpeech::GodanUVerb,
80 => AllPartOfSpeech::IrregularGodanUVerb,
81 => AllPartOfSpeech::IntransitiveVerb,
82 => AllPartOfSpeech::KuruVerb,
83 => AllPartOfSpeech::IrregularGodanNuVerb,
84 => AllPartOfSpeech::IrregularGodanRuVerbWithPlainRiForm,
85 => AllPartOfSpeech::SuruVerb,
86 => AllPartOfSpeech::SuruPrecursorVerb,
87 => AllPartOfSpeech::IncludedSuruVerb,
88 => AllPartOfSpeech::SpecialSuruVerb,
89 => AllPartOfSpeech::TransitiveVerb,
90 => AllPartOfSpeech::IchidanZuruVerb,
_ => panic!("unknown AllPartOfSpeech code: {}", code),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum PartOfSpeech {
NounOrVerbActingPrenominally,
Adjective,
YoiAdjective,
AdjectivalNoun,
NoAdjective,
PreNounAdjectival,
TaruAdjective,
Adverb,
AdverbTakingToParticle,
Auxiliary,
AuxiliaryAdjective,
AuxiliaryVerb,
Conjunction,
Copula,
Counter,
Expression,
Interjection,
CommonNoun,
AdverbialNoun,
ProperNoun,
NounPrefix,
NounSuffix,
TemporalNoun,
Numeric,
Pronoun,
Prefix,
Particle,
Suffix,
Unclassified,
UnspecifiedVerb,
IchidanVerb,
IchidanKureruVerb,
GodanAruVerb,
GodanBuVerb,
GodanGuVerb,
GodanKuVerb,
GodanIkuVerb,
GodanMuVerb,
GodanNuVerb,
GodanRuVerb,
IrregularGodanRuVerb,
GodanSuVerb,
GodanTsuVerb,
GodanUVerb,
IrregularGodanUVerb,
IntransitiveVerb,
KuruVerb,
IrregularGodanNuVerb,
IrregularGodanRuVerbWithPlainRiForm,
SuruVerb,
SuruPrecursorVerb,
IncludedSuruVerb,
SpecialSuruVerb,
TransitiveVerb,
IchidanZuruVerb,
}
impl Enum for PartOfSpeech {
fn code(&self) -> &'static str {
match *self {
PartOfSpeech::NounOrVerbActingPrenominally => "adj-f",
PartOfSpeech::Adjective => "adj-i",
PartOfSpeech::YoiAdjective => "adj-ix",
PartOfSpeech::AdjectivalNoun => "adj-na",
PartOfSpeech::NoAdjective => "adj-no",
PartOfSpeech::PreNounAdjectival => "adj-pn",
PartOfSpeech::TaruAdjective => "adj-t",
PartOfSpeech::Adverb => "adv",
PartOfSpeech::AdverbTakingToParticle => "adv-to",
PartOfSpeech::Auxiliary => "aux",
PartOfSpeech::AuxiliaryAdjective => "aux-adj",
PartOfSpeech::AuxiliaryVerb => "aux-v",
PartOfSpeech::Conjunction => "conj",
PartOfSpeech::Copula => "cop",
PartOfSpeech::Counter => "ctr",
PartOfSpeech::Expression => "exp",
PartOfSpeech::Interjection => "int",
PartOfSpeech::CommonNoun => "n",
PartOfSpeech::AdverbialNoun => "n-adv",
PartOfSpeech::ProperNoun => "n-pr",
PartOfSpeech::NounPrefix => "n-pref",
PartOfSpeech::NounSuffix => "n-suf",
PartOfSpeech::TemporalNoun => "n-t",
PartOfSpeech::Numeric => "num",
PartOfSpeech::Pronoun => "pn",
PartOfSpeech::Prefix => "pref",
PartOfSpeech::Particle => "prt",
PartOfSpeech::Suffix => "suf",
PartOfSpeech::Unclassified => "unc",
PartOfSpeech::UnspecifiedVerb => "v-unspec",
PartOfSpeech::IchidanVerb => "v1",
PartOfSpeech::IchidanKureruVerb => "v1-s",
PartOfSpeech::GodanAruVerb => "v5aru",
PartOfSpeech::GodanBuVerb => "v5b",
PartOfSpeech::GodanGuVerb => "v5g",
PartOfSpeech::GodanKuVerb => "v5k",
PartOfSpeech::GodanIkuVerb => "v5k-s",
PartOfSpeech::GodanMuVerb => "v5m",
PartOfSpeech::GodanNuVerb => "v5n",
PartOfSpeech::GodanRuVerb => "v5r",
PartOfSpeech::IrregularGodanRuVerb => "v5r-i",
PartOfSpeech::GodanSuVerb => "v5s",
PartOfSpeech::GodanTsuVerb => "v5t",
PartOfSpeech::GodanUVerb => "v5u",
PartOfSpeech::IrregularGodanUVerb => "v5u-s",
PartOfSpeech::IntransitiveVerb => "vi",
PartOfSpeech::KuruVerb => "vk",
PartOfSpeech::IrregularGodanNuVerb => "vn",
PartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => "vr",
PartOfSpeech::SuruVerb => "vs",
PartOfSpeech::SuruPrecursorVerb => "vs-c",
PartOfSpeech::IncludedSuruVerb => "vs-i",
PartOfSpeech::SpecialSuruVerb => "vs-s",
PartOfSpeech::TransitiveVerb => "vt",
PartOfSpeech::IchidanZuruVerb => "vz",
}
}
fn constant_name(&self) -> &'static str {
match *self {
PartOfSpeech::NounOrVerbActingPrenominally => "NounOrVerbActingPrenominally",
PartOfSpeech::Adjective => "Adjective",
PartOfSpeech::YoiAdjective => "YoiAdjective",
PartOfSpeech::AdjectivalNoun => "AdjectivalNoun",
PartOfSpeech::NoAdjective => "NoAdjective",
PartOfSpeech::PreNounAdjectival => "PreNounAdjectival",
PartOfSpeech::TaruAdjective => "TaruAdjective",
PartOfSpeech::Adverb => "Adverb",
PartOfSpeech::AdverbTakingToParticle => "AdverbTakingToParticle",
PartOfSpeech::Auxiliary => "Auxiliary",
PartOfSpeech::AuxiliaryAdjective => "AuxiliaryAdjective",
PartOfSpeech::AuxiliaryVerb => "AuxiliaryVerb",
PartOfSpeech::Conjunction => "Conjunction",
PartOfSpeech::Copula => "Copula",
PartOfSpeech::Counter => "Counter",
PartOfSpeech::Expression => "Expression",
PartOfSpeech::Interjection => "Interjection",
PartOfSpeech::CommonNoun => "CommonNoun",
PartOfSpeech::AdverbialNoun => "AdverbialNoun",
PartOfSpeech::ProperNoun => "ProperNoun",
PartOfSpeech::NounPrefix => "NounPrefix",
PartOfSpeech::NounSuffix => "NounSuffix",
PartOfSpeech::TemporalNoun => "TemporalNoun",
PartOfSpeech::Numeric => "Numeric",
PartOfSpeech::Pronoun => "Pronoun",
PartOfSpeech::Prefix => "Prefix",
PartOfSpeech::Particle => "Particle",
PartOfSpeech::Suffix => "Suffix",
PartOfSpeech::Unclassified => "Unclassified",
PartOfSpeech::UnspecifiedVerb => "UnspecifiedVerb",
PartOfSpeech::IchidanVerb => "IchidanVerb",
PartOfSpeech::IchidanKureruVerb => "IchidanKureruVerb",
PartOfSpeech::GodanAruVerb => "GodanAruVerb",
PartOfSpeech::GodanBuVerb => "GodanBuVerb",
PartOfSpeech::GodanGuVerb => "GodanGuVerb",
PartOfSpeech::GodanKuVerb => "GodanKuVerb",
PartOfSpeech::GodanIkuVerb => "GodanIkuVerb",
PartOfSpeech::GodanMuVerb => "GodanMuVerb",
PartOfSpeech::GodanNuVerb => "GodanNuVerb",
PartOfSpeech::GodanRuVerb => "GodanRuVerb",
PartOfSpeech::IrregularGodanRuVerb => "IrregularGodanRuVerb",
PartOfSpeech::GodanSuVerb => "GodanSuVerb",
PartOfSpeech::GodanTsuVerb => "GodanTsuVerb",
PartOfSpeech::GodanUVerb => "GodanUVerb",
PartOfSpeech::IrregularGodanUVerb => "IrregularGodanUVerb",
PartOfSpeech::IntransitiveVerb => "IntransitiveVerb",
PartOfSpeech::KuruVerb => "KuruVerb",
PartOfSpeech::IrregularGodanNuVerb => "IrregularGodanNuVerb",
PartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => "IrregularGodanRuVerbWithPlainRiForm",
PartOfSpeech::SuruVerb => "SuruVerb",
PartOfSpeech::SuruPrecursorVerb => "SuruPrecursorVerb",
PartOfSpeech::IncludedSuruVerb => "IncludedSuruVerb",
PartOfSpeech::SpecialSuruVerb => "SpecialSuruVerb",
PartOfSpeech::TransitiveVerb => "TransitiveVerb",
PartOfSpeech::IchidanZuruVerb => "IchidanZuruVerb",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"adj-f" => Some(PartOfSpeech::NounOrVerbActingPrenominally),
"adj-i" => Some(PartOfSpeech::Adjective),
"adj-ix" => Some(PartOfSpeech::YoiAdjective),
"adj-na" => Some(PartOfSpeech::AdjectivalNoun),
"adj-no" => Some(PartOfSpeech::NoAdjective),
"adj-pn" => Some(PartOfSpeech::PreNounAdjectival),
"adj-t" => Some(PartOfSpeech::TaruAdjective),
"adv" => Some(PartOfSpeech::Adverb),
"adv-to" => Some(PartOfSpeech::AdverbTakingToParticle),
"aux" => Some(PartOfSpeech::Auxiliary),
"aux-adj" => Some(PartOfSpeech::AuxiliaryAdjective),
"aux-v" => Some(PartOfSpeech::AuxiliaryVerb),
"conj" => Some(PartOfSpeech::Conjunction),
"cop" => Some(PartOfSpeech::Copula),
"ctr" => Some(PartOfSpeech::Counter),
"exp" => Some(PartOfSpeech::Expression),
"int" => Some(PartOfSpeech::Interjection),
"n" => Some(PartOfSpeech::CommonNoun),
"n-adv" => Some(PartOfSpeech::AdverbialNoun),
"n-pr" => Some(PartOfSpeech::ProperNoun),
"n-pref" => Some(PartOfSpeech::NounPrefix),
"n-suf" => Some(PartOfSpeech::NounSuffix),
"n-t" => Some(PartOfSpeech::TemporalNoun),
"num" => Some(PartOfSpeech::Numeric),
"pn" => Some(PartOfSpeech::Pronoun),
"pref" => Some(PartOfSpeech::Prefix),
"prt" => Some(PartOfSpeech::Particle),
"suf" => Some(PartOfSpeech::Suffix),
"unc" => Some(PartOfSpeech::Unclassified),
"v-unspec" => Some(PartOfSpeech::UnspecifiedVerb),
"v1" => Some(PartOfSpeech::IchidanVerb),
"v1-s" => Some(PartOfSpeech::IchidanKureruVerb),
"v5aru" => Some(PartOfSpeech::GodanAruVerb),
"v5b" => Some(PartOfSpeech::GodanBuVerb),
"v5g" => Some(PartOfSpeech::GodanGuVerb),
"v5k" => Some(PartOfSpeech::GodanKuVerb),
"v5k-s" => Some(PartOfSpeech::GodanIkuVerb),
"v5m" => Some(PartOfSpeech::GodanMuVerb),
"v5n" => Some(PartOfSpeech::GodanNuVerb),
"v5r" => Some(PartOfSpeech::GodanRuVerb),
"v5r-i" => Some(PartOfSpeech::IrregularGodanRuVerb),
"v5s" => Some(PartOfSpeech::GodanSuVerb),
"v5t" => Some(PartOfSpeech::GodanTsuVerb),
"v5u" => Some(PartOfSpeech::GodanUVerb),
"v5u-s" => Some(PartOfSpeech::IrregularGodanUVerb),
"vi" => Some(PartOfSpeech::IntransitiveVerb),
"vk" => Some(PartOfSpeech::KuruVerb),
"vn" => Some(PartOfSpeech::IrregularGodanNuVerb),
"vr" => Some(PartOfSpeech::IrregularGodanRuVerbWithPlainRiForm),
"vs" => Some(PartOfSpeech::SuruVerb),
"vs-c" => Some(PartOfSpeech::SuruPrecursorVerb),
"vs-i" => Some(PartOfSpeech::IncludedSuruVerb),
"vs-s" => Some(PartOfSpeech::SpecialSuruVerb),
"vt" => Some(PartOfSpeech::TransitiveVerb),
"vz" => Some(PartOfSpeech::IchidanZuruVerb),
_ => None,
}
}
}
impl std::fmt::Display for PartOfSpeech {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for PartOfSpeech {
fn to_u32(&self) -> u32 {
match *self {
PartOfSpeech::NounOrVerbActingPrenominally => 0,
PartOfSpeech::Adjective => 1,
PartOfSpeech::YoiAdjective => 2,
PartOfSpeech::AdjectivalNoun => 3,
PartOfSpeech::NoAdjective => 4,
PartOfSpeech::PreNounAdjectival => 5,
PartOfSpeech::TaruAdjective => 6,
PartOfSpeech::Adverb => 7,
PartOfSpeech::AdverbTakingToParticle => 8,
PartOfSpeech::Auxiliary => 9,
PartOfSpeech::AuxiliaryAdjective => 10,
PartOfSpeech::AuxiliaryVerb => 11,
PartOfSpeech::Conjunction => 12,
PartOfSpeech::Copula => 13,
PartOfSpeech::Counter => 14,
PartOfSpeech::Expression => 15,
PartOfSpeech::Interjection => 16,
PartOfSpeech::CommonNoun => 17,
PartOfSpeech::AdverbialNoun => 18,
PartOfSpeech::ProperNoun => 19,
PartOfSpeech::NounPrefix => 20,
PartOfSpeech::NounSuffix => 21,
PartOfSpeech::TemporalNoun => 22,
PartOfSpeech::Numeric => 23,
PartOfSpeech::Pronoun => 24,
PartOfSpeech::Prefix => 25,
PartOfSpeech::Particle => 26,
PartOfSpeech::Suffix => 27,
PartOfSpeech::Unclassified => 28,
PartOfSpeech::UnspecifiedVerb => 29,
PartOfSpeech::IchidanVerb => 30,
PartOfSpeech::IchidanKureruVerb => 31,
PartOfSpeech::GodanAruVerb => 32,
PartOfSpeech::GodanBuVerb => 33,
PartOfSpeech::GodanGuVerb => 34,
PartOfSpeech::GodanKuVerb => 35,
PartOfSpeech::GodanIkuVerb => 36,
PartOfSpeech::GodanMuVerb => 37,
PartOfSpeech::GodanNuVerb => 38,
PartOfSpeech::GodanRuVerb => 39,
PartOfSpeech::IrregularGodanRuVerb => 40,
PartOfSpeech::GodanSuVerb => 41,
PartOfSpeech::GodanTsuVerb => 42,
PartOfSpeech::GodanUVerb => 43,
PartOfSpeech::IrregularGodanUVerb => 44,
PartOfSpeech::IntransitiveVerb => 45,
PartOfSpeech::KuruVerb => 46,
PartOfSpeech::IrregularGodanNuVerb => 47,
PartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => 48,
PartOfSpeech::SuruVerb => 49,
PartOfSpeech::SuruPrecursorVerb => 50,
PartOfSpeech::IncludedSuruVerb => 51,
PartOfSpeech::SpecialSuruVerb => 52,
PartOfSpeech::TransitiveVerb => 53,
PartOfSpeech::IchidanZuruVerb => 54,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => PartOfSpeech::NounOrVerbActingPrenominally,
1 => PartOfSpeech::Adjective,
2 => PartOfSpeech::YoiAdjective,
3 => PartOfSpeech::AdjectivalNoun,
4 => PartOfSpeech::NoAdjective,
5 => PartOfSpeech::PreNounAdjectival,
6 => PartOfSpeech::TaruAdjective,
7 => PartOfSpeech::Adverb,
8 => PartOfSpeech::AdverbTakingToParticle,
9 => PartOfSpeech::Auxiliary,
10 => PartOfSpeech::AuxiliaryAdjective,
11 => PartOfSpeech::AuxiliaryVerb,
12 => PartOfSpeech::Conjunction,
13 => PartOfSpeech::Copula,
14 => PartOfSpeech::Counter,
15 => PartOfSpeech::Expression,
16 => PartOfSpeech::Interjection,
17 => PartOfSpeech::CommonNoun,
18 => PartOfSpeech::AdverbialNoun,
19 => PartOfSpeech::ProperNoun,
20 => PartOfSpeech::NounPrefix,
21 => PartOfSpeech::NounSuffix,
22 => PartOfSpeech::TemporalNoun,
23 => PartOfSpeech::Numeric,
24 => PartOfSpeech::Pronoun,
25 => PartOfSpeech::Prefix,
26 => PartOfSpeech::Particle,
27 => PartOfSpeech::Suffix,
28 => PartOfSpeech::Unclassified,
29 => PartOfSpeech::UnspecifiedVerb,
30 => PartOfSpeech::IchidanVerb,
31 => PartOfSpeech::IchidanKureruVerb,
32 => PartOfSpeech::GodanAruVerb,
33 => PartOfSpeech::GodanBuVerb,
34 => PartOfSpeech::GodanGuVerb,
35 => PartOfSpeech::GodanKuVerb,
36 => PartOfSpeech::GodanIkuVerb,
37 => PartOfSpeech::GodanMuVerb,
38 => PartOfSpeech::GodanNuVerb,
39 => PartOfSpeech::GodanRuVerb,
40 => PartOfSpeech::IrregularGodanRuVerb,
41 => PartOfSpeech::GodanSuVerb,
42 => PartOfSpeech::GodanTsuVerb,
43 => PartOfSpeech::GodanUVerb,
44 => PartOfSpeech::IrregularGodanUVerb,
45 => PartOfSpeech::IntransitiveVerb,
46 => PartOfSpeech::KuruVerb,
47 => PartOfSpeech::IrregularGodanNuVerb,
48 => PartOfSpeech::IrregularGodanRuVerbWithPlainRiForm,
49 => PartOfSpeech::SuruVerb,
50 => PartOfSpeech::SuruPrecursorVerb,
51 => PartOfSpeech::IncludedSuruVerb,
52 => PartOfSpeech::SpecialSuruVerb,
53 => PartOfSpeech::TransitiveVerb,
54 => PartOfSpeech::IchidanZuruVerb,
_ => panic!("unknown PartOfSpeech code: {}", code),
}
}
}
impl std::convert::TryFrom<AllPartOfSpeech> for PartOfSpeech {
type Error = DisabledVariant;
fn try_from(value: AllPartOfSpeech) -> Result<PartOfSpeech, DisabledVariant> {
match value {
AllPartOfSpeech::NounOrVerbActingPrenominally => Ok(PartOfSpeech::NounOrVerbActingPrenominally),
AllPartOfSpeech::Adjective => Ok(PartOfSpeech::Adjective),
AllPartOfSpeech::YoiAdjective => Ok(PartOfSpeech::YoiAdjective),
AllPartOfSpeech::KariAdjective => Err(DisabledVariant),
AllPartOfSpeech::KuAdjective => Err(DisabledVariant),
AllPartOfSpeech::AdjectivalNoun => Ok(PartOfSpeech::AdjectivalNoun),
AllPartOfSpeech::NariAdjective => Err(DisabledVariant),
AllPartOfSpeech::NoAdjective => Ok(PartOfSpeech::NoAdjective),
AllPartOfSpeech::PreNounAdjectival => Ok(PartOfSpeech::PreNounAdjectival),
AllPartOfSpeech::ShikuAdjective => Err(DisabledVariant),
AllPartOfSpeech::TaruAdjective => Ok(PartOfSpeech::TaruAdjective),
AllPartOfSpeech::Adverb => Ok(PartOfSpeech::Adverb),
AllPartOfSpeech::AdverbTakingToParticle => Ok(PartOfSpeech::AdverbTakingToParticle),
AllPartOfSpeech::Auxiliary => Ok(PartOfSpeech::Auxiliary),
AllPartOfSpeech::AuxiliaryAdjective => Ok(PartOfSpeech::AuxiliaryAdjective),
AllPartOfSpeech::AuxiliaryVerb => Ok(PartOfSpeech::AuxiliaryVerb),
AllPartOfSpeech::Conjunction => Ok(PartOfSpeech::Conjunction),
AllPartOfSpeech::Copula => Ok(PartOfSpeech::Copula),
AllPartOfSpeech::Counter => Ok(PartOfSpeech::Counter),
AllPartOfSpeech::Expression => Ok(PartOfSpeech::Expression),
AllPartOfSpeech::Interjection => Ok(PartOfSpeech::Interjection),
AllPartOfSpeech::CommonNoun => Ok(PartOfSpeech::CommonNoun),
AllPartOfSpeech::AdverbialNoun => Ok(PartOfSpeech::AdverbialNoun),
AllPartOfSpeech::ProperNoun => Ok(PartOfSpeech::ProperNoun),
AllPartOfSpeech::NounPrefix => Ok(PartOfSpeech::NounPrefix),
AllPartOfSpeech::NounSuffix => Ok(PartOfSpeech::NounSuffix),
AllPartOfSpeech::TemporalNoun => Ok(PartOfSpeech::TemporalNoun),
AllPartOfSpeech::Numeric => Ok(PartOfSpeech::Numeric),
AllPartOfSpeech::Pronoun => Ok(PartOfSpeech::Pronoun),
AllPartOfSpeech::Prefix => Ok(PartOfSpeech::Prefix),
AllPartOfSpeech::Particle => Ok(PartOfSpeech::Particle),
AllPartOfSpeech::Suffix => Ok(PartOfSpeech::Suffix),
AllPartOfSpeech::Unclassified => Ok(PartOfSpeech::Unclassified),
AllPartOfSpeech::UnspecifiedVerb => Ok(PartOfSpeech::UnspecifiedVerb),
AllPartOfSpeech::IchidanVerb => Ok(PartOfSpeech::IchidanVerb),
AllPartOfSpeech::IchidanKureruVerb => Ok(PartOfSpeech::IchidanKureruVerb),
AllPartOfSpeech::NidanUVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanBuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanBuVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanDzuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanDzuVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanGuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanGuVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanFuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanFuVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanKuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanKuVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanMuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanMuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanNuVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanRuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanRuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanSuVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanTsuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanTsuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanUWeVerb => Err(DisabledVariant),
AllPartOfSpeech::UpperNidanYuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanYuVerb => Err(DisabledVariant),
AllPartOfSpeech::LowerNidanZuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanBuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanGuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanFuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanKuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanMuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanNuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanRuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanSuVerb => Err(DisabledVariant),
AllPartOfSpeech::YodanTsuVerb => Err(DisabledVariant),
AllPartOfSpeech::GodanAruVerb => Ok(PartOfSpeech::GodanAruVerb),
AllPartOfSpeech::GodanBuVerb => Ok(PartOfSpeech::GodanBuVerb),
AllPartOfSpeech::GodanGuVerb => Ok(PartOfSpeech::GodanGuVerb),
AllPartOfSpeech::GodanKuVerb => Ok(PartOfSpeech::GodanKuVerb),
AllPartOfSpeech::GodanIkuVerb => Ok(PartOfSpeech::GodanIkuVerb),
AllPartOfSpeech::GodanMuVerb => Ok(PartOfSpeech::GodanMuVerb),
AllPartOfSpeech::GodanNuVerb => Ok(PartOfSpeech::GodanNuVerb),
AllPartOfSpeech::GodanRuVerb => Ok(PartOfSpeech::GodanRuVerb),
AllPartOfSpeech::IrregularGodanRuVerb => Ok(PartOfSpeech::IrregularGodanRuVerb),
AllPartOfSpeech::GodanSuVerb => Ok(PartOfSpeech::GodanSuVerb),
AllPartOfSpeech::GodanTsuVerb => Ok(PartOfSpeech::GodanTsuVerb),
AllPartOfSpeech::GodanUVerb => Ok(PartOfSpeech::GodanUVerb),
AllPartOfSpeech::IrregularGodanUVerb => Ok(PartOfSpeech::IrregularGodanUVerb),
AllPartOfSpeech::IntransitiveVerb => Ok(PartOfSpeech::IntransitiveVerb),
AllPartOfSpeech::KuruVerb => Ok(PartOfSpeech::KuruVerb),
AllPartOfSpeech::IrregularGodanNuVerb => Ok(PartOfSpeech::IrregularGodanNuVerb),
AllPartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => Ok(PartOfSpeech::IrregularGodanRuVerbWithPlainRiForm),
AllPartOfSpeech::SuruVerb => Ok(PartOfSpeech::SuruVerb),
AllPartOfSpeech::SuruPrecursorVerb => Ok(PartOfSpeech::SuruPrecursorVerb),
AllPartOfSpeech::IncludedSuruVerb => Ok(PartOfSpeech::IncludedSuruVerb),
AllPartOfSpeech::SpecialSuruVerb => Ok(PartOfSpeech::SpecialSuruVerb),
AllPartOfSpeech::TransitiveVerb => Ok(PartOfSpeech::TransitiveVerb),
AllPartOfSpeech::IchidanZuruVerb => Ok(PartOfSpeech::IchidanZuruVerb),
}
}
}
impl std::convert::From<PartOfSpeech> for AllPartOfSpeech {
fn from(value: PartOfSpeech) -> AllPartOfSpeech {
match value {
PartOfSpeech::NounOrVerbActingPrenominally => AllPartOfSpeech::NounOrVerbActingPrenominally,
PartOfSpeech::Adjective => AllPartOfSpeech::Adjective,
PartOfSpeech::YoiAdjective => AllPartOfSpeech::YoiAdjective,
PartOfSpeech::AdjectivalNoun => AllPartOfSpeech::AdjectivalNoun,
PartOfSpeech::NoAdjective => AllPartOfSpeech::NoAdjective,
PartOfSpeech::PreNounAdjectival => AllPartOfSpeech::PreNounAdjectival,
PartOfSpeech::TaruAdjective => AllPartOfSpeech::TaruAdjective,
PartOfSpeech::Adverb => AllPartOfSpeech::Adverb,
PartOfSpeech::AdverbTakingToParticle => AllPartOfSpeech::AdverbTakingToParticle,
PartOfSpeech::Auxiliary => AllPartOfSpeech::Auxiliary,
PartOfSpeech::AuxiliaryAdjective => AllPartOfSpeech::AuxiliaryAdjective,
PartOfSpeech::AuxiliaryVerb => AllPartOfSpeech::AuxiliaryVerb,
PartOfSpeech::Conjunction => AllPartOfSpeech::Conjunction,
PartOfSpeech::Copula => AllPartOfSpeech::Copula,
PartOfSpeech::Counter => AllPartOfSpeech::Counter,
PartOfSpeech::Expression => AllPartOfSpeech::Expression,
PartOfSpeech::Interjection => AllPartOfSpeech::Interjection,
PartOfSpeech::CommonNoun => AllPartOfSpeech::CommonNoun,
PartOfSpeech::AdverbialNoun => AllPartOfSpeech::AdverbialNoun,
PartOfSpeech::ProperNoun => AllPartOfSpeech::ProperNoun,
PartOfSpeech::NounPrefix => AllPartOfSpeech::NounPrefix,
PartOfSpeech::NounSuffix => AllPartOfSpeech::NounSuffix,
PartOfSpeech::TemporalNoun => AllPartOfSpeech::TemporalNoun,
PartOfSpeech::Numeric => AllPartOfSpeech::Numeric,
PartOfSpeech::Pronoun => AllPartOfSpeech::Pronoun,
PartOfSpeech::Prefix => AllPartOfSpeech::Prefix,
PartOfSpeech::Particle => AllPartOfSpeech::Particle,
PartOfSpeech::Suffix => AllPartOfSpeech::Suffix,
PartOfSpeech::Unclassified => AllPartOfSpeech::Unclassified,
PartOfSpeech::UnspecifiedVerb => AllPartOfSpeech::UnspecifiedVerb,
PartOfSpeech::IchidanVerb => AllPartOfSpeech::IchidanVerb,
PartOfSpeech::IchidanKureruVerb => AllPartOfSpeech::IchidanKureruVerb,
PartOfSpeech::GodanAruVerb => AllPartOfSpeech::GodanAruVerb,
PartOfSpeech::GodanBuVerb => AllPartOfSpeech::GodanBuVerb,
PartOfSpeech::GodanGuVerb => AllPartOfSpeech::GodanGuVerb,
PartOfSpeech::GodanKuVerb => AllPartOfSpeech::GodanKuVerb,
PartOfSpeech::GodanIkuVerb => AllPartOfSpeech::GodanIkuVerb,
PartOfSpeech::GodanMuVerb => AllPartOfSpeech::GodanMuVerb,
PartOfSpeech::GodanNuVerb => AllPartOfSpeech::GodanNuVerb,
PartOfSpeech::GodanRuVerb => AllPartOfSpeech::GodanRuVerb,
PartOfSpeech::IrregularGodanRuVerb => AllPartOfSpeech::IrregularGodanRuVerb,
PartOfSpeech::GodanSuVerb => AllPartOfSpeech::GodanSuVerb,
PartOfSpeech::GodanTsuVerb => AllPartOfSpeech::GodanTsuVerb,
PartOfSpeech::GodanUVerb => AllPartOfSpeech::GodanUVerb,
PartOfSpeech::IrregularGodanUVerb => AllPartOfSpeech::IrregularGodanUVerb,
PartOfSpeech::IntransitiveVerb => AllPartOfSpeech::IntransitiveVerb,
PartOfSpeech::KuruVerb => AllPartOfSpeech::KuruVerb,
PartOfSpeech::IrregularGodanNuVerb => AllPartOfSpeech::IrregularGodanNuVerb,
PartOfSpeech::IrregularGodanRuVerbWithPlainRiForm => AllPartOfSpeech::IrregularGodanRuVerbWithPlainRiForm,
PartOfSpeech::SuruVerb => AllPartOfSpeech::SuruVerb,
PartOfSpeech::SuruPrecursorVerb => AllPartOfSpeech::SuruPrecursorVerb,
PartOfSpeech::IncludedSuruVerb => AllPartOfSpeech::IncludedSuruVerb,
PartOfSpeech::SpecialSuruVerb => AllPartOfSpeech::SpecialSuruVerb,
PartOfSpeech::TransitiveVerb => AllPartOfSpeech::TransitiveVerb,
PartOfSpeech::IchidanZuruVerb => AllPartOfSpeech::IchidanZuruVerb,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum ReadingInfo {
GikunOrJukujikun,
IrregularKanaUsage,
OutdatedKanaUsage,
UsuallyWrittenUsingKanjiAlone,
}
impl Enum for ReadingInfo {
fn code(&self) -> &'static str {
match *self {
ReadingInfo::GikunOrJukujikun => "gikun",
ReadingInfo::IrregularKanaUsage => "ik",
ReadingInfo::OutdatedKanaUsage => "ok",
ReadingInfo::UsuallyWrittenUsingKanjiAlone => "uK",
}
}
fn constant_name(&self) -> &'static str {
match *self {
ReadingInfo::GikunOrJukujikun => "GikunOrJukujikun",
ReadingInfo::IrregularKanaUsage => "IrregularKanaUsage",
ReadingInfo::OutdatedKanaUsage => "OutdatedKanaUsage",
ReadingInfo::UsuallyWrittenUsingKanjiAlone => "UsuallyWrittenUsingKanjiAlone",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"gikun" => Some(ReadingInfo::GikunOrJukujikun),
"ik" => Some(ReadingInfo::IrregularKanaUsage),
"ok" => Some(ReadingInfo::OutdatedKanaUsage),
"uK" => Some(ReadingInfo::UsuallyWrittenUsingKanjiAlone),
_ => None,
}
}
}
impl std::fmt::Display for ReadingInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for ReadingInfo {
fn to_u32(&self) -> u32 {
match *self {
ReadingInfo::GikunOrJukujikun => 0,
ReadingInfo::IrregularKanaUsage => 1,
ReadingInfo::OutdatedKanaUsage => 2,
ReadingInfo::UsuallyWrittenUsingKanjiAlone => 3,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => ReadingInfo::GikunOrJukujikun,
1 => ReadingInfo::IrregularKanaUsage,
2 => ReadingInfo::OutdatedKanaUsage,
3 => ReadingInfo::UsuallyWrittenUsingKanjiAlone,
_ => panic!("unknown ReadingInfo code: {}", code),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum SenseInfo {
XRated,
Abbreviation,
Archaism,
Character,
ChildrensLanguage,
Colloquialism,
CompanyName,
Creature,
DatedTerm,
Deity,
Derogatory,
Event,
FamiliarLanguage,
FemaleTermOrLanguage,
Fiction,
GivenName,
HistoricalTerm,
HonorificLanguage,
HumbleLanguage,
IdiomaticExpression,
JocularTerm,
Legend,
LiteraryOrFormalTerm,
MangaSlang,
MaleTermOrLanguage,
Mythology,
InternetSlang,
Object,
ObsoleteTerm,
ObscureTerm,
Onomatopoeia,
OrganizationName,
Other,
PersonName,
PlaceName,
PoeticalTerm,
PoliteLanguage,
ProductName,
Proverb,
Quotation,
Rare,
Religion,
Sensitive,
Service,
Slang,
RailwayStation,
Surname,
UsuallyWrittenUsingKanaAlone,
UnclassifiedName,
VulgarTerm,
WorkOfArt,
Yojijukugo,
}
impl Enum for SenseInfo {
fn code(&self) -> &'static str {
match *self {
SenseInfo::XRated => "X",
SenseInfo::Abbreviation => "abbr",
SenseInfo::Archaism => "arch",
SenseInfo::Character => "char",
SenseInfo::ChildrensLanguage => "chn",
SenseInfo::Colloquialism => "col",
SenseInfo::CompanyName => "company",
SenseInfo::Creature => "creat",
SenseInfo::DatedTerm => "dated",
SenseInfo::Deity => "dei",
SenseInfo::Derogatory => "derog",
SenseInfo::Event => "ev",
SenseInfo::FamiliarLanguage => "fam",
SenseInfo::FemaleTermOrLanguage => "fem",
SenseInfo::Fiction => "fict",
SenseInfo::GivenName => "given",
SenseInfo::HistoricalTerm => "hist",
SenseInfo::HonorificLanguage => "hon",
SenseInfo::HumbleLanguage => "hum",
SenseInfo::IdiomaticExpression => "id",
SenseInfo::JocularTerm => "joc",
SenseInfo::Legend => "leg",
SenseInfo::LiteraryOrFormalTerm => "litf",
SenseInfo::MangaSlang => "m-sl",
SenseInfo::MaleTermOrLanguage => "male",
SenseInfo::Mythology => "myth",
SenseInfo::InternetSlang => "net-sl",
SenseInfo::Object => "obj",
SenseInfo::ObsoleteTerm => "obs",
SenseInfo::ObscureTerm => "obsc",
SenseInfo::Onomatopoeia => "on-mim",
SenseInfo::OrganizationName => "organization",
SenseInfo::Other => "oth",
SenseInfo::PersonName => "person",
SenseInfo::PlaceName => "place",
SenseInfo::PoeticalTerm => "poet",
SenseInfo::PoliteLanguage => "pol",
SenseInfo::ProductName => "product",
SenseInfo::Proverb => "proverb",
SenseInfo::Quotation => "quote",
SenseInfo::Rare => "rare",
SenseInfo::Religion => "relig",
SenseInfo::Sensitive => "sens",
SenseInfo::Service => "serv",
SenseInfo::Slang => "sl",
SenseInfo::RailwayStation => "station",
SenseInfo::Surname => "surname",
SenseInfo::UsuallyWrittenUsingKanaAlone => "uk",
SenseInfo::UnclassifiedName => "unclass",
SenseInfo::VulgarTerm => "vulg",
SenseInfo::WorkOfArt => "work",
SenseInfo::Yojijukugo => "yoji",
}
}
fn constant_name(&self) -> &'static str {
match *self {
SenseInfo::XRated => "XRated",
SenseInfo::Abbreviation => "Abbreviation",
SenseInfo::Archaism => "Archaism",
SenseInfo::Character => "Character",
SenseInfo::ChildrensLanguage => "ChildrensLanguage",
SenseInfo::Colloquialism => "Colloquialism",
SenseInfo::CompanyName => "CompanyName",
SenseInfo::Creature => "Creature",
SenseInfo::DatedTerm => "DatedTerm",
SenseInfo::Deity => "Deity",
SenseInfo::Derogatory => "Derogatory",
SenseInfo::Event => "Event",
SenseInfo::FamiliarLanguage => "FamiliarLanguage",
SenseInfo::FemaleTermOrLanguage => "FemaleTermOrLanguage",
SenseInfo::Fiction => "Fiction",
SenseInfo::GivenName => "GivenName",
SenseInfo::HistoricalTerm => "HistoricalTerm",
SenseInfo::HonorificLanguage => "HonorificLanguage",
SenseInfo::HumbleLanguage => "HumbleLanguage",
SenseInfo::IdiomaticExpression => "IdiomaticExpression",
SenseInfo::JocularTerm => "JocularTerm",
SenseInfo::Legend => "Legend",
SenseInfo::LiteraryOrFormalTerm => "LiteraryOrFormalTerm",
SenseInfo::MangaSlang => "MangaSlang",
SenseInfo::MaleTermOrLanguage => "MaleTermOrLanguage",
SenseInfo::Mythology => "Mythology",
SenseInfo::InternetSlang => "InternetSlang",
SenseInfo::Object => "Object",
SenseInfo::ObsoleteTerm => "ObsoleteTerm",
SenseInfo::ObscureTerm => "ObscureTerm",
SenseInfo::Onomatopoeia => "Onomatopoeia",
SenseInfo::OrganizationName => "OrganizationName",
SenseInfo::Other => "Other",
SenseInfo::PersonName => "PersonName",
SenseInfo::PlaceName => "PlaceName",
SenseInfo::PoeticalTerm => "PoeticalTerm",
SenseInfo::PoliteLanguage => "PoliteLanguage",
SenseInfo::ProductName => "ProductName",
SenseInfo::Proverb => "Proverb",
SenseInfo::Quotation => "Quotation",
SenseInfo::Rare => "Rare",
SenseInfo::Religion => "Religion",
SenseInfo::Sensitive => "Sensitive",
SenseInfo::Service => "Service",
SenseInfo::Slang => "Slang",
SenseInfo::RailwayStation => "RailwayStation",
SenseInfo::Surname => "Surname",
SenseInfo::UsuallyWrittenUsingKanaAlone => "UsuallyWrittenUsingKanaAlone",
SenseInfo::UnclassifiedName => "UnclassifiedName",
SenseInfo::VulgarTerm => "VulgarTerm",
SenseInfo::WorkOfArt => "WorkOfArt",
SenseInfo::Yojijukugo => "Yojijukugo",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"X" => Some(SenseInfo::XRated),
"abbr" => Some(SenseInfo::Abbreviation),
"arch" => Some(SenseInfo::Archaism),
"char" => Some(SenseInfo::Character),
"chn" => Some(SenseInfo::ChildrensLanguage),
"col" => Some(SenseInfo::Colloquialism),
"company" => Some(SenseInfo::CompanyName),
"creat" => Some(SenseInfo::Creature),
"dated" => Some(SenseInfo::DatedTerm),
"dei" => Some(SenseInfo::Deity),
"derog" => Some(SenseInfo::Derogatory),
"ev" => Some(SenseInfo::Event),
"fam" => Some(SenseInfo::FamiliarLanguage),
"fem" => Some(SenseInfo::FemaleTermOrLanguage),
"fict" => Some(SenseInfo::Fiction),
"given" => Some(SenseInfo::GivenName),
"hist" => Some(SenseInfo::HistoricalTerm),
"hon" => Some(SenseInfo::HonorificLanguage),
"hum" => Some(SenseInfo::HumbleLanguage),
"id" => Some(SenseInfo::IdiomaticExpression),
"joc" => Some(SenseInfo::JocularTerm),
"leg" => Some(SenseInfo::Legend),
"litf" => Some(SenseInfo::LiteraryOrFormalTerm),
"m-sl" => Some(SenseInfo::MangaSlang),
"male" => Some(SenseInfo::MaleTermOrLanguage),
"myth" => Some(SenseInfo::Mythology),
"net-sl" => Some(SenseInfo::InternetSlang),
"obj" => Some(SenseInfo::Object),
"obs" => Some(SenseInfo::ObsoleteTerm),
"obsc" => Some(SenseInfo::ObscureTerm),
"on-mim" => Some(SenseInfo::Onomatopoeia),
"organization" => Some(SenseInfo::OrganizationName),
"oth" => Some(SenseInfo::Other),
"person" => Some(SenseInfo::PersonName),
"place" => Some(SenseInfo::PlaceName),
"poet" => Some(SenseInfo::PoeticalTerm),
"pol" => Some(SenseInfo::PoliteLanguage),
"product" => Some(SenseInfo::ProductName),
"proverb" => Some(SenseInfo::Proverb),
"quote" => Some(SenseInfo::Quotation),
"rare" => Some(SenseInfo::Rare),
"relig" => Some(SenseInfo::Religion),
"sens" => Some(SenseInfo::Sensitive),
"serv" => Some(SenseInfo::Service),
"sl" => Some(SenseInfo::Slang),
"station" => Some(SenseInfo::RailwayStation),
"surname" => Some(SenseInfo::Surname),
"uk" => Some(SenseInfo::UsuallyWrittenUsingKanaAlone),
"unclass" => Some(SenseInfo::UnclassifiedName),
"vulg" => Some(SenseInfo::VulgarTerm),
"work" => Some(SenseInfo::WorkOfArt),
"yoji" => Some(SenseInfo::Yojijukugo),
_ => None,
}
}
}
impl std::fmt::Display for SenseInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for SenseInfo {
fn to_u32(&self) -> u32 {
match *self {
SenseInfo::XRated => 0,
SenseInfo::Abbreviation => 1,
SenseInfo::Archaism => 2,
SenseInfo::Character => 3,
SenseInfo::ChildrensLanguage => 4,
SenseInfo::Colloquialism => 5,
SenseInfo::CompanyName => 6,
SenseInfo::Creature => 7,
SenseInfo::DatedTerm => 8,
SenseInfo::Deity => 9,
SenseInfo::Derogatory => 10,
SenseInfo::Event => 11,
SenseInfo::FamiliarLanguage => 12,
SenseInfo::FemaleTermOrLanguage => 13,
SenseInfo::Fiction => 14,
SenseInfo::GivenName => 15,
SenseInfo::HistoricalTerm => 16,
SenseInfo::HonorificLanguage => 17,
SenseInfo::HumbleLanguage => 18,
SenseInfo::IdiomaticExpression => 19,
SenseInfo::JocularTerm => 20,
SenseInfo::Legend => 21,
SenseInfo::LiteraryOrFormalTerm => 22,
SenseInfo::MangaSlang => 23,
SenseInfo::MaleTermOrLanguage => 24,
SenseInfo::Mythology => 25,
SenseInfo::InternetSlang => 26,
SenseInfo::Object => 27,
SenseInfo::ObsoleteTerm => 28,
SenseInfo::ObscureTerm => 29,
SenseInfo::Onomatopoeia => 30,
SenseInfo::OrganizationName => 31,
SenseInfo::Other => 32,
SenseInfo::PersonName => 33,
SenseInfo::PlaceName => 34,
SenseInfo::PoeticalTerm => 35,
SenseInfo::PoliteLanguage => 36,
SenseInfo::ProductName => 37,
SenseInfo::Proverb => 38,
SenseInfo::Quotation => 39,
SenseInfo::Rare => 40,
SenseInfo::Religion => 41,
SenseInfo::Sensitive => 42,
SenseInfo::Service => 43,
SenseInfo::Slang => 44,
SenseInfo::RailwayStation => 45,
SenseInfo::Surname => 46,
SenseInfo::UsuallyWrittenUsingKanaAlone => 47,
SenseInfo::UnclassifiedName => 48,
SenseInfo::VulgarTerm => 49,
SenseInfo::WorkOfArt => 50,
SenseInfo::Yojijukugo => 51,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => SenseInfo::XRated,
1 => SenseInfo::Abbreviation,
2 => SenseInfo::Archaism,
3 => SenseInfo::Character,
4 => SenseInfo::ChildrensLanguage,
5 => SenseInfo::Colloquialism,
6 => SenseInfo::CompanyName,
7 => SenseInfo::Creature,
8 => SenseInfo::DatedTerm,
9 => SenseInfo::Deity,
10 => SenseInfo::Derogatory,
11 => SenseInfo::Event,
12 => SenseInfo::FamiliarLanguage,
13 => SenseInfo::FemaleTermOrLanguage,
14 => SenseInfo::Fiction,
15 => SenseInfo::GivenName,
16 => SenseInfo::HistoricalTerm,
17 => SenseInfo::HonorificLanguage,
18 => SenseInfo::HumbleLanguage,
19 => SenseInfo::IdiomaticExpression,
20 => SenseInfo::JocularTerm,
21 => SenseInfo::Legend,
22 => SenseInfo::LiteraryOrFormalTerm,
23 => SenseInfo::MangaSlang,
24 => SenseInfo::MaleTermOrLanguage,
25 => SenseInfo::Mythology,
26 => SenseInfo::InternetSlang,
27 => SenseInfo::Object,
28 => SenseInfo::ObsoleteTerm,
29 => SenseInfo::ObscureTerm,
30 => SenseInfo::Onomatopoeia,
31 => SenseInfo::OrganizationName,
32 => SenseInfo::Other,
33 => SenseInfo::PersonName,
34 => SenseInfo::PlaceName,
35 => SenseInfo::PoeticalTerm,
36 => SenseInfo::PoliteLanguage,
37 => SenseInfo::ProductName,
38 => SenseInfo::Proverb,
39 => SenseInfo::Quotation,
40 => SenseInfo::Rare,
41 => SenseInfo::Religion,
42 => SenseInfo::Sensitive,
43 => SenseInfo::Service,
44 => SenseInfo::Slang,
45 => SenseInfo::RailwayStation,
46 => SenseInfo::Surname,
47 => SenseInfo::UsuallyWrittenUsingKanaAlone,
48 => SenseInfo::UnclassifiedName,
49 => SenseInfo::VulgarTerm,
50 => SenseInfo::WorkOfArt,
51 => SenseInfo::Yojijukugo,
_ => panic!("unknown SenseInfo code: {}", code),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum SenseTopic {
Buddhism,
Christianity,
MartialArts,
Shinto,
Agriculture,
Anatomy,
Archeology,
Architecture,
Art,
Astronomy,
AudioVisual,
Aviation,
Baseball,
Biochemistry,
Biology,
Botany,
Business,
Chemistry,
Computing,
Crystallography,
Ecology,
Economics,
ElectricalEngineering,
Electronics,
Embryology,
Engineering,
Entomology,
Finance,
Fishing,
Food,
Gardening,
Genetics,
Geography,
Geology,
Geometry,
Go,
Golf,
Grammar,
GreekMythology,
Hanafuda,
Horseracing,
Law,
Linguistics,
Logic,
Mahjong,
Mathematics,
MechanicalEngineering,
Medicine,
Meteorology,
Military,
Music,
Ornithology,
Paleontology,
Pathology,
Pharmacy,
Philosophy,
Photography,
Physics,
Physiology,
Printing,
Psychology,
Shogi,
Sports,
Statistics,
Sumo,
Telecommunications,
Trademark,
VideoGame,
Zoology,
}
impl Enum for SenseTopic {
fn code(&self) -> &'static str {
match *self {
SenseTopic::Buddhism => "Buddh",
SenseTopic::Christianity => "Christn",
SenseTopic::MartialArts => "MA",
SenseTopic::Shinto => "Shinto",
SenseTopic::Agriculture => "agric",
SenseTopic::Anatomy => "anat",
SenseTopic::Archeology => "archeol",
SenseTopic::Architecture => "archit",
SenseTopic::Art => "art",
SenseTopic::Astronomy => "astron",
SenseTopic::AudioVisual => "audvid",
SenseTopic::Aviation => "aviat",
SenseTopic::Baseball => "baseb",
SenseTopic::Biochemistry => "biochem",
SenseTopic::Biology => "biol",
SenseTopic::Botany => "bot",
SenseTopic::Business => "bus",
SenseTopic::Chemistry => "chem",
SenseTopic::Computing => "comp",
SenseTopic::Crystallography => "cryst",
SenseTopic::Ecology => "ecol",
SenseTopic::Economics => "econ",
SenseTopic::ElectricalEngineering => "elec",
SenseTopic::Electronics => "electr",
SenseTopic::Embryology => "embryo",
SenseTopic::Engineering => "engr",
SenseTopic::Entomology => "ent",
SenseTopic::Finance => "finc",
SenseTopic::Fishing => "fish",
SenseTopic::Food => "food",
SenseTopic::Gardening => "gardn",
SenseTopic::Genetics => "genet",
SenseTopic::Geography => "geogr",
SenseTopic::Geology => "geol",
SenseTopic::Geometry => "geom",
SenseTopic::Go => "go",
SenseTopic::Golf => "golf",
SenseTopic::Grammar => "gramm",
SenseTopic::GreekMythology => "grmyth",
SenseTopic::Hanafuda => "hanaf",
SenseTopic::Horseracing => "horse",
SenseTopic::Law => "law",
SenseTopic::Linguistics => "ling",
SenseTopic::Logic => "logic",
SenseTopic::Mahjong => "mahj",
SenseTopic::Mathematics => "math",
SenseTopic::MechanicalEngineering => "mech",
SenseTopic::Medicine => "med",
SenseTopic::Meteorology => "met",
SenseTopic::Military => "mil",
SenseTopic::Music => "music",
SenseTopic::Ornithology => "ornith",
SenseTopic::Paleontology => "paleo",
SenseTopic::Pathology => "pathol",
SenseTopic::Pharmacy => "pharm",
SenseTopic::Philosophy => "phil",
SenseTopic::Photography => "photo",
SenseTopic::Physics => "physics",
SenseTopic::Physiology => "physiol",
SenseTopic::Printing => "print",
SenseTopic::Psychology => "psych",
SenseTopic::Shogi => "shogi",
SenseTopic::Sports => "sports",
SenseTopic::Statistics => "stat",
SenseTopic::Sumo => "sumo",
SenseTopic::Telecommunications => "telec",
SenseTopic::Trademark => "tradem",
SenseTopic::VideoGame => "vidg",
SenseTopic::Zoology => "zool",
}
}
fn constant_name(&self) -> &'static str {
match *self {
SenseTopic::Buddhism => "Buddhism",
SenseTopic::Christianity => "Christianity",
SenseTopic::MartialArts => "MartialArts",
SenseTopic::Shinto => "Shinto",
SenseTopic::Agriculture => "Agriculture",
SenseTopic::Anatomy => "Anatomy",
SenseTopic::Archeology => "Archeology",
SenseTopic::Architecture => "Architecture",
SenseTopic::Art => "Art",
SenseTopic::Astronomy => "Astronomy",
SenseTopic::AudioVisual => "AudioVisual",
SenseTopic::Aviation => "Aviation",
SenseTopic::Baseball => "Baseball",
SenseTopic::Biochemistry => "Biochemistry",
SenseTopic::Biology => "Biology",
SenseTopic::Botany => "Botany",
SenseTopic::Business => "Business",
SenseTopic::Chemistry => "Chemistry",
SenseTopic::Computing => "Computing",
SenseTopic::Crystallography => "Crystallography",
SenseTopic::Ecology => "Ecology",
SenseTopic::Economics => "Economics",
SenseTopic::ElectricalEngineering => "ElectricalEngineering",
SenseTopic::Electronics => "Electronics",
SenseTopic::Embryology => "Embryology",
SenseTopic::Engineering => "Engineering",
SenseTopic::Entomology => "Entomology",
SenseTopic::Finance => "Finance",
SenseTopic::Fishing => "Fishing",
SenseTopic::Food => "Food",
SenseTopic::Gardening => "Gardening",
SenseTopic::Genetics => "Genetics",
SenseTopic::Geography => "Geography",
SenseTopic::Geology => "Geology",
SenseTopic::Geometry => "Geometry",
SenseTopic::Go => "Go",
SenseTopic::Golf => "Golf",
SenseTopic::Grammar => "Grammar",
SenseTopic::GreekMythology => "GreekMythology",
SenseTopic::Hanafuda => "Hanafuda",
SenseTopic::Horseracing => "Horseracing",
SenseTopic::Law => "Law",
SenseTopic::Linguistics => "Linguistics",
SenseTopic::Logic => "Logic",
SenseTopic::Mahjong => "Mahjong",
SenseTopic::Mathematics => "Mathematics",
SenseTopic::MechanicalEngineering => "MechanicalEngineering",
SenseTopic::Medicine => "Medicine",
SenseTopic::Meteorology => "Meteorology",
SenseTopic::Military => "Military",
SenseTopic::Music => "Music",
SenseTopic::Ornithology => "Ornithology",
SenseTopic::Paleontology => "Paleontology",
SenseTopic::Pathology => "Pathology",
SenseTopic::Pharmacy => "Pharmacy",
SenseTopic::Philosophy => "Philosophy",
SenseTopic::Photography => "Photography",
SenseTopic::Physics => "Physics",
SenseTopic::Physiology => "Physiology",
SenseTopic::Printing => "Printing",
SenseTopic::Psychology => "Psychology",
SenseTopic::Shogi => "Shogi",
SenseTopic::Sports => "Sports",
SenseTopic::Statistics => "Statistics",
SenseTopic::Sumo => "Sumo",
SenseTopic::Telecommunications => "Telecommunications",
SenseTopic::Trademark => "Trademark",
SenseTopic::VideoGame => "VideoGame",
SenseTopic::Zoology => "Zoology",
}
}
fn from_code(text: &str) -> Option<Self> {
match text {
"Buddh" => Some(SenseTopic::Buddhism),
"Christn" => Some(SenseTopic::Christianity),
"MA" => Some(SenseTopic::MartialArts),
"Shinto" => Some(SenseTopic::Shinto),
"agric" => Some(SenseTopic::Agriculture),
"anat" => Some(SenseTopic::Anatomy),
"archeol" => Some(SenseTopic::Archeology),
"archit" => Some(SenseTopic::Architecture),
"art" => Some(SenseTopic::Art),
"astron" => Some(SenseTopic::Astronomy),
"audvid" => Some(SenseTopic::AudioVisual),
"aviat" => Some(SenseTopic::Aviation),
"baseb" => Some(SenseTopic::Baseball),
"biochem" => Some(SenseTopic::Biochemistry),
"biol" => Some(SenseTopic::Biology),
"bot" => Some(SenseTopic::Botany),
"bus" => Some(SenseTopic::Business),
"chem" => Some(SenseTopic::Chemistry),
"comp" => Some(SenseTopic::Computing),
"cryst" => Some(SenseTopic::Crystallography),
"ecol" => Some(SenseTopic::Ecology),
"econ" => Some(SenseTopic::Economics),
"elec" => Some(SenseTopic::ElectricalEngineering),
"electr" => Some(SenseTopic::Electronics),
"embryo" => Some(SenseTopic::Embryology),
"engr" => Some(SenseTopic::Engineering),
"ent" => Some(SenseTopic::Entomology),
"finc" => Some(SenseTopic::Finance),
"fish" => Some(SenseTopic::Fishing),
"food" => Some(SenseTopic::Food),
"gardn" => Some(SenseTopic::Gardening),
"genet" => Some(SenseTopic::Genetics),
"geogr" => Some(SenseTopic::Geography),
"geol" => Some(SenseTopic::Geology),
"geom" => Some(SenseTopic::Geometry),
"go" => Some(SenseTopic::Go),
"golf" => Some(SenseTopic::Golf),
"gramm" => Some(SenseTopic::Grammar),
"grmyth" => Some(SenseTopic::GreekMythology),
"hanaf" => Some(SenseTopic::Hanafuda),
"horse" => Some(SenseTopic::Horseracing),
"law" => Some(SenseTopic::Law),
"ling" => Some(SenseTopic::Linguistics),
"logic" => Some(SenseTopic::Logic),
"mahj" => Some(SenseTopic::Mahjong),
"math" => Some(SenseTopic::Mathematics),
"mech" => Some(SenseTopic::MechanicalEngineering),
"med" => Some(SenseTopic::Medicine),
"met" => Some(SenseTopic::Meteorology),
"mil" => Some(SenseTopic::Military),
"music" => Some(SenseTopic::Music),
"ornith" => Some(SenseTopic::Ornithology),
"paleo" => Some(SenseTopic::Paleontology),
"pathol" => Some(SenseTopic::Pathology),
"pharm" => Some(SenseTopic::Pharmacy),
"phil" => Some(SenseTopic::Philosophy),
"photo" => Some(SenseTopic::Photography),
"physics" => Some(SenseTopic::Physics),
"physiol" => Some(SenseTopic::Physiology),
"print" => Some(SenseTopic::Printing),
"psych" => Some(SenseTopic::Psychology),
"shogi" => Some(SenseTopic::Shogi),
"sports" => Some(SenseTopic::Sports),
"stat" => Some(SenseTopic::Statistics),
"sumo" => Some(SenseTopic::Sumo),
"telec" => Some(SenseTopic::Telecommunications),
"tradem" => Some(SenseTopic::Trademark),
"vidg" => Some(SenseTopic::VideoGame),
"zool" => Some(SenseTopic::Zoology),
_ => None,
}
}
}
impl std::fmt::Display for SenseTopic {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.constant_name())
}
}
impl EnumPayload for SenseTopic {
fn to_u32(&self) -> u32 {
match *self {
SenseTopic::Buddhism => 0,
SenseTopic::Christianity => 1,
SenseTopic::MartialArts => 2,
SenseTopic::Shinto => 3,
SenseTopic::Agriculture => 4,
SenseTopic::Anatomy => 5,
SenseTopic::Archeology => 6,
SenseTopic::Architecture => 7,
SenseTopic::Art => 8,
SenseTopic::Astronomy => 9,
SenseTopic::AudioVisual => 10,
SenseTopic::Aviation => 11,
SenseTopic::Baseball => 12,
SenseTopic::Biochemistry => 13,
SenseTopic::Biology => 14,
SenseTopic::Botany => 15,
SenseTopic::Business => 16,
SenseTopic::Chemistry => 17,
SenseTopic::Computing => 18,
SenseTopic::Crystallography => 19,
SenseTopic::Ecology => 20,
SenseTopic::Economics => 21,
SenseTopic::ElectricalEngineering => 22,
SenseTopic::Electronics => 23,
SenseTopic::Embryology => 24,
SenseTopic::Engineering => 25,
SenseTopic::Entomology => 26,
SenseTopic::Finance => 27,
SenseTopic::Fishing => 28,
SenseTopic::Food => 29,
SenseTopic::Gardening => 30,
SenseTopic::Genetics => 31,
SenseTopic::Geography => 32,
SenseTopic::Geology => 33,
SenseTopic::Geometry => 34,
SenseTopic::Go => 35,
SenseTopic::Golf => 36,
SenseTopic::Grammar => 37,
SenseTopic::GreekMythology => 38,
SenseTopic::Hanafuda => 39,
SenseTopic::Horseracing => 40,
SenseTopic::Law => 41,
SenseTopic::Linguistics => 42,
SenseTopic::Logic => 43,
SenseTopic::Mahjong => 44,
SenseTopic::Mathematics => 45,
SenseTopic::MechanicalEngineering => 46,
SenseTopic::Medicine => 47,
SenseTopic::Meteorology => 48,
SenseTopic::Military => 49,
SenseTopic::Music => 50,
SenseTopic::Ornithology => 51,
SenseTopic::Paleontology => 52,
SenseTopic::Pathology => 53,
SenseTopic::Pharmacy => 54,
SenseTopic::Philosophy => 55,
SenseTopic::Photography => 56,
SenseTopic::Physics => 57,
SenseTopic::Physiology => 58,
SenseTopic::Printing => 59,
SenseTopic::Psychology => 60,
SenseTopic::Shogi => 61,
SenseTopic::Sports => 62,
SenseTopic::Statistics => 63,
SenseTopic::Sumo => 64,
SenseTopic::Telecommunications => 65,
SenseTopic::Trademark => 66,
SenseTopic::VideoGame => 67,
SenseTopic::Zoology => 68,
}
}
fn from_u32(code: u32) -> Self {
match code {
0 => SenseTopic::Buddhism,
1 => SenseTopic::Christianity,
2 => SenseTopic::MartialArts,
3 => SenseTopic::Shinto,
4 => SenseTopic::Agriculture,
5 => SenseTopic::Anatomy,
6 => SenseTopic::Archeology,
7 => SenseTopic::Architecture,
8 => SenseTopic::Art,
9 => SenseTopic::Astronomy,
10 => SenseTopic::AudioVisual,
11 => SenseTopic::Aviation,
12 => SenseTopic::Baseball,
13 => SenseTopic::Biochemistry,
14 => SenseTopic::Biology,
15 => SenseTopic::Botany,
16 => SenseTopic::Business,
17 => SenseTopic::Chemistry,
18 => SenseTopic::Computing,
19 => SenseTopic::Crystallography,
20 => SenseTopic::Ecology,
21 => SenseTopic::Economics,
22 => SenseTopic::ElectricalEngineering,
23 => SenseTopic::Electronics,
24 => SenseTopic::Embryology,
25 => SenseTopic::Engineering,
26 => SenseTopic::Entomology,
27 => SenseTopic::Finance,
28 => SenseTopic::Fishing,
29 => SenseTopic::Food,
30 => SenseTopic::Gardening,
31 => SenseTopic::Genetics,
32 => SenseTopic::Geography,
33 => SenseTopic::Geology,
34 => SenseTopic::Geometry,
35 => SenseTopic::Go,
36 => SenseTopic::Golf,
37 => SenseTopic::Grammar,
38 => SenseTopic::GreekMythology,
39 => SenseTopic::Hanafuda,
40 => SenseTopic::Horseracing,
41 => SenseTopic::Law,
42 => SenseTopic::Linguistics,
43 => SenseTopic::Logic,
44 => SenseTopic::Mahjong,
45 => SenseTopic::Mathematics,
46 => SenseTopic::MechanicalEngineering,
47 => SenseTopic::Medicine,
48 => SenseTopic::Meteorology,
49 => SenseTopic::Military,
50 => SenseTopic::Music,
51 => SenseTopic::Ornithology,
52 => SenseTopic::Paleontology,
53 => SenseTopic::Pathology,
54 => SenseTopic::Pharmacy,
55 => SenseTopic::Philosophy,
56 => SenseTopic::Photography,
57 => SenseTopic::Physics,
58 => SenseTopic::Physiology,
59 => SenseTopic::Printing,
60 => SenseTopic::Psychology,
61 => SenseTopic::Shogi,
62 => SenseTopic::Sports,
63 => SenseTopic::Statistics,
64 => SenseTopic::Sumo,
65 => SenseTopic::Telecommunications,
66 => SenseTopic::Trademark,
67 => SenseTopic::VideoGame,
68 => SenseTopic::Zoology,
_ => panic!("unknown SenseTopic code: {}", code),
}
}
}