Search in sources :

Example 16 with Intent

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

the class TrainerDeTest method testHistoryWeekly.

@Test
public void testHistoryWeekly() throws Exception {
    Intent actual;
    this.trainer = new IntentTrainer("de", skills, null, "alphanumeric");
    actual = interpret("Verlauf der Temperatur der letzten Woche");
    assertEquals(Skills.GET_HISTORY_WEEKLY, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("temperatur", actual.getEntities().get("object"));
    actual = interpret("Verlauf der Luftfeuchtigkeit der letzten Woche");
    assertEquals(Skills.GET_HISTORY_WEEKLY, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("luftfeuchtigkeit", actual.getEntities().get("object"));
    actual = interpret("zeige die Wochenübersicht der Temperatur für die Küche");
    assertEquals(Skills.GET_HISTORY_WEEKLY, actual.getName());
    assertEquals(2, actual.getEntities().size());
    assertEquals("temperatur", actual.getEntities().get("object"));
    assertEquals("küche", actual.getEntities().get("location"));
}
Also used : IntentTrainer(org.openhab.ui.habot.nlp.internal.IntentTrainer) Intent(org.openhab.ui.habot.nlp.Intent) Test(org.junit.Test)

Example 17 with Intent

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

the class TrainerDeTest method testHistoryDaily.

@Test
public void testHistoryDaily() throws Exception {
    Intent actual;
    this.trainer = new IntentTrainer("de", skills, null, "alphanumeric");
    actual = interpret("Verlauf der Temperatur der letzten 24 Stunden");
    assertEquals(Skills.GET_HISTORY_DAILY, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("temperatur", actual.getEntities().get("object"));
    actual = interpret("Verlauf der Luftfeuchtigkeit der letzten 24 Stunden");
    assertEquals(Skills.GET_HISTORY_DAILY, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("luftfeuchtigkeit", actual.getEntities().get("object"));
}
Also used : IntentTrainer(org.openhab.ui.habot.nlp.internal.IntentTrainer) Intent(org.openhab.ui.habot.nlp.Intent) Test(org.junit.Test)

Example 18 with Intent

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

the class TrainerDeTest method testActivateObjects.

@Test
public void testActivateObjects() throws Exception {
    Intent actual;
    this.trainer = new IntentTrainer("de", skills);
    actual = interpret("mach den Fernseher an");
    assertEquals(Skills.ACTIVATE_OBJECT, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("fernseher", actual.getEntities().get("object"));
    actual = interpret("bitte mache das Licht an");
    assertEquals(Skills.ACTIVATE_OBJECT, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("licht", actual.getEntities().get("object"));
}
Also used : IntentTrainer(org.openhab.ui.habot.nlp.internal.IntentTrainer) Intent(org.openhab.ui.habot.nlp.Intent) Test(org.junit.Test)

Example 19 with Intent

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

the class TrainerDeTest method testHistoryMonthly.

@Test
public void testHistoryMonthly() throws Exception {
    Intent actual;
    this.trainer = new IntentTrainer("de", skills, null, "alphanumeric");
    actual = interpret("Verlauf der Temperatur des letzten Monats");
    assertEquals(Skills.GET_HISTORY_MONTHLY, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("temperatur", actual.getEntities().get("object"));
    actual = interpret("Verlauf der Luftfeuchtigkeit des letzten Monats");
    assertEquals(Skills.GET_HISTORY_MONTHLY, actual.getName());
    assertEquals(1, actual.getEntities().size());
    assertEquals("luftfeuchtigkeit", actual.getEntities().get("object"));
    actual = interpret("Monatsübersicht der Temperatur für die Küche");
    assertEquals(Skills.GET_HISTORY_MONTHLY, actual.getName());
    assertEquals(2, actual.getEntities().size());
    assertEquals("temperatur", actual.getEntities().get("object"));
    assertEquals("küche", actual.getEntities().get("location"));
}
Also used : IntentTrainer(org.openhab.ui.habot.nlp.internal.IntentTrainer) Intent(org.openhab.ui.habot.nlp.Intent) Test(org.junit.Test)

Example 20 with Intent

use of org.openhab.ui.habot.nlp.Intent 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)

Aggregations

Intent (org.openhab.ui.habot.nlp.Intent)21 Test (org.junit.Test)11 IntentTrainer (org.openhab.ui.habot.nlp.internal.IntentTrainer)11 Set (java.util.Set)7 Collectors (java.util.stream.Collectors)7 Item (org.eclipse.smarthome.core.items.Item)7 ItemRegistry (org.eclipse.smarthome.core.items.ItemRegistry)7 Reference (org.osgi.service.component.annotations.Reference)7 IntentInterpretation (org.openhab.ui.habot.nlp.IntentInterpretation)5 Skill (org.openhab.ui.habot.nlp.Skill)5 EventPublisher (org.eclipse.smarthome.core.events.EventPublisher)4 AbstractItemIntentInterpreter (org.openhab.ui.habot.nlp.AbstractItemIntentInterpreter)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 Collection (java.util.Collection)3 List (java.util.List)3 ItemEventFactory (org.eclipse.smarthome.core.items.events.ItemEventFactory)3 TransformationHelper (org.eclipse.smarthome.core.transform.TransformationHelper)3 State (org.eclipse.smarthome.core.types.State)3 StateDescription (org.eclipse.smarthome.core.types.StateDescription)3 CardBuilder (org.openhab.ui.habot.card.CardBuilder)3