예제 #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());
        }
예제 #2
0
 public Grammar(Vocabulary voc) : this()
 {
     Vocabulary = voc;
 }
예제 #3
0
 public Grammar(Vocabulary voc) : this()
 {
     Vocabulary = voc;
 }
예제 #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;
 }