How to Convert Mathml to ASCII code - android

i have checked many convertion tools but can anybody suggest me a
PAID OR FREE mathml to ASCII converter or any tool
to display mathematical equations in android textView.

You can visit the solutions from www.wiris.com. With WIRIS editor you can convert from MathML to PNG images suitable to be displayed in any browser and in any application, in particular, also for android.
It is not clear what you mean by mathml to ASCII. As part of the accessibility solutions, the WIRIS tools can generate a textual representation of a formula. For example, for ½ the “ascii” version would be “1 over 2“.

jqMath at http://mathscribe.com/author/jqmath.html is a JavaScript library you can use.
Since it's in javascript, you can us a WebView to render it.

Related

#font-face do not work unicode Malayalam in android Cordova

In android #font-face do not work for UTF character.(Webpage hosted in web control using cordova)
The code works on chrome browser both on android as well as desktop.
It do not apply the changes in the application.
Observed that if there are no UTF characters then font styling was applied. Also observed that only the lines that has got UTF it is not applied with the web font style.
It was an indication that the path provided in font-face was correct.
Tried changing the UTF character to the encoded hex value and it did not help.
The Problem
In Android 4.3 the character " ്ര "details about this issue and work around is given here
I require this for Android app developed using cordova(phonegap) and hence rooting and installing is not an option.
I tried to do web view with embedded font (#font-face) and strangely, it is not working for web view in android, but works perfectly in browser of the same device.
The Solution
Got a hint from this stack over flow and this was pointing to this Solution, and thank you for that
Basically We need to get an ASCII based font and convert the unicode to mapping ASCII.
The solution provided was using JAVA and always a chance of missing some characters. Another problem that i faced using this solution was, if there is a mix of English and Malayalam character then the solution give undesirable results.
So I created this jquery plugin
Basically It does the following.
Identify the longest possible Malayalam character sequence and wrap them using tag with configurable class name.This process separate English and non English groups.
Each grouped Malayalam character sequence then converted to ASCII using a configurable mapping w.r.t the font.
The problem of Mix of English and Malayalam is solved, problem of missing some character is fixed, and also #font-face is working. I was able to create 2 fonts mapping.
So far the solution is working for me.
I feel some level of optimization can be done.

Tesseract - OCR issues with typewriter style fonts

We are using Tesseract.NET (and the Android version too) to recognize and extract document data. It worked really good with Arial and Cambria fonts, but now we have to recognize documents like that:
Tesseract cannot recognize it. Absolutely nothing (except the big sized serial number on the right upper corner).
We tried to train it, but - maybe it's our fault - it's still unstable.
What can we do?
(Btw the font is use by national offices, we cannot get it as true type or other font format.
In the current form it is very hard for an OCR tool to recognize any letters.
Serif fonts are hard to ocr.
Letters are very close together. Some are joined.
A dictionary is not of any help.
You might be able to improve the result with the following:
As this looks like an vehicle registration certificate you should be able to predict the positions of the textstrings of interest and then ocr they separatly.
Thereby using the -psm=7 or 8 option (assume single line or word).
As some strings seem to be numbers only you can help tesseract by using the digits argument.
For the alphanumeric strings it might help to reduce the dictionary pruning (or completely remove the dawg files.)
If those strings like 'ETZ' or 'MZ' are abbreviations you could also build an dictionary with those.
Reducing the yellow and green color is also an (easy) option you could test.
Use the barcode instead of trying to ocr the string.
For tesseract questions it always helps if you specify the version used and, if you do image preprocessing, provide a sample image of the processed input.

Displaying SVG files in Android

I want to create an app that will display position on some floor plan. Navigation is implementing via WiFi in certain way, I've done it and so now I have a problem of displaying floor plan.
It might be in some vector format, after surfing internet for some time I've decided that it must be svg file.
I found some solutions, but it isn't working for me!
Library svg-android
There is opportunity to display .svg files, but only "simple" files. It works fine only for file in tutorial, but not for any other .svg file (for example, some other file, that you'll create with Inkscape).
So, I decided, that I'll parse .svg file, make DOM from it, somehow get objects and attributes and draw it via OpenGL ES.
Apache Batik
At first glance, very good solution, but there is a problem. Android has some "native" apache libraries and when I try to do something with batik, it throws NoClassDefFoundError, because it's searching not in batik libraries, but in "native" libraries.
Of course, we can add source code in our project, take only batik parser for .svg files and edit it in some way, but there is a lot of work, with same success we can write our own parser.
Tiny Line
There is no trial version, but if we'll see description of how it works for svg files and android, we'll see that there is only rasterization of such files and that's all.
Is there any solution better than writing own parser?
Did anyone come across this problem?
I would suggest using #1. Don't write your own parser. It's just going to be a huge headache.
How detailed does your floor plan have to be? android-svg supports SVG fairly well. It just doesn't have great support for filters or light sources. Your SVG isn't going to have those in them (I hope).
If you don't want to do that, look into quad trees. You can render out a huge image and break that down into a quadtree like format then only load the quads you require.
I have authored an SVG libaray for android the website is
http://www.vectoroid.com
the main thing missing is SVG arc support this is currently fixed and will be in a release in the near future.
I am looking for feedback on it, as i have been working on it for about a year. So if you have any please do tell ...
I've using yet another SVG for Android; seems it is relatively new.
GPLv3, CSS2 support, fonts, texts and spans, linear and radial gradients, SVG and SVGZ, initial filtering support, images from assets, from web and inline base64-encoded images. Fastest from all I've tried.
Of course filters support might be better, but except this it works well and even displays 20-megabytes SVG files.
Successfully tested these 2 libraries:
https://github.com/BigBadaboom/androidsvg - Apache License 2.0
https://scand.com/products/svgkit-android/ - needed tweaking to compile with modern SDK (suppress warnings, update gradle file); LGPL / commercial
androidsvg looks better so far.

Typesetting math functions in LaTeX to render in Android Application

Does anyone know if it's possible to use LaTeX markup language to format text for display in an Android application?
For example the text for a TextView can be formatted with HTML to change the font size to small and superscript etc by using the Html.formHtml("String") method:
TextView aTextView=(TextView) findViewById(R.id.textview1);
aTextView.setText(Html.fromHtml("2<small><sup>5</sup></small>"));
Will display 25 in the TextView.
However what I'd like to something more advanced and format text using perhaps LaTeX to represent Math Function and have that render as a correctly format Math Function in a TextView (or something else).
For example the LaTeX markup "Evaluate the sum $\displaystyle\sum\limits_{i=0}^n i^3" should be rendered to:
(source: artofproblemsolving.com)
If there's some other way to mark up Math Functions so they display correctly in an Android App other than using LaTeX I'm all open to suggestions!
Latex is not written in java so may be hard to get running on the android JLaTexMath is a java port which you may be able to use, but probably not straight out of the box.
One other option maybe to run a service on a server that takes a formula and returns an image, if your formulas get really complex this might even be quicker then rendering the formula.
This will also reduce your reliance on the android platform so you are more likely to be able to port your application to IPhone and Html5.

Is there a faster way to decode html characters to a string than Html.fromHtml()?

I am using Html.fromHtml(STRING).toString() to convert a string that may or may not have html and/or html entities in it, to a plain text string.
This is pretty slow, I think my last calculation was that it took about 22ms on avg. With a large batch of these it can add over a minute. So I am looking for a faster, performance built option.
Is there anyway to speed this up or are there other decoding options available?
Edit: Since there doesn't appear to be a built in method that is faster or built for performance specifically, I will reward the bounty to anyone that can point me in the direction of a library that:
Works well with Android
Licensed for free use
Faster than Html.fromHtml(String).toString();
As a note, I already tried Jsoup with this method: Jsoup.parse(String).text() and it was slower.
What about org.apache.commons.lang.StringEscapeUtils's unescapeHtml(). The library is available on Apache site.
(EDIT: June 2019 - See the comments below for updates about the library)
fromHtml() does not have a high-performance HTML parser, and I have no idea how quick the toString() implementation on SpannedString is. I doubt either were designed for your scenario.
Ideally, the strings are clean before they get to a low-power phone. Either clean them up in the build process (for resources/assets), or clean them up on a server (before you download them).
If, for whatever reason, you absolutely need to clean them up on the device, you can perhaps use the NDK to create a C/C++ library that does the cleaning for you faster.
This is an incredibly fast and simple option:
Unbescape
It greatly improved our parsing performance which requires every string to be run through a decoder.
Have you looked at Strip HTML from Text JavaScript
With a large batch of these it can add
over a minute
Any parsing will take some time. 22ms seems to me like fast.
Anyway, can you do it in background? Can help you some kind of caching?
Although I have not tried them yet, I found some possible solutions:
HTML Java Parsers
HTML Parsing
More HTML Parsing
I hope it helps.

Categories

Resources