Ejemplo n.º 1
0
 private static void getWord(SemanticValueDict Semantics, Slots slot, List<string> keywords)
 {
     if (Semantics.HasSlot(slot))
      {
     keywords.Add(Semantics.GetSlot(slot));
      }
 }
Ejemplo n.º 2
0
 public static Course ContructCourse(SemanticValueDict semantics)
 {
     if (semantics.HasSlot(Slots.CourseName))
      {
     String courseName = semantics.GetSlot(Slots.CourseName);
     Course course = CourseCatalog.Instance.Courses.Find(c => c.ToString().Equals(courseName));
     return course;
      }
      else if (semantics.HasSlot(Slots.Department) && semantics.HasSlot(Slots.Number))
      {
     String Department = semantics[Slots.Department.ToString()].Value.ToString();
     int Number = (int)semantics[Slots.Number.ToString()].Value;
     IFilter<Course> filter = CourseFilter.DeptAbv(Department).And(CourseFilter.Number(Number, Operator.EQ));
     return CourseCatalog.Instance.GetCourses(filter).FirstOrDefault();
      }
      else if (DialogManager.Instance.CurrentCourse != null)
      {
     return DialogManager.Instance.CurrentCourse;
      }
      return null;
 }
Ejemplo n.º 3
0
 private bool isJunkSpeech(SemanticValueDict semantics)
 {
     if (semantics.Count() == 1 && semantics.HasSlot(Slots.CourseAnaphora))
      {
     return true;
      }
      return false;
 }
Ejemplo n.º 4
0
 internal static bool IsCourseDataValid(SemanticValueDict semantics)
 {
     if (semantics.HasSlot(Slots.CourseName))
      {
     return true;
      }
      else
      {
     String dept = semantics.GetSlot(Slots.Department);
     String num = semantics.GetSlot(Slots.Number);
     IEnumerable<Course> courses = CourseCatalog.Instance.Courses.Where(c => c.Dept.Abv.Equals(dept) && c.Number.Equals(int.Parse(num)));
     return courses.Count() > 0;
      }
 }
Ejemplo n.º 5
0
 public static List<Slots> SemanticsContainsCourseData(SemanticValueDict course)
 {
     List<Slots> missing = new List<Slots>();
      if (!course.HasSlot(Slots.CourseName))
      {
     if (!course.ContainsKey(Slots.Department.ToString()))
     {
        missing.Add(Slots.Department);
     }
     if (!course.ContainsKey(Slots.Number.ToString()))
     {
        missing.Add(Slots.Number);
     }
      }
      return missing;
 }