-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to whispe.cpp 1.5.0 and use grammar parser
- Loading branch information
Showing
13 changed files
with
271 additions
and
42 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
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
28 changes: 28 additions & 0 deletions
28
src/main/java/io/github/givimad/whisperjni/WhisperGrammar.java
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,28 @@ | ||
package io.github.givimad.whisperjni; | ||
|
||
/** | ||
* The {@link WhisperGrammar} class represents a native whisper.cpp parsed grammar. | ||
* | ||
* You need to dispose the native memory for its instances by calling {@link #close} | ||
* | ||
* @author Miguel Álvarez Díez - Initial contribution | ||
*/ | ||
public class WhisperGrammar extends WhisperJNI.WhisperJNIPointer { | ||
private final WhisperJNI whisper; | ||
private final String grammarText; | ||
|
||
/** | ||
* Internal context constructor | ||
* @param whisper library instance | ||
* @param ref native pointer identifier | ||
*/ | ||
protected WhisperGrammar(WhisperJNI whisper, int ref, String text) { | ||
super(ref); | ||
this.whisper = whisper; | ||
this.grammarText = text; | ||
} | ||
@Override | ||
public void close() { | ||
whisper.free(this); | ||
} | ||
} |
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.