1 package org.apache.lucene.facet.example.association;
3 import org.apache.lucene.facet.enhancements.association.AssociationEnhancement;
4 import org.apache.lucene.facet.enhancements.association.AssociationFloatProperty;
5 import org.apache.lucene.facet.enhancements.association.AssociationIntProperty;
6 import org.apache.lucene.facet.enhancements.association.AssociationProperty;
7 import org.apache.lucene.facet.enhancements.params.DefaultEnhancementsIndexingParams;
8 import org.apache.lucene.facet.taxonomy.CategoryPath;
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed with
13 * this work for additional information regarding copyright ownership.
14 * The ASF licenses this file to You under the Apache License, Version 2.0
15 * (the "License"); you may not use this file except in compliance with
16 * the License. You may obtain a copy of the License at
18 * http://www.apache.org/licenses/LICENSE-2.0
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
28 * @lucene.experimental
30 public class AssociationUtils {
33 * Categories: categories[D][N] == category-path with association no. N for
36 public static CategoryPath[][] categories = {
38 { new CategoryPath("tags", "lucene") ,
39 new CategoryPath("genre", "computing")
43 { new CategoryPath("tags", "lucene"),
44 new CategoryPath("tags", "solr"),
45 new CategoryPath("genre", "computing"),
46 new CategoryPath("genre", "software")
50 public static AssociationProperty[][] associations = {
51 // Doc #1 associations
53 /* 3 occurrences for tag 'lucene' */
54 new AssociationIntProperty(3),
55 /* 87% confidence level of genre 'computing' */
56 new AssociationFloatProperty(0.87f)
59 // Doc #2 associations
61 /* 1 occurrence for tag 'lucene' */
62 new AssociationIntProperty(1),
63 /* 2 occurrences for tag 'solr' */
64 new AssociationIntProperty(2),
65 /* 75% confidence level of genre 'computing' */
66 new AssociationFloatProperty(0.75f),
67 /* 34% confidence level of genre 'software' */
68 new AssociationFloatProperty(0.34f),
73 * Indexing Params: the indexing params to use when dealing with
76 public static final DefaultEnhancementsIndexingParams assocIndexingParams =
77 new DefaultEnhancementsIndexingParams(new AssociationEnhancement());