public WordAnalysis analyze(String word) { return useCache ? analyzeWithCache(word) : analyzeWithoutCache(word); }
/** * Normalizes the input word and analyses it. If word cannot be parsed following occurs: - if * input is a number, system tries to parse it by creating a number DictionaryEntry. - if input * starts with a capital letter, or contains ['] adds a Dictionary entry as a proper noun. - if * above options does not generate a result, it generates an UNKNOWN dictionary entry and returns * a parse with it. * * @param word input word. * @return WordAnalysis list. */ private WordAnalysis analyzeWithoutCache(String word) { List<Token> tokens = tokenizer.tokenize(word); if (tokens.size() != 1) { return new WordAnalysis(word, word, new ArrayList<>(0)); } return analyzeWithoutCache(tokens.get(0)); }