Exemple #1
0
        /**
         * Suggestions must be added with the best suggestion first.  ORDER is important.
         * @param token The {@link org.apache.lucene.analysis.Token}
         * @param suggestion The suggestion for the Token
         * @param docFreq The document frequency
         */
        public void add(Token token, string suggestion, int docFreq)
        {
            LinkedHashMap /*<String, Integer>*/ map = (LinkedHashMap)this.suggestions.get(token);

            //Don't bother adding if we already have this token
            if (map == null)
            {
                map = new LinkedHashMap/*<String, Integer>*/ ();
                this.suggestions.put(token, map);
            }
            map.put(suggestion, docFreq);
        }
Exemple #2
0
        /**
         * Adds a whole bunch of suggestions, and does not worry about frequency.
         *
         * @param token The token to associate the suggestions with
         * @param suggestions The suggestions
         */
        public void add(Token token, List /*<String>*/ suggestions)
        {
            LinkedHashMap /*<String, Integer>*/ map = (LinkedHashMap)this.suggestions.get(token);

            if (map == null)
            {
                map = new LinkedHashMap/*<String, Integer>*/ ();
                this.suggestions.put(token, map);
            }
            for (var iter = suggestions.iterator(); iter.hasNext();)
            {
                string suggestion = (string)iter.next();
                map.put(suggestion, NO_FREQUENCY_INFO);
            }
        }