This repository has been archived by the owner on May 23, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item resolver implementation with ESH semantics (#24)
BREAKING: Requires an openHAB distribution including openhab/openhab-core#415 to work! Related to eclipse-archived/smarthome#6288. Requires compatible tags. Extract name samples from tags, item labels & synonyms (comma-separated strings in the "synonyms" metadata namespace) Other misc changes: * Fix location dropdown counters in card deck * Fix invisible send button in chat text field * Better title & subtitle in generated chart cards * Expand matched groups automatically * Fail most skills if no entities found Signed-off-by: Yannick Schaus <habpanel@schaus.net>
- Loading branch information
Showing
23 changed files
with
448 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright (c) 2010-2018 by the respective copyright holders. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.openhab.ui.habot.nlp; | ||
|
||
import java.util.Locale; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.stream.Stream; | ||
|
||
import org.eclipse.smarthome.core.items.Item; | ||
import org.openhab.ui.habot.nlp.internal.IntentTrainer; | ||
|
||
import opennlp.tools.namefind.NameSample; | ||
|
||
/** | ||
* This interface is used to find items matching entities extracted from the | ||
* user natural language query: object - "what" and location - "where". It also acts as a supplemental source of @link | ||
* {@link NameSample}s for the {@link IntentTrainer} | ||
* | ||
* @author Yannick Schaus | ||
*/ | ||
public interface ItemResolver { | ||
|
||
/** | ||
* Sets the current locale. | ||
* The ItemResolver will receive object and location entities in that locale. | ||
* | ||
* @param locale | ||
*/ | ||
void setLocale(Locale locale) throws UnsupportedLanguageException; | ||
|
||
/** | ||
* Resolves items matching the provided object and/or location extracted from user's query using named-entity | ||
* recognition in the current locale. | ||
* If a non-null object and a non-null location are provided, | ||
* items shall match both. | ||
* | ||
* @param object the object extracted from the intent (or null) | ||
* @param location the location extracted from the intent (or null) | ||
* @return a stream of matching items (groups included) | ||
*/ | ||
Stream<Item> getMatchingItems(String object, String location); | ||
|
||
/** | ||
* Gets all named attributes for all items | ||
* | ||
* @return a map of the {@link ItemNamedAttribute}s by item | ||
*/ | ||
Map<Item, Set<ItemNamedAttribute>> getAllItemNamedAttributes() throws UnsupportedLanguageException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.