Search in sources :

Example 11 with IntentTrainer

use of org.openhab.ui.habot.nlp.internal.IntentTrainer in project habot by ghys.

the class TrainerDeTest method testSetValue.

@Test
public void testSetValue() throws Exception {
    Intent actual;
    this.trainer = new IntentTrainer("de", skills, null, "alphanumeric");
    actual = interpret("stell den Thermostat auf 21 Grad.");
    assertEquals(Skills.SET_VALUE, actual.getName());
    assertEquals(2, actual.getEntities().size());
    assertEquals("thermostat", actual.getEntities().get("object"));
    assertEquals("21", actual.getEntities().get("value"));
    actual = interpret("Temperatur auf 21 Grad erhöhen.");
    assertEquals(Skills.SET_VALUE, actual.getName());
    assertEquals(2, actual.getEntities().size());
    assertEquals("temperatur", actual.getEntities().get("object"));
    assertEquals("21", actual.getEntities().get("value"));
    actual = interpret("Dimme das Licht auf 70%");
    assertEquals(Skills.SET_VALUE, actual.getName());
    assertEquals(2, actual.getEntities().size());
    assertEquals("licht", actual.getEntities().get("object"));
    assertEquals("70", actual.getEntities().get("value"));
    actual = interpret("Dimme das Licht im Wohnzimmer auf 70%");
    assertEquals(Skills.SET_VALUE, actual.getName());
    assertEquals(3, actual.getEntities().size());
    assertEquals("licht", actual.getEntities().get("object"));
    assertEquals("wohnzimmer", actual.getEntities().get("location"));
    assertEquals("70", actual.getEntities().get("value"));
    actual = interpret("Regle im Wohnzimmer die Lautstärke auf 50");
    assertEquals(Skills.SET_VALUE, actual.getName());
    assertEquals(3, actual.getEntities().size());
    assertEquals("lautstärke", actual.getEntities().get("object"));
    assertEquals("wohnzimmer", actual.getEntities().get("location"));
    assertEquals("50", actual.getEntities().get("value"));
    actual = interpret("Färbe das Licht grün");
    assertEquals(Skills.SET_VALUE, actual.getName());
    assertEquals(2, actual.getEntities().size());
    assertEquals("licht", actual.getEntities().get("object"));
    assertEquals("grün", actual.getEntities().get("value"));
}
Also used : IntentTrainer(org.openhab.ui.habot.nlp.internal.IntentTrainer) Intent(org.openhab.ui.habot.nlp.Intent) Test(org.junit.Test)

Example 12 with IntentTrainer

use of org.openhab.ui.habot.nlp.internal.IntentTrainer in project habot by ghys.

the class TrainerDeTest method testCreateRule.

@Test
public void testCreateRule() throws Exception {
    Intent actual;
    this.trainer = new IntentTrainer("de", skills, null, "alphanumeric");
    actual = interpret("einen Timer stellen");
    assertEquals(Skills.CREATE_RULE, actual.getName());
    actual = interpret("Erstelle eine Regel, die um 8 Uhr läuft.");
    assertEquals(Skills.CREATE_RULE, actual.getName());
}
Also used : IntentTrainer(org.openhab.ui.habot.nlp.internal.IntentTrainer) Intent(org.openhab.ui.habot.nlp.Intent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 IntentTrainer (org.openhab.ui.habot.nlp.internal.IntentTrainer)12 Intent (org.openhab.ui.habot.nlp.Intent)11