internal Orthography(Alphabet alphabet, IEnumerable<OrthographyRule> rules) { Alphabet = alphabet; foreach (OrthographyRule rule in rules) { _rules.Add(rule.Id, rule); } }
protected ConditionBase(string position, string operand, Alphabet alphabet) { if (!Enum.TryParse(position, out Position)) { throw new ArgumentException("Invalid Morpheme Location: " + position); } Operand = operand; Alphabet = alphabet; }
public static ConditionBase Create(string name, string morphemePosition, string operand, Alphabet alphabet) { switch (name) { case "EndsWithConsonant": return new EndsWithConsonant(morphemePosition, operand, alphabet); case "EndsWithVowel": return new EndsWithVowel(morphemePosition, operand, alphabet); case "FirstLetterEquals": return new FirstLetterEquals(morphemePosition, operand, alphabet); case "LastLetterEquals": return new LastLetterEquals(morphemePosition, operand, alphabet); case "LastVowelEquals": return new LastVowelEquals(morphemePosition, operand, alphabet); case "MorphemeEquals": return new MorphemeEquals(morphemePosition, operand, alphabet); case "MorphemeExists": return new MorphemeExists(morphemePosition, operand, alphabet); case "MorphemeNotEquals": return new MorphemeNotEquals(morphemePosition, operand, alphabet); case "MorphemeSequenceEquals": return new MorphemeSequenceEquals(morphemePosition, operand, alphabet); case "PenultVowelEquals": return new PenultVowelEquals(morphemePosition, operand, alphabet); case "StartsWithConsonant": return new StartsWithConsonant(morphemePosition, operand, alphabet); case "StartsWithVowel": return new StartsWithVowel(morphemePosition, operand, alphabet); case "HasFlags": return new HasLabel(morphemePosition, operand, alphabet); case "HasNotFlags": return new HasNotLabel(morphemePosition, operand, alphabet); case "IsLastMorpheme": return new IsLastMorpheme(morphemePosition, operand, alphabet); case "IsNotLastMorpheme": return new IsNotLastMorpheme(morphemePosition, operand, alphabet); case "IsFirstMorpheme": return new IsFirstMorpheme(morphemePosition, operand, alphabet); case "IsNotFirstMorpheme": return new IsNotFirstMorpheme(morphemePosition, operand, alphabet); default: throw new ArgumentException("Invalid Condition: " + name); } }
private MorphotacticsReader(Stream xml, Alphabet alphabet) { _alphabet = alphabet; try { _xDocument = XDocument.Load(xml); } catch (XmlException ex) { throw new XmlException("Invalid morphotactics XML: " + ex.Message); } _suffixGroupElements = GetSuffixGroupElements(); _transitionSets = GetTransitionSetElements(); BuildGraph(); }
public static Morphotactics Read(Stream xml, Alphabet alphabet) { _alphabet = alphabet; XDocument doc; try { doc = XDocument.Load(xml); } catch (XmlException ex) { throw new XmlException("Invalid morphotactics XML: " + ex.Message); } _suffixGroupElements = GetSuffixGroupElements(doc); _transitionSetElements = GetTransitionSetElements(doc); BuildGraph(); return new Morphotactics(Graph); }
public static Morphotactics Read(Stream xml, Alphabet alphabet) { _alphabet = alphabet; XDocument doc = null; try { doc = XDocument.Load(xml); } catch (XmlException ex) { throw new XmlException("Invalid morphotactics XML: " + ex.Message); } SUFFIX_GROUP_ELEMENTS = GetSuffixGroupElements(doc); TRANSITION_SET_ELEMENTS = GetTransitionSetElements(doc); BuildGraph(); return new Morphotactics(Graph); }
public IsNotLastMorpheme(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }
public MorphemeExists(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }
private OrthographyReader(XmlDocument xml) { _xml = xml; _alphabet = ReadAlphabet(); _rules = ReadRules(); }
public HasNotLabel(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }
public HasLabel(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { _label = LabelSet.ConvertLabelNameToIndex(operand); }
public LastLetterEquals(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }
public MorphemeNotEquals(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }
public EndsWithConsonant(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }
public HasLabel(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { _label = operand; }
public MorphemeSequenceEquals(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { _sequence = Operand.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); }
public static Morphotactics Read(Stream xml, Alphabet alphabet) { var reader = new MorphotacticsReader(xml, alphabet); return new Morphotactics(reader._graph); }
public static Orthography Read(XmlDocument xml) { _alphabet = ReadAlphabet(xml); IEnumerable<OrthographyRule> rules = ReadRules(xml); return new Orthography(_alphabet, rules); }
public EndsWithVowel(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }
public PenultVowelEquals(string position, string operand, Alphabet alphabet) : base(position, operand, alphabet) { }