Android Open Source - sdk-stemmer Stemmer Edit Text






From Project

Back to project page sdk-stemmer.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project sdk-stemmer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.silpa.stemmer;
/*www . ja v a  2 s .co  m*/
import android.content.Context;
import android.util.AttributeSet;

import org.silpa.render.IndicEditText;

import java.util.Map;

/**
 * Created by sujith on 13/6/14.
 */
public class StemmerEditText extends IndicEditText implements StemmerInterface {

    /**
     * Context of application
     */
    private Context mContext;

    /**
     * Stemmer object to stem words
     */
    private Stemmer stemmer;


    /**
     * Constructor
     *
     * @param context context of application
     */
    public StemmerEditText(Context context) {
        super(context);
        init();
    }

    /**
     * Constructor
     *
     * @param context context of application
     * @param attrs   attribute set
     */
    public StemmerEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    /**
     * Constructor
     *
     * @param context  context of application
     * @param attrs    attribute set
     * @param defStyle default style
     */
    public StemmerEditText(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
    }

    private void init() {
        this.mContext = getContext();
        this.stemmer = new Stemmer(this.mContext);
    }


    /**
     * This function is used to get all stemmed words
     * in an array
     *
     * @return string array
     */
    @Override
    public String[] getStemWordsAsArray() {
        return this.stemmer.getStemWordsAsArray(getText().toString());
    }

    /**
     * This function is used to get all stemmed words
     * as a map
     *
     * @return map<String, String>
     */
    @Override
    public Map<String, String> getStemWordsAsMap() {
        return this.stemmer.getStemWordsAsMap(getText().toString());
    }

    /**
     * This function gives name of the module
     *
     * @return name of module
     */
    @Override
    public String getModuleName() {
        return this.stemmer.getModuleName();
    }

    /**
     * This function gives a brief description of the module
     *
     * @return brief information regarding the module
     */
    @Override
    public String getModuleInformation() {
        return this.stemmer.getModuleInformation();
    }
}




Java Source Code List

org.silpa.stemmer.StemmerEditText.java
org.silpa.stemmer.StemmerInterface.java
org.silpa.stemmer.StemmerTextView.java
org.silpa.stemmer.Stemmer.java