public synchronized List < Analysis > analyze ( String word ) { requireValidHandle ( ) ; List < Analysis > analysisList = new ArrayList < Analysis > ( ) ; if ( ! isValidInput ( word ) ) { return analysisList ; } Libvoikko lib = getLib ( ) ; Pointer cAnalysisList = lib . voikkoAnalyzeWordCstr ( handle , s2n ( word ) ) ; if ( cAnalysisList == null ) { return analysisList ; } for ( Pointer cAnalysis : cAnalysisList . getPointerArray ( 0 ) ) { Pointer cKeys = lib . voikko_mor_analysis_keys ( cAnalysis ) ; Analysis analysis = new Analysis ( ) ; for ( Pointer cKey : cKeys . getPointerArray ( 0 ) ) { String key = stringFromPointer ( cKey ) ; ByteArray value = lib . voikko_mor_analysis_value_cstr ( cAnalysis , s2n ( key ) ) ; analysis . put ( key , value . toString ( ) ) ; lib . voikko_free_mor_analysis_value_cstr ( value ) ; } analysisList . add ( analysis ) ; } lib . voikko_free_mor_analysis ( cAnalysisList ) ; return analysisList ; }
Analyze the morphology of given word and return the list of analysis results .