package pl.zbronk.nlp.gr; /** * Kategorie gramatyczne * Opisane w: http://sgjp.pl/static/pdf/Podstawy_teoretyczne_SGJP.pdf * i w "System znaczników morfosyntaktycznych w korpusie IPI PAN" (http://nlp.ipipan.waw.pl/CORPUS/znakowanie.pdf) * @author Zbigniew Bronk */ public interface GrammarCategory { public String name(); public String getLabel(); public CategoryType getType(); /** * Typy kategorii gramatycznych */ public enum CategoryType { casec, number,gender,degree,person,aspect, akomod; } /** * Przypadek gramatyczny */ public enum Case implements GrammarCategory { nom("mianownik"), gen("dopełniacz"), dat("celownik"), acc("biernik"), inst("narzędnik"), loc("miejscownik"), voc("wołacz"); String label; public String getLabel() { return label; } Case (String label) { this.label=label; } @Override public CategoryType getType() { return CategoryType.casec; } } /** * Kategoria liczby */ public enum Numberc implements GrammarCategory { sg("pojedyncza"),pl("mnoga"); String label; public String getLabel() { return label; } Numberc (String label) { this.label=label; } @Override public CategoryType getType() { return CategoryType.number; } } /** * Rodzaj gramatyczny */ public enum Gender implements GrammarCategory { m1("męsko-osobowy"), m2("męsko-zwierzęcy"), m3("męsko-nieożywiony"), f("żeński"), n1("nijaki 1 (dziecko)"), n2("nijaki 2 (dzieło)"), p1("przymnogi 1 - osobowy"), p2("przymnogi 2 (skrzypce)"), p3("przymnogi 3 (okulary)"); String label; public String getLabel() { return label; } Gender (String label) { this.label=label; } @Override public CategoryType getType() { return CategoryType.gender; } } /* * Stopień (przymiotników i przysłówków) */ public enum Degree implements GrammarCategory { pos("równy"),com("wyższy"),sup("najwyższy"); String label; public String getLabel() { return label; } Degree (String label) { this.label=label; } @Override public CategoryType getType() { return CategoryType.degree; } } /* * Osoba (w odmianie czasowników) */ public enum Person implements GrammarCategory { pri("pierwsza"),sec("druga"),ter("trzecia"); String label; public String getLabel() { return label; } Person (String label) { this.label=label; } @Override public CategoryType getType() { return CategoryType.person; } } /* * Aspekt czasownika */ public enum Aspect implements GrammarCategory { imperf("niedokonany"),perf("dokonany"); String label; public String getLabel() { return label; } Aspect (String label) { this.label=label; } @Override public CategoryType getType() { return CategoryType.aspect; } } /* * Akomodacja (rząd, rekcja) liczebnika */ public enum Akomod implements GrammarCategory { congr("zgody"),rec("rządu"),both("rządu i zgody"); String label; public String getLabel() { return label; } Akomod (String label) { this.label=label; } @Override public CategoryType getType() { return CategoryType.akomod; } } public static GrammarCategory getGrammarCategory(String id) { try { return GrammarCategory.Case.valueOf(id); } catch (Exception e) {} try { return GrammarCategory.Gender.valueOf(id); } catch (Exception e) {} try { return GrammarCategory.Numberc.valueOf(id); } catch (Exception e) {} try { return GrammarCategory.Aspect.valueOf(id); } catch (Exception e) {} try { return GrammarCategory.Person.valueOf(id); } catch (Exception e) {} try { return GrammarCategory.Degree.valueOf(id); } catch (Exception e) {} try { return GrammarCategory.Akomod.valueOf(id); } catch (Exception e) {} return null; } }