I want to give users the option to write down technical equations in my app. How can I do this?
I'm OK with having a simple edittext and forcing the user to write out actual LaTeX (or whatever) code, but if there's an easier way to let people input equations I'd love to know.
For the output of math formulas you could use MathJax or JqMath. For those you will have extra WebView since those libs work with javaScript.
For the input you could make user follow their input syntax, or create your own wrapper around it. As advanced input feature you could implement image recognition for some math elements, like these guys did.
Have a look at projects around MathML (http://en.wikipedia.org/wiki/MathML)
WebKit supports MathML in recent versions, so if you can get that you can display your equations. However, since the question is about entering equations, maybe the best place to start looking is shorthand formats that can be converted to MathML. For example: http://en.wikipedia.org/wiki/ASCIIMathML
It may also be worth looking at WYSIWIG MathML editors. Most are pretty heavy, likely not suitable to be embedded into an app, but look around.
Related
I'm using OCR to recognize (German) text in an image. It works well but not perfectly. Sometimes a word gets messed-up. Therefore, I want to implement some sort of validation. Of course, I can just use a word list and find words that are similar to the messed-up word, but is there a way to check if the sentence is plausible with these words?
After all, my smartphone can give me good suggestions on how to complete a sentence.
You need to look for Natural Language Processing (NLP) solutions. With them, you can validate syntactically the lexical (either the whole text, which may be better as some of them may take on consideration the context, or phrase by phrase).
I am not an expert in the area, but this article can help you to choose a tool to start trying.
Also, please notice: your keyboard on your cellphone is developed and maintained by specialized teams, either on Apple, Google or any other company that you use their app. So, please, don't underestimate this task: there are dozens of research areas on this, that includes either software engineers and linguistics specialists to achieve proper results.
Edit: well, two days later, I've just came to this link: https://medium.com/quick-code/12-best-natural-language-processing-courses-2019-updated-2a6c28aebd48
Hey guys im new to Java and atm im creating a Text Adventure game =)
so, to unlock systems i want a feature called minigame.
a black frame should hide letters inside of it and if you mark them with
your mouse you should be able to see them..at the end you have to put
the correct word into a textField.
Can some1 give me some cheats for that? :D
Firstly, I would consider changing the wording of your question because people on here are very sensitive about wording and specificity, which helps us to better answer your question.
I assume that by "cheats" you mean shortcuts to acomplishing this. There is not a very straightforward way to do this in Java, but I would certainly reccommend writing this game using javaScript with the jQuery library. JQuery has a method .hover() that would be very useful here, and you could code the interactive rectangle in html and CSS.
Also, javaScript is similar to Java in case learning Java is your overall goal. That is my "cheat," using these two tools instead of Java for this purpose. Otherwise you would have to use a java graphics library which might be a little complicated for a beginner.
I would reccommend using Code Academy since it was how I originally learned how to develop webpages and was incredibly helpful to me as a beginner: https://www.codecademy.com
Im looking for a speech recognition software for java that acts more like the android version, in that, instead of having .gram files and stuff, it just returns a string of what was said, and I can act on it. Ive tried using sphinx-4, but using .gram files makes my program a lot harder to do.
The point of a grammar file is to improve the accuracy of what you're getting back. Instead of trying to come up with random strings of english words, you tell it to expect specific input.
That said, sphinx-4 can do ordinary large-dictionary ASR as well. Read the N-Gram part of this tutorial and look at the Transcriber sample that comes with the sphinx source code.
In addition, you can train your own trigram model that will enhance the results you get. (E.g., place more probability on the word "weather" being detected.) This is certainly what Siri does. Apple/Google have a huge corpus of pieces of audio that people speak into their phones, part of which is human transcribed, from which they train both acoustic and linguistic models (so their engines detect things people typically say instead of nonsense).
I have written an application which outputs data as XML. However, it would be nice to allow the user to completely customize the output format so they can more easily integrate it into their applications.
What would be the best way to approach this problem? My initial thoughts are to define a grammar and write a parser from the ground up.
Are there any free Java libraries that can assist in parsing custom scripting(formatting?) languages?
Since I already have the XML, would it be a better approach to just 'convert' this with a search & replace algorithm?
I should specify here that 'users' are other programmers so defining a simple language would be fine, and that the output is potentially recursive (imagine outputting the contents of a directory to XML).
Just looking for general advice in this area before I set off down the wrong track.
EDIT: To clarify... My situation is a bit unique. The application outputs coordinates and other data to be loaded into a game engine. Everybody seems to use a different, completely custom format in their own engine. Most people do not want to implement a JSON parser and would rather use what they already have working. In other words, it is in the interests of my users to have full control over the output, asking them to implement a different parser is not an option.
Have you considered just using a templating engine like Velocity or FreeMarker.
I would have created a result bean as a POJO.
Then I would have different classes working on the result bean. That way you can easily extend with new formats if needed.
E.g
Result result = logic.getResult();
XMLOutputter.output(result, "myXMLFile.xml");
Format1Outputter.output(result, "myFormat1File.fo1");
Format2Outputter.output(result, "myFormat2File.fo2");
If you are planning to provide this as an API to multiple parties, I would advise against allowing over-customization, it will add unnecessary complexity to your product and provide just one more place for bugs to be introduced.
Second, it will increase the complexity of your documentation and as a side affect likely cause your documentation to fall out of sync with the api in general.
The biggest thing I would suggest considering, in terms of making your stream easier to digest, is making the output available in JSON format, which just about every modern language has good support for (I use Gson for Java, myself).
I'm working on a project for a school fundraiser and I'm supposed to be able to output results onto a PDF or Word Doc that I could easily automate to print out a sheet with the same page content but different results. I'm hoping I would be able to make the page look interesting as well, with bright colors and images.
I've been looking around and these two things caught my eye, which would you suggest I use? iText or Mail Merge with Office? (if you reccommend one over the other, can you also add resources for me to use?)
Thank you!
Mail Merge, no question about it. Of course ultimately iText gives you the power to rewrite the whole page based on where you are sending it (like making a report), but that is not what you are looking for. If by "different results" you mean things like the donor's name and amount of donation, then go for the Mail Merge.
If you are saying you have all kinds different bar charts and content differences per person, then I might think differently, but unless you are a super-amazing high school programmer, you aren't figuring out iText in time to get that done. It is a relatively big deal, programming wise, to put together a PDF from scratch using iText, compared to putting something together in Microsoft Word.
I agree with Jishai about keeping it simple if time is likely to be short (as it might be with funder-raiser schedule). Possibly the JODReports or Docmosis systems might be very handy since they have command line calls you can use to have documents generated base on a mail-merge requirement.
Hope that helps.