detect the language of a particular piece of text (no internet connection)

by alan lam » Thu, 11 Nov 2010 16:48:33 GMT


Sponsored Links
 Is there any function/library/API which can detect the language of a
particular piece of text (no internet connection)?
i.e. for an input text "This is a sentence", it should detect the
language as "English".
Or for "Esto es una sentencia" it should detect the language as
"Spanish".

--



detect the language of a particular piece of text (no internet connection)

by Kumar Bibek » Fri, 12 Nov 2010 02:11:41 GMT


 There are no such APIs that I am aware of in the Android SDK. There
might be some 3 party libraries, but again, I haven't searched for
them. Try googling.




--


Sponsored Links


detect the language of a particular piece of text (no internet connection)

by moffetta » Fri, 12 Nov 2010 02:21:58 GMT


 You could use 2 easy method

1) make a dictionary of common words for every language and test it
against the sentence. If a language has multiple match against more
words, then probably that is the language is written in;

2) (maybe a fallback if previous method didn't work or was not useful)
every language has a particular frequency of some letter - eg. in
english i think the letter "e" is very common. you should find this
rules (with google) and apply to your case.

those are just ideas, hope helped anyway




--



detect the language of a particular piece of text (no internet connection)

by Daniel Drozdzewski » Fri, 12 Nov 2010 18:58:30 GMT


 


I don't think you can do it without internet connection and utilising
some API (like Google Translate) with massive dictionaries behind it.

To establish letter frequencies, you would need to capture quite lot
of text (well, more than 1 sentence) for the analysis to be
statistically valid, otherwise you would have many errors. The
differences are small towards the end of the tail.

Please have a look at this article, to see, what you would be against:
 http://en.wikipedia.org/wiki/Letter_frequency 

Similar issue is with local dictionaries: you would need them to be
quite big in order to achieve decent results. Scanning those would
take time.


Daniel

--



Other Threads

1. AnimationDrawable help request

Hi guys,

I've created a separate class for an object I want to draw on a View
with something like:

        public void Draw(Canvas canvas){

             this.mImage.setBounds(this.coordX, this.coordY, this.coordX +
this.mImageWidth, this.coordY
                + this.mImageHeight);

                this.mImage.draw(canvas);

        }

which works fine. It is not extending any Views, though, as this is
just a logical unit on the app.

However, I want to run a 3 frame animation rather than just rendering
the image, so I tried the following:

1) Created a AnimationDrawable member on that same class:

    AnimationDrawable aAnimate;

2) Loaded my animation to the Drawable member from the xml file on the
constructor with:

        this.mImage = context.getResources().getDrawable(
                R.anim.test2);

3) Created a reference to the AnimationDrawable on the constructor
with:

        this.aAnimate = (AnimationDrawable)this.mImage;

4) Changed the Draw() method to:

        public void Draw(Canvas canvas){

                this.mImage.setBounds(this.coordX, this.coordY, this.coordX +
this.mImageWidth, this.coordY
                + this.mImageHeight);

                this.aAnimate.start();
                //this.mImage.draw(canvas);

        }


But the Drawable does not even appear on the screen (I have logged the
execution so I know that I am getting to the start()).

Any clues/help possible from the gurus out there?

Many thanks

Cass
--~--~---------~--~----~------------~-------~--~----~

2. Question regarding detecting view for touch event.

You can't directly, this is how event dispatching in the hierarchy works
(the view under the down event remains the target for the remainder of the
motion).  You might be able to do something with some custom dispatching
code in the layout containing them, but exactly what you do will depend a
lot on the behavior you want (do you want the other image view to become
pressed when the user drags over to it?  just to be able to find out where
the release happened but leave the original one presssed?  something else?)






-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~

3. Question regarding detecting view for touch event.

4. Animation help

5. Problem creating a resource in eclipse

6. Run a Service without an Activity

7. Emulator invalid command-line parameter: HVGA