Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
feature: allow access to the current NLUService
Browse files Browse the repository at this point in the history
  • Loading branch information
space-pope committed Dec 14, 2020
1 parent b4f2367 commit 5433f64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/io/spokestack/spokestack/nlu/NLUManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ private NLUService buildService() throws Exception {
return (NLUService) constructed;
}

/**
* Get the NLU service currently in use.
*
* @return The current NLU service.
*/
public NLUService getNlu() {
return nlu;
}

/**
* Releases resources in use by the NLU module.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/io/spokestack/spokestack/SpokestackTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public void testClose() throws Exception {
// modules don't work after close()
spokestack.close();
assertNull(spokestack.getTts().getTtsService());
assertNull(spokestack.getNlu().getNlu());
assertThrows(
IllegalStateException.class,
() -> spokestack.classify("test"));
Expand All @@ -330,6 +331,7 @@ public void testClose() throws Exception {
// restart supported
spokestack.prepare();
assertNotNull(spokestack.getTts().getTtsService());
assertNotNull(spokestack.getNlu().getNlu());
assertDoesNotThrow(() -> spokestack.classify("test"));
assertDoesNotThrow(() -> spokestack.synthesize(request));
}
Expand Down

0 comments on commit 5433f64

Please sign in to comment.