Skip to content

Commit

Permalink
Nova ikono
Browse files Browse the repository at this point in the history
  • Loading branch information
nordfalk committed Jul 8, 2022
1 parent 1f31e23 commit 2762a6c
Show file tree
Hide file tree
Showing 21 changed files with 234 additions and 44 deletions.
33 changes: 4 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

### [Esperanto]

Jen eta provi fari parolrekonilon uzante la Vosk parolrekona modelo.01
(vosk-model-small-eo-0.22)
Android Esperanto Parolrekono rekonas vian parolon en Esperanto kaj provizas la tekston.

Ĝi baziĝas sur la Vosk parolrekona modelo por Esperanto (vosk-model-small-eo-0.42) trovebla ĉe https://alphacephei.com/vosk/models.


Vi povas elŝuti de https://javabog.dk/privat/EsperantoParolRekono.apk

Expand Down Expand Up @@ -46,34 +48,7 @@ If you want to use the application with your language just replace the models in

- Does not work with Google's keyboard "GBoard".
- Not all record applications read the voice text properly, there must be another way---and if you know how, it is probably a trivial fix.
- DeepSpeech models were removed, they didn't build! Maybe it can be fixed?

#### Future Work

- Support query alphacephei.com and suppport selection+download of optional models. Then this apk can be packaged _without_ a language (much smaller!).

#### Demo

![LocalSTT in action](./demo.gif)

### [Català]

> **Nota: Aquesta aplicació de moment només és una prova de concepte**
LocalSTT és una aplicació per Android que proporciona reconeixement automàtic de la parla sense necessitat de conexió a internet ja que tot el processament és local al mòbil.

Això és possible gràcies a:
- un RecognitionService que utilitza la llibreria de Vosk
- un RecognitionService que utilitza la lliberia de Mozilla Deepspeech
- una Activity que gestiona intents RECOGNIZE_SPEECH entre altres

El codi és actualment una prova de concepte i es basa fortament en els següents projectes:
- [Kõnele](https://github.com/Kaljurand/K6nele)
- [Vosk Android Demo](https://github.com/alphacep/vosk-android-demo)

LocalSTT hauria de funcionar amb la majoria de teclats i aplicacions que implementen la funció de reconeixement de veu a través d'un intent RECOGNIZE_SPEECH o directament fent servir la classe SpeechRecognizer d'Android. Ha estat provada amb èxit fent servir les següent aplicacions en un terminal Android 9:
- [AnySoftKeyboard](https://github.com/AnySoftKeyboard/AnySoftKeyboard)
- [Kõnele](https://github.com/Kaljurand/K6nele)
- [SwiftKey](https://www.swiftkey.com)

Us podeu descarregar un APK que inclou models de Vosk i DeepSpeech pel català [aquí](https://github.com/ccoreilly/LocalSTT/releases/download/2020-12-03/localstt.apk).
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<application
android:allowBackup="false"
android:icon="@drawable/ic_service_trigger"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:launchMode="standard"
android:theme="@style/AppTheme">
Expand Down Expand Up @@ -100,7 +100,7 @@
<service
android:name=".VoskRecognitionService"
android:process=":speechProcess"
android:icon="@drawable/ic_service_trigger"
android:icon="@drawable/ic_esperanta_parolrekono"
android:label="@string/recognition_service_label"
android:description="@string/recognition_service_description"
android:permission="android.permission.RECORD_AUDIO">
Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,14 @@ protected void toast(String message) {
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.speech_activity);
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
checkPermission();
}

editText = findViewById(R.id.editText);
speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this);

speechRecognizer.setRecognitionListener(new RecognitionListener() {
@Override
public void onReadyForSpeech(Bundle bundle) {

Log.i(TAG, "onReadyForSpeech "+bundle);
editText.setHint("onReadyForSpeech");
}

@Override
Expand Down Expand Up @@ -122,7 +118,11 @@ public void onEvent(int i, Bundle bundle) {
public void onStart() {
super.onStart();
Log.i(TAG, "onStart");
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
checkPermission();
}
final Intent speechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Parolu nun");
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
speechRecognizer.startListening(speechRecognizerIntent);
Expand All @@ -137,19 +137,16 @@ protected void onDestroy() {

private void checkPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.RECORD_AUDIO },
RecordAudioRequestCode);
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.RECORD_AUDIO }, RecordAudioRequestCode);
}
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == RecordAudioRequestCode && grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED)
Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
}
}

}
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/ic_esperanta_parolrekono.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12.045,0.337 L14.842,9.062 24.006,9.026 16.571,14.383 19.437,23.086 12.045,17.671 4.652,23.086 7.518,14.383 0.083,9.026 9.247,9.062Z"
android:strokeLineJoin="miter"
android:strokeWidth="0.181"
android:fillColor="#007f00"
android:fillType="evenOdd"
android:strokeLineCap="butt">
</path>
<path
android:pathData="m12.095,13.473c1.125,0 1.985,-0.78 1.985,-1.799L14.081,8.075c0,-1.02 -0.86,-1.799 -1.985,-1.799 -1.125,0 -1.985,0.78 -1.985,1.799v3.599c0,1.02 0.86,1.799 1.985,1.799zM15.603,11.673c0,1.799 -1.655,3.059 -3.508,3.059 -1.853,0 -3.508,-1.26 -3.508,-3.059L7.462,11.673c0,2.039 1.787,3.719 3.971,4.019v1.979h1.324v-1.979c2.184,-0.3 3.971,-1.979 3.971,-4.019z"
android:strokeWidth="0.630035"
android:fillColor="#e5e5e5"/>
</vector>
74 changes: 74 additions & 0 deletions app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
24 changes: 24 additions & 0 deletions app/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="2.925"
android:scaleY="2.925"
android:translateX="18.9"
android:translateY="18.9">
<path
android:pathData="M12.045,0.337 L14.842,9.062 24.006,9.026 16.571,14.383 19.437,23.086 12.045,17.671 4.652,23.086 7.518,14.383 0.083,9.026 9.247,9.062Z"
android:strokeLineJoin="miter"
android:strokeWidth="0.181"
android:fillColor="#007f00"
android:fillType="evenOdd"
android:strokeLineCap="butt">
</path>
<path
android:pathData="m12.095,13.473c1.125,0 1.985,-0.78 1.985,-1.799L14.081,8.075c0,-1.02 -0.86,-1.799 -1.985,-1.799 -1.125,0 -1.985,0.78 -1.985,1.799v3.599c0,1.02 0.86,1.799 1.985,1.799zM15.603,11.673c0,1.799 -1.655,3.059 -3.508,3.059 -1.853,0 -3.508,-1.26 -3.508,-3.059L7.462,11.673c0,2.039 1.787,3.719 3.971,4.019v1.979h1.324v-1.979c2.184,-0.3 3.971,-1.979 3.971,-4.019z"
android:strokeWidth="0.630035"
android:fillColor="#e5e5e5"/>
</group>
</vector>
6 changes: 4 additions & 2 deletions app/src/main/res/layout/speech_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
android:layout_marginBottom="20dp"
android:layout_marginLeft="16dp"
android:hint="@string/loading"
android:textColorHint="@color/colorPrimaryDark"
android:textColor="@color/colorPrimary"
android:id="@+id/editText"
android:layout_centerInParent="true"
/>
<!--
android:textColorHint="@color/colorPrimaryDark"
android:textColor="@color/colorPrimary"
-->
</LinearLayout>
</RelativeLayout>
5 changes: 5 additions & 0 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions esperanta_parolrekono.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2762a6c

Please sign in to comment.