teaching machines

Custom Activity in Unity

Goal: I want to trigger Android activity-level code in my Unity 3D application. Here’s a minimal example of doing so: Create a new Android project in Eclipse. We won’t be using many of the ADT plugin features. We mostly leverage the compiler and editor. Override UnityPlayerActivity with a custom activity: Add C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar to the […]

Levenshtein distance

We’re looking at methods for comparing the distance between two sequences of text. A fairly simple one is Levenshtein distance, which calculates how many edits it takes to go from one string to another. I wrote a little calculator to demonstrate its results. Enter two words and calculate their distance. Cell (i, j) reports the minimum […]

Timing Android voice recognition

I was curious whether the EXTRA_MAX_RESULTS value affected the time it takes to get voice recognition results back to an Android device, so I ran a couple of quick tests. In the first, I spoke the phrase “Binky the ball bounced away” a few times each for different EXTRA_MAX_RESULTS settings. I tried 1, 5, 20, […]

Voice recognition sans dialog box

Android provides a nice speech recognition system. Many examples show how you can push out an ACTION_RECOGNIZE_SPEECH intent to trigger an Activity that shows the listening status on a big dialog box. I wanted speech recognition without the dialog box and was able to do so with the following code: The XML layout defines a […]