static CogFeatureSystem() { AnchorType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "anchor"}; VowelType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "vowel"}; ConsonantType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "consonant"}; ToneLetterType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "toneLetter"}; BoundaryType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "boundary"}; SyllableType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "syllable"}; StemType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "stem"}; PrefixType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "prefix"}; SuffixType = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "suffix"}; Type = new SymbolicFeature(Guid.NewGuid().ToString(), AnchorType, VowelType, ConsonantType, ToneLetterType, BoundaryType, SyllableType, StemType, PrefixType, SuffixType) {Description = "Type"}; Complex = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "complex"}; Simple = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "simple"}; SegmentType = new SymbolicFeature(Guid.NewGuid().ToString(), Complex, Simple) {Description = "SegmentType"}; OriginalStrRep = new StringFeature(Guid.NewGuid().ToString()) {Description = "OriginalStrRep"}; StrRep = new StringFeature(Guid.NewGuid().ToString()) {Description = "StrRep"}; First = new ComplexFeature(Guid.NewGuid().ToString()) {Description = "First"}; Onset = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "onset"}; Nucleus = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "nucleus"}; Coda = new FeatureSymbol(Guid.NewGuid().ToString()) {Description = "coda"}; SyllablePosition = new SymbolicFeature(Guid.NewGuid().ToString(), Onset, Nucleus, Coda) {Description = "SyllablePosition"}; Instance = new CogFeatureSystem(); }
public FeatureStruct GetValue(ComplexFeature feature) { FeatureStruct value; if (TryGetValue(feature, out value)) { return(value); } throw new ArgumentException("The specified value could not be found.", "feature"); }
public ComplexFeature AddHeadFeature() { var headFeature = new ComplexFeature(HeadID) {Description = "Head"}; base.Add(headFeature); return headFeature; }
public ComplexFeature AddFootFeature() { var footFeature = new ComplexFeature(FootID) {Description = "Foot"}; base.Add(footFeature); return footFeature; }
public void FixtureSetUp() { SpanFactory = new ShapeSpanFactory(); TraceManager = new TraceManager(); var phonologicalFeatSys = new FeatureSystem { new SymbolicFeature("voc", new FeatureSymbol("voc+", "+"), new FeatureSymbol("voc-", "-")), new SymbolicFeature("cons", new FeatureSymbol("cons+", "+"), new FeatureSymbol("cons-", "-")), new SymbolicFeature("high", new FeatureSymbol("high+", "+"), new FeatureSymbol("high-", "-")), new SymbolicFeature("low", new FeatureSymbol("low+", "+"), new FeatureSymbol("low-", "-")), new SymbolicFeature("back", new FeatureSymbol("back+", "+"), new FeatureSymbol("back-", "-")), new SymbolicFeature("round", new FeatureSymbol("round+", "+"), new FeatureSymbol("round-", "-")), new SymbolicFeature("vd", new FeatureSymbol("vd+", "+"), new FeatureSymbol("vd-", "-")), new SymbolicFeature("asp", new FeatureSymbol("asp+", "+"), new FeatureSymbol("asp-", "-")), new SymbolicFeature("del_rel", new FeatureSymbol("del_rel+", "+"), new FeatureSymbol("del_rel-", "-")), new SymbolicFeature("ATR", new FeatureSymbol("ATR+", "+"), new FeatureSymbol("ATR-", "-")), new SymbolicFeature("strident", new FeatureSymbol("strident+", "+"), new FeatureSymbol("strident-", "-")), new SymbolicFeature("cont", new FeatureSymbol("cont+", "+"), new FeatureSymbol("cont-", "-")), new SymbolicFeature("nasal", new FeatureSymbol("nasal+", "+"), new FeatureSymbol("nasal-", "-")), new SymbolicFeature("poa", new FeatureSymbol("bilabial"), new FeatureSymbol("labiodental"), new FeatureSymbol("alveolar"), new FeatureSymbol("velar")) }; phonologicalFeatSys.Freeze(); var syntacticFeatSys = new SyntacticFeatureSystem { new SymbolicFeature("foo", new FeatureSymbol("foo+", "+"), new FeatureSymbol("foo-", "-")), new SymbolicFeature("baz", new FeatureSymbol("baz+", "+"), new FeatureSymbol("baz-", "-")), new SymbolicFeature("num", new FeatureSymbol("sg"), new FeatureSymbol("pl")), new SymbolicFeature("pers", new FeatureSymbol("1"), new FeatureSymbol("2"), new FeatureSymbol("3"), new FeatureSymbol("4")), new SymbolicFeature("tense", new FeatureSymbol("past"), new FeatureSymbol("pres")), new SymbolicFeature("evidential", new FeatureSymbol("witnessed")), new SymbolicFeature("aspect", new FeatureSymbol("perf"), new FeatureSymbol("impf")), new SymbolicFeature("mood", new FeatureSymbol("active"), new FeatureSymbol("passive")), new SymbolicFeature("fum", new FeatureSymbol("fum+", "+"), new FeatureSymbol("fum-", "-")), new SymbolicFeature("bar", new FeatureSymbol("bar+", "+"), new FeatureSymbol("bar-", "-")) }; syntacticFeatSys.AddPartsOfSpeech(new FeatureSymbol("N", "Noun"), new FeatureSymbol("V", "Verb"), new FeatureSymbol("TV", "Transitive Verb"), new FeatureSymbol("IV", "Intransitive Verb"), new FeatureSymbol("A", "Adjective")); Head = syntacticFeatSys.AddHeadFeature(); Foot = syntacticFeatSys.AddFootFeature(); syntacticFeatSys.Freeze(); Table1 = new CharacterDefinitionTable(SpanFactory) { Name = "table1" }; AddSegDef(Table1, phonologicalFeatSys, "a", "cons-", "voc+", "high-", "low+", "back+", "round-", "vd+"); AddSegDef(Table1, phonologicalFeatSys, "i", "cons-", "voc+", "high+", "low-", "back-", "round-", "vd+"); AddSegDef(Table1, phonologicalFeatSys, "u", "cons-", "voc+", "high+", "low-", "back+", "round+", "vd+"); AddSegDef(Table1, phonologicalFeatSys, "o", "cons-", "voc+", "high-", "low-", "back+", "round+", "vd+"); AddSegDef(Table1, phonologicalFeatSys, "y", "cons-", "voc+", "high+", "low-", "back-", "round+", "vd+"); AddSegDef(Table1, phonologicalFeatSys, "ɯ", "cons-", "voc+", "high+", "low-", "back+", "round-", "vd+"); AddSegDef(Table1, phonologicalFeatSys, "p", "cons+", "voc-", "bilabial", "vd-", "asp-", "strident-", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "t", "cons+", "voc-", "alveolar", "vd-", "asp-", "del_rel-", "strident-", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "k", "cons+", "voc-", "velar", "vd-", "asp-", "strident-", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "ts", "cons+", "voc-", "alveolar", "vd-", "asp-", "del_rel+", "strident+", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "pʰ", "cons+", "voc-", "bilabial", "vd-", "asp+", "strident-", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "tʰ", "cons+", "voc-", "alveolar", "vd-", "asp+", "del_rel-", "strident-", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "kʰ", "cons+", "voc-", "velar", "vd-", "asp+", "strident-", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "tsʰ", "cons+", "voc-", "alveolar", "vd-", "asp+", "del_rel+", "strident+", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "b", "cons+", "voc-", "bilabial", "vd+", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "d", "cons+", "voc-", "alveolar", "vd+", "strident-", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "g", "cons+", "voc-", "velar", "vd+", "cont-", "nasal-"); AddSegDef(Table1, phonologicalFeatSys, "m", "cons+", "voc-", "bilabial", "vd+", "cont-", "nasal+"); AddSegDef(Table1, phonologicalFeatSys, "n", "cons+", "voc-", "alveolar", "vd+", "strident-", "cont-", "nasal+"); AddSegDef(Table1, phonologicalFeatSys, "ŋ", "cons+", "voc-", "velar", "vd+", "cont-", "nasal+"); AddSegDef(Table1, phonologicalFeatSys, "s", "cons+", "voc-", "alveolar", "vd-", "asp-", "del_rel-", "strident+", "cont+"); AddSegDef(Table1, phonologicalFeatSys, "z", "cons+", "voc-", "alveolar", "vd+", "asp-", "del_rel-", "strident+", "cont+"); AddSegDef(Table1, phonologicalFeatSys, "f", "cons+", "voc-", "labiodental", "vd-", "asp-", "strident+", "cont+"); AddSegDef(Table1, phonologicalFeatSys, "v", "cons+", "voc-", "labiodental", "vd+", "asp-", "strident+", "cont+"); Table2 = new CharacterDefinitionTable(SpanFactory) { Name = "table2" }; AddSegDef(Table2, phonologicalFeatSys, "a", "cons-", "voc+", "high-", "low+", "back+", "round-", "vd+"); AddSegDef(Table2, phonologicalFeatSys, "i", "cons-", "voc+", "high+", "low-", "back-", "round-", "vd+"); AddSegDef(Table2, phonologicalFeatSys, "u", "cons-", "voc+", "high+", "low-", "back+", "round+", "vd+"); AddSegDef(Table2, phonologicalFeatSys, "y", "cons-", "voc+", "high+", "low-", "back-", "round+", "vd+"); AddSegDef(Table2, phonologicalFeatSys, "o", "cons-", "voc+", "high-", "low-", "back+", "round+", "vd+"); AddSegDef(Table2, phonologicalFeatSys, "p", "cons+", "voc-", "bilabial", "vd-"); AddSegDef(Table2, phonologicalFeatSys, "t", "cons+", "voc-", "alveolar", "vd-", "del_rel-", "strident-"); AddSegDef(Table2, phonologicalFeatSys, "k", "cons+", "voc-", "velar", "vd-"); AddSegDef(Table2, phonologicalFeatSys, "ts", "cons+", "voc-", "alveolar", "vd-", "del_rel+", "strident+"); AddSegDef(Table2, phonologicalFeatSys, "b", "cons+", "voc-", "bilabial", "vd+"); AddSegDef(Table2, phonologicalFeatSys, "d", "cons+", "voc-", "alveolar", "vd+", "strident-"); AddSegDef(Table2, phonologicalFeatSys, "g", "cons+", "voc-", "velar", "vd+"); AddSegDef(Table2, phonologicalFeatSys, "m", "cons+", "voc-", "bilabial", "vd+", "cont-", "nasal+"); AddSegDef(Table2, phonologicalFeatSys, "n", "cons+", "voc-", "alveolar", "vd+", "cont-", "nasal+"); AddSegDef(Table2, phonologicalFeatSys, "ŋ", "cons+", "voc-", "velar", "vd+", "cont-", "nasal+"); AddSegDef(Table2, phonologicalFeatSys, "s", "cons+", "voc-", "alveolar", "vd-", "asp-", "del_rel-", "strident+", "cont+"); AddSegDef(Table2, phonologicalFeatSys, "z", "cons+", "voc-", "alveolar", "vd+", "asp-", "del_rel-", "strident+", "cont+"); AddSegDef(Table2, phonologicalFeatSys, "f", "cons+", "voc-", "labiodental", "vd-", "asp-", "strident+", "cont+"); AddSegDef(Table2, phonologicalFeatSys, "v", "cons+", "voc-", "labiodental", "vd+", "asp-", "strident+", "cont+"); AddBdryDef(Table2, "+"); AddBdryDef(Table2, "#"); AddBdryDef(Table2, "!"); AddBdryDef(Table2, "."); AddBdryDef(Table2, "$"); Table3 = new CharacterDefinitionTable(SpanFactory) { Name = "table3" }; AddSegDef(Table3, phonologicalFeatSys, "a", "cons-", "voc+", "high-", "low+", "back+", "round-", "vd+", "ATR+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "a̘", "cons-", "voc+", "high-", "low+", "back+", "round-", "vd+", "ATR-", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "i", "cons-", "voc+", "high+", "low-", "back-", "round-", "vd+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "u", "cons-", "voc+", "high+", "low-", "back+", "round+", "vd+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "y", "cons-", "voc+", "high+", "low-", "back-", "round+", "vd+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "ɯ", "cons-", "voc+", "high+", "low-", "back+", "round-", "vd+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "o", "cons-", "voc+", "high-", "low-", "back+", "round+", "vd+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "p", "cons+", "voc-", "bilabial", "vd-", "cont-", "nasal-"); AddSegDef(Table3, phonologicalFeatSys, "t", "cons+", "voc-", "alveolar", "vd-", "del_rel-", "strident-", "cont-", "nasal-"); AddSegDef(Table3, phonologicalFeatSys, "k", "cons+", "voc-", "velar", "vd-", "cont-", "nasal-"); AddSegDef(Table3, phonologicalFeatSys, "ts", "cons+", "voc-", "alveolar", "vd-", "del_rel+", "strident+", "cont-", "nasal-"); AddSegDef(Table3, phonologicalFeatSys, "b", "cons+", "voc-", "bilabial", "vd+", "cont-", "nasal-"); AddSegDef(Table3, phonologicalFeatSys, "d", "cons+", "voc-", "alveolar", "vd+", "strident-", "cont-", "nasal-"); AddSegDef(Table3, phonologicalFeatSys, "g", "cons+", "voc-", "velar", "vd+", "cont-", "nasal-"); AddSegDef(Table3, phonologicalFeatSys, "m", "cons+", "voc-", "bilabial", "vd+", "cont-", "nasal+"); AddSegDef(Table3, phonologicalFeatSys, "n", "cons+", "voc-", "alveolar", "vd+", "strident-", "cont-", "nasal+"); AddSegDef(Table3, phonologicalFeatSys, "ŋ", "cons+", "voc-", "velar", "vd+", "cont-", "nasal+"); AddSegDef(Table3, phonologicalFeatSys, "s", "cons+", "voc-", "alveolar", "vd-", "asp-", "del_rel-", "strident+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "z", "cons+", "voc-", "alveolar", "vd+", "asp-", "del_rel-", "strident+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "f", "cons+", "voc-", "labiodental", "vd-", "asp-", "strident+", "cont+"); AddSegDef(Table3, phonologicalFeatSys, "v", "cons+", "voc-", "labiodental", "vd+", "asp-", "strident+", "cont+"); AddBdryDef(Table3, "+"); AddBdryDef(Table3, "#"); AddBdryDef(Table3, "!"); AddBdryDef(Table3, "."); Latinate = new MprFeature { Name = "latinate" }; Germanic = new MprFeature { Name = "germanic" }; Morphophonemic = new Stratum(Table3) { Name = "Morphophonemic", MorphologicalRuleOrder = MorphologicalRuleOrder.Unordered }; Allophonic = new Stratum(Table1) { Name = "Allophonic", MorphologicalRuleOrder = MorphologicalRuleOrder.Unordered }; Surface = new Stratum(Table1) { Name = "Surface", MorphologicalRuleOrder = MorphologicalRuleOrder.Unordered }; Entries = new Dictionary<string, LexEntry>(); var fs = FeatureStruct.New(syntacticFeatSys) .Symbol("N") .Feature(Head).EqualTo(head => head .Symbol("foo+").Symbol("baz-")) .Feature(Foot).EqualTo(foot => foot .Symbol("fum-").Symbol("bar+")).Value; AddEntry("1", fs, Allophonic, "pʰit"); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("N") .Feature(Head).EqualTo(head => head .Symbol("foo+").Symbol("baz-")) .Feature(Foot).EqualTo(foot => foot .Symbol("fum-").Symbol("bar+")).Value; AddEntry("2", fs, Allophonic, "pit"); AddEntry("5", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "pʰut"); AddEntry("6", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "kʰat"); AddEntry("7", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "kʰut"); AddEntry("8", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "dat"); AddEntry("9", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Allophonic, "dat"); AddEntry("10", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "ga̘p"); AddEntry("11", FeatureStruct.New(syntacticFeatSys).Symbol("A").Value, Morphophonemic, "gab"); AddEntry("12", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "ga+b"); AddEntry("13", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bubabu"); AddEntry("14", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bubabi"); AddEntry("15", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bɯbabu"); AddEntry("16", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bibabi"); AddEntry("17", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bubi"); AddEntry("18", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bibu"); AddEntry("19", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "b+ubu"); AddEntry("20", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bubababi"); AddEntry("21", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bibababu"); AddEntry("22", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bubabababi"); AddEntry("23", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bibabababu"); AddEntry("24", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bubui"); AddEntry("25", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "buibu"); AddEntry("26", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "buibui"); AddEntry("27", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "buiibuii"); AddEntry("28", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "buitibuiti"); AddEntry("29", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "iibubu"); AddEntry("30", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "bu+ib"); AddEntry("31", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "buib"); AddEntry("32", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "sag"); AddEntry("33", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "sas"); AddEntry("34", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "saz"); AddEntry("35", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "sat"); AddEntry("36", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "sasibo"); AddEntry("37", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "sasibut"); AddEntry("38", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "sasibud"); AddEntry("39", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "ab+ba"); AddEntry("40", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "abba"); AddEntry("41", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Allophonic, "pip"); AddEntry("42", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "bubibi"); AddEntry("43", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "bubibu"); AddEntry("44", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "gigigi"); AddEntry("45", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "nbinding"); AddEntry("46", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "bupu"); AddEntry("47", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "tag"); AddEntry("48", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "pag"); AddEntry("49", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "ktb"); AddEntry("50", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Allophonic, "suupu"); AddEntry("51", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "miu"); AddEntry("52", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "pu"); AddEntry("53", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "mi"); AddEntry("54", FeatureStruct.New().Value, Morphophonemic, "pi"); AddEntry("55", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "mim+ɯɯ"); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("num").EqualTo("pl")).Value; AddEntry("Perc0", fs, Morphophonemic, "ssag"); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("1") .Feature("num").EqualTo("pl")).Value; AddEntry("Perc1", fs, Morphophonemic, "ssag"); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("3") .Feature("num").EqualTo("pl")).Value; AddEntry("Perc2", fs, Morphophonemic, "ssag"); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("2", "3") .Feature("num").EqualTo("pl")).Value; AddEntry("Perc3", fs, Morphophonemic, "ssag"); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("1", "3") .Feature("num").EqualTo("pl")).Value; AddEntry("Perc4", fs, Morphophonemic, "ssag"); var seeFamily = new LexFamily { Name = "SEE" }; seeFamily.Entries.Add(AddEntry("bl1", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "si")); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("tense").EqualTo("past")).Value; seeFamily.Entries.Add(AddEntry("bl2", fs, Morphophonemic, "sau")); fs = FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("tense").EqualTo("pres")).Value; seeFamily.Entries.Add(AddEntry("bl3", fs, Morphophonemic, "sis")); LexEntry entry = AddEntry("pos1", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "ba"); entry.MprFeatures.Add(Latinate); entry = AddEntry("pos2", FeatureStruct.New(syntacticFeatSys).Symbol("N").Value, Morphophonemic, "ba"); entry.MprFeatures.Add(Germanic); var vowel = FeatureStruct.New(phonologicalFeatSys).Symbol(HCFeatureSystem.Segment).Symbol("voc+").Value; entry = AddEntry("free", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "tap", "taz", "tas"); entry.Allomorphs[0].Environments.Add(new AllomorphEnvironment(SpanFactory, ConstraintType.Require, null, Pattern<Word, ShapeNode>.New().Annotation(vowel).Value)); entry = AddEntry("disj", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "baz", "bat", "bad", "bas"); var unroundedVowel = FeatureStruct.New(phonologicalFeatSys).Symbol(HCFeatureSystem.Segment).Symbol("voc+").Symbol("round-").Value; entry.Allomorphs[0].Environments.Add(new AllomorphEnvironment(SpanFactory, ConstraintType.Require, null, Pattern<Word, ShapeNode>.New().Annotation(unroundedVowel).Value)); entry.Allomorphs[1].Environments.Add(new AllomorphEnvironment(SpanFactory, ConstraintType.Require, null, Pattern<Word, ShapeNode>.New().Annotation(vowel).Value)); entry.Allomorphs[2].Environments.Add(new AllomorphEnvironment(SpanFactory, ConstraintType.Require, null, Pattern<Word, ShapeNode>.New().Annotation(vowel).Value)); entry = AddEntry("stemname", FeatureStruct.New(syntacticFeatSys).Symbol("V").Feature(Head).EqualTo(head => head.Feature("tense").EqualTo("pres")).Value, Morphophonemic, "san", "sad", "sap"); entry.Allomorphs[1].StemName = new StemName( FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("1")).Value, FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("2")).Value) {Name = "sn1"}; entry.Allomorphs[2].StemName = new StemName( FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("1")).Value, FeatureStruct.New(syntacticFeatSys) .Symbol("V") .Feature(Head).EqualTo(head => head .Feature("pers").EqualTo("3")).Value) {Name = "sn2"}; AddEntry("synfs", FeatureStruct.New(syntacticFeatSys).Symbol("V").Feature(Head).EqualTo(head => head.Feature("tense").EqualTo("pres")).Value, Morphophonemic, "bag"); entry = AddEntry("bound", FeatureStruct.New(syntacticFeatSys).Symbol("V").Value, Morphophonemic, "dag"); entry.PrimaryAllomorph.IsBound = true; Language = new Language { Name = "Test", PhonologicalFeatureSystem = phonologicalFeatSys, SyntacticFeatureSystem = syntacticFeatSys, Strata = { Morphophonemic, Allophonic, Surface } }; }
private void LoadLanguage(XElement langElem) { _language = new Language { Name = (string) langElem.Element("Name") }; IEnumerable<FeatureSymbol> posSymbols = langElem.Elements("PartsOfSpeech").Elements("PartOfSpeech") .Select(e => new FeatureSymbol((string) e.Attribute("id"), (string) e.Element("Name"))); _posFeature = _language.SyntacticFeatureSystem.AddPartsOfSpeech(posSymbols); XElement phonFeatSysElem = langElem.Elements("PhonologicalFeatureSystem").SingleOrDefault(IsActive); if (phonFeatSysElem != null) LoadPhonologicalFeatureSystem(phonFeatSysElem); _language.PhonologicalFeatureSystem.Freeze(); XElement headFeatsElem = langElem.Element("HeadFeatures"); if (headFeatsElem != null) { _headFeature = _language.SyntacticFeatureSystem.AddHeadFeature(); LoadSyntacticFeatureSystem(headFeatsElem, SyntacticFeatureType.Head); } XElement footFeatsElem = langElem.Element("FootFeatures"); if (footFeatsElem != null) { _footFeature = _language.SyntacticFeatureSystem.AddFootFeature(); LoadSyntacticFeatureSystem(footFeatsElem, SyntacticFeatureType.Foot); } _language.SyntacticFeatureSystem.Freeze(); foreach (XElement mfElem in langElem.Elements("MorphologicalPhonologicalRuleFeatures").Elements("MorphologicalPhonologicalRuleFeature").Where(IsActive)) { var mprFeature = new MprFeature {Name = (string) mfElem}; _language.MprFeatures.Add(mprFeature); _mprFeatures[(string) mfElem.Attribute("id")] = mprFeature; } foreach (XElement mprFeatGroupElem in langElem.Elements("MorphologicalPhonologicalRuleFeatures").Elements("MorphologicalPhonologicalRuleFeatureGroup").Where(IsActive)) LoadMprFeatGroup(mprFeatGroupElem); foreach (XElement stemNameElem in langElem.Elements("StemNames").Elements("StemName")) LoadStemName(stemNameElem); foreach (XElement charDefTableElem in langElem.Elements("CharacterDefinitionTable").Where(IsActive)) LoadCharacterDefinitionTable(charDefTableElem); foreach (XElement natClassElem in langElem.Elements("NaturalClasses").Elements().Where(IsActive)) LoadNaturalClass(natClassElem); foreach (XElement familyElem in langElem.Elements("Families").Elements("Family").Where(IsActive)) { var family = new LexFamily {Name = (string) familyElem}; _language.Families.Add(family); _families[(string) familyElem.Attribute("id")] = family; } foreach (XElement pruleElem in langElem.Elements("PhonologicalRuleDefinitions").Elements().Where(IsActive)) LoadPhonologicalRule(pruleElem); foreach (XElement stratumElem in langElem.Elements("Strata").Elements("Stratum").Where(IsActive)) LoadStratum(stratumElem); foreach (XElement coOccurElem in langElem.Elements("MorphemeCoOccurrenceRules").Elements("MorphemeCoOccurrenceRule").Where(IsActive)) LoadMorphemeCoOccurrenceRule(coOccurElem); foreach (XElement coOccurElem in langElem.Elements("AllomorphCoOccurrenceRules").Elements("AllomorphCoOccurrenceRule").Where(IsActive)) LoadAllomorphCoOccurrenceRule(coOccurElem); }