0.8.0-beta
This release implements morphological analysis of subtitles with the MeCab text segmentation library, enabling users to tap to select words in the subtitles during video playback.
In the menu, users will find a new option that will allow them to freely toggle between "Tap to Select" and "Drag to Select" text selection modes. The app will always default to the last used text selection mode. More details on the decisions and approaches towards handling text segmentation and selection in this application is detailed below the release notes.
Android 11 users: A reminder that use of the app on Android 11 and above requires a workaround in regards to storage permission which fixes issues with exporting to AnkiDroid. Please do not forget to read how to set up the required workaround to export files on Android 11.
0.8.0-beta
- (New Feature) Tap to select mode is now possible with text segmentation (thanks to mecab_dart)
- Users can now toggle between the faster tap to select and more precise drag to select text selection modes in the menu
- Changed the formatting of the subtitles, improved wrapping with significant changes to widgets making both selection modes look identical
- Changed the condition of showing the export timeout message so that it would not show up on speedy exports
- Fixed an inconsistency in the accent colors in the audio/subtitle selection menu
A video preview on tap to select
Development notes on implementing text segmentation
Since the release of this application, I have talked with several users about text segmentation, and they were curious as to why I initially implemented drag to select instead of the tap to select feature debuting with this release. The implementation of this well desired mode has many jagged edges made to look pretty -- it's not some super complex computer science problem, but it took quite a while to figure out how to get it to this point where it works and appear decently enough that I feel compelled to write about it.
With drag to select, two text widgets are overlaid on top of each other and made to be interactive, as you would with a text field, which was very intuitive. With tap to select, the subtitles are first run through the MeCab parser, newlines and spaces replaced with appropriate delimiters and then split into morphemes that make up separate interactive widgets that can be clicked.
The root widget that displays all subtitles is two nested builders, one for the translucent outline and another for the white text, just like the above paragraph. But instead of simple text widgets, it uses a generator to build rows with a list of list of strings, and within each row or line of text is a list of strings for which each element must build a text widget with the appropriate on-click callback. When generating the list of list of strings from the tokens returned from the MeCab parser, each list must be cut once a newline delimiter is found or if it is getting too long and may overflow when rendered.
Luckily, getting the definition is much easier. The entire text selection from the morpheme selected to the end of string is passed to Jisho.org, and I was very thankful that they always return a result relevant to the head of the string I send to their API. It's a very hacky implementation that doesn't involve implementing the Jisho.org parser itself in Dart (which I may plan to do if I ever try to get the app to work independently of Jisho.org when offline, and thanks to a response from Kim from Jisho.org, I may be able to get to that soon), but it works - and was a very fun test of what I can do with Flutter widgets.
Splitting Japanese characters into the individual words with perfect results may still be a problem for machines (and really much of the work is still done by Jisho's Ve parser here), but the end result is very much functional, and many users may decide to go with it. However, in the edge cases, it may cause more frustration than convenience. And as proclaimed time and again by immersion learners, "Language is highly specific in unpredictable ways".
With very informal or so language, a human can know where they should start the text selection and end it to get exactly what they want to query, but with an algorithm deciding the selection, it may lead to frustration. Users can get irritated more than occasionally realising the machine has selected text for them that they don't think was right at all - and that's even before they see the definition output. That's why rather than that, I offer the drag to select option for the user to decide exactly what they want to know -- especially because occasionally even Jisho.org returns blanks for a lot of words that a human would know from intuition. In addition, I am of the belief that intermediate learners must develop the skill of breaking down the words to what they see and work towards to the point of being advanced to pick whatever they want.
In the end, tap to select is faster while drag to select is more precise -- and as a project like this must ideally be unopinionated for any learner to use and pick up, I worked quite hard and enjoyed getting both modes to feature parity. I hope that any and all users enjoy whichever mode they choose, and I hope to further improve the text segmentation of this application. Any feedback on the feature is much appreciated.
Which file should I download?
The files below include those tagged android11
and otherwise. Pick the appropriate file for your Android version.
- Android 11 and above users will need to cache the video before playback due to scoped storage restrictions. Download the file with
android11
. - Android 10 and below users will experience fast video playback with no need to cache the video before playback. Download the file without
android11
.