예제 #1
0
파일: Orthography.cs 프로젝트: hrzafer/nuve
 internal Orthography(Alphabet alphabet, IEnumerable<OrthographyRule> rules)
 {
     Alphabet = alphabet;
     foreach (OrthographyRule rule in rules)
     {
         _rules.Add(rule.Id, rule);
     }
 }
예제 #2
0
 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;
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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();
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
 public IsNotLastMorpheme(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }
예제 #8
0
 public MorphemeExists(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }
예제 #9
0
 private OrthographyReader(XmlDocument xml)
 {
     _xml = xml;
     _alphabet = ReadAlphabet();
     _rules = ReadRules();
 }
예제 #10
0
파일: HasNotLabel.cs 프로젝트: hrzafer/nuve
 public HasNotLabel(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }
예제 #11
0
파일: HasLabel.cs 프로젝트: diegolinan/nuve
 public HasLabel(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
     _label = LabelSet.ConvertLabelNameToIndex(operand);
 }
예제 #12
0
 public LastLetterEquals(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }
예제 #13
0
 public MorphemeNotEquals(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }
예제 #14
0
 public EndsWithConsonant(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }
예제 #15
0
파일: HasLabel.cs 프로젝트: hrzafer/nuve
 public HasLabel(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
     _label = operand;
 }
예제 #16
0
 public MorphemeSequenceEquals(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
     _sequence = Operand.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
 }
예제 #17
0
 public static Morphotactics Read(Stream xml, Alphabet alphabet)
 {
     var reader = new MorphotacticsReader(xml, alphabet);
     return new Morphotactics(reader._graph);
 }
예제 #18
0
 public static Orthography Read(XmlDocument xml)
 {
     _alphabet = ReadAlphabet(xml);
     IEnumerable<OrthographyRule> rules = ReadRules(xml);
     return new Orthography(_alphabet, rules);
 }
예제 #19
0
 public EndsWithVowel(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }
예제 #20
0
 public PenultVowelEquals(string position, string operand, Alphabet alphabet)
     : base(position, operand, alphabet)
 {
 }