Search in sources :

Example 1 with CharCombinator

use of peltomaa.sukija.util.CharCombinator in project sukija by ahomansikka.

the class CharSuggestion method suggest.

@Override
public boolean suggest(String word, VoikkoAttribute voikkoAtt) {
    charCombinator = new CharCombinator(word, from, to);
    //System.out.println ("\nCharSuggestion " + word + " " + from + " " + to);
    Iterator<String> i = charCombinator.iterator();
    while (i.hasNext()) {
        final String s = i.next();
        //System.out.println ("\nCharSuggestion " + word + " " + s);
        if (analyze(s, voikkoAtt)) {
            // Muutettu sana tunnistettiin.
            return true;
        }
    }
    // Muutettua sanaa ei tunnistetttu.
    return false;
}
Also used : CharCombinator(peltomaa.sukija.util.CharCombinator)

Example 2 with CharCombinator

use of peltomaa.sukija.util.CharCombinator in project sukija by ahomansikka.

the class VoikkoUtils method panalyze.

public static final boolean panalyze(Voikko voikko, String word, Set<String> result, String from, String to) {
    CharCombinator charCombinator = new CharCombinator(word, from, to);
    Iterator<String> iterator = charCombinator.iterator();
    while (iterator.hasNext()) {
        final String s = iterator.next();
        List<Analysis> list = voikko.analyze(s);
        if (list.size() > 0) {
            result.clear();
            result.addAll(getBaseForms(list));
            return true;
        }
    }
    return false;
}
Also used : Analysis(org.puimula.libvoikko.Analysis) CharCombinator(peltomaa.sukija.util.CharCombinator)

Example 3 with CharCombinator

use of peltomaa.sukija.util.CharCombinator in project sukija by ahomansikka.

the class SuggestionUtils method getSuggestions.

private static final boolean getSuggestions(Voikko voikko, String word, VoikkoAttribute voikkoAtt, BaseFormAttribute baseFormAtt, FlagsAttribute flagsAtt, Suggestion[] suggestion, String from, String to) {
    //System.out.println ("Analyze3 " + from + " " + to + " " + word);
    CharCombinator charCombinator = new CharCombinator(word, from, to);
    Iterator<String> iterator = charCombinator.iterator();
    while (iterator.hasNext()) {
        final String s = iterator.next();
        if (AnalysisUtils.analyze(voikko, s, voikkoAtt, baseFormAtt, flagsAtt)) {
            //System.out.println ("Analyze4 " + from + " " + to + " " + word + " " + s);
            return true;
        }
        if (getSuggestions(suggestion, s, voikkoAtt, baseFormAtt)) {
            //System.out.println ("Analyze9 " + from + " " + to + " " + word + " " + s);
            return true;
        }
    }
    return false;
}
Also used : CharCombinator(peltomaa.sukija.util.CharCombinator)

Aggregations

CharCombinator (peltomaa.sukija.util.CharCombinator)3 Analysis (org.puimula.libvoikko.Analysis)1