add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / facet / src / examples / org / apache / lucene / facet / example / association / AssociationUtils.java
1 package org.apache.lucene.facet.example.association;
2
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;
9
10 /**
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
17  *
18  *     http://www.apache.org/licenses/LICENSE-2.0
19  *
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.
25  */
26
27 /**
28  * @lucene.experimental
29  */
30 public class AssociationUtils {
31
32   /**
33    * Categories: categories[D][N] == category-path with association no. N for
34    * document no. D.
35    */
36   public static CategoryPath[][] categories = {
37     // Doc #1
38     { new CategoryPath("tags", "lucene") , 
39       new CategoryPath("genre", "computing")
40     },
41         
42     // Doc #2
43     { new CategoryPath("tags", "lucene"),  
44       new CategoryPath("tags", "solr"),
45       new CategoryPath("genre", "computing"),
46       new CategoryPath("genre", "software")
47     }
48   };
49
50   public static AssociationProperty[][] associations = {
51     // Doc #1 associations
52     {
53       /* 3 occurrences for tag 'lucene' */
54       new AssociationIntProperty(3), 
55       /* 87% confidence level of genre 'computing' */
56       new AssociationFloatProperty(0.87f)
57     },
58     
59     // Doc #2 associations
60     {
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),
69     }
70   };
71
72   /**
73    * Indexing Params: the indexing params to use when dealing with
74    * associations.
75    */
76   public static final DefaultEnhancementsIndexingParams assocIndexingParams = 
77     new DefaultEnhancementsIndexingParams(new AssociationEnhancement());
78
79 }