Beispiel #1
0
        public Learner(Vocabulary v, Dictionary<string, string> n, HashSet<string> p,
            string[] s, Grammar o)
        {
            voc = v;
            nonTerminalTypeDic = n;
            posTypes = p;
            originalGrammar = o;

            sentencesWithCounts = s.GroupBy(x => x).ToDictionary(g => g.Key, g => g.Count());
        }
Beispiel #2
0
 public Grammar(Vocabulary voc) : this()
 {
     Vocabulary = voc;
 }
Beispiel #3
0
 public Grammar(Vocabulary voc) : this()
 {
     Vocabulary = voc;
 }
Beispiel #4
0
 public static Grammar GetGrammarFromFile(string jsonFileName, Vocabulary voc)
 {
     var grammar = JsonConvert.DeserializeObject<Grammar>(File.ReadAllText(jsonFileName));
     grammar.Vocabulary = voc;
     grammar.PopulateDependentJsonPropertys();
     return grammar;
 }