Java Doc for SweetSpotSimilarity.java in  » Net » lucene-connector » org » apache » lucene » misc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » lucene connector » org.apache.lucene.misc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.lucene.search.Similarity
      org.apache.lucene.search.DefaultSimilarity
         org.apache.lucene.misc.SweetSpotSimilarity

SweetSpotSimilarity
public class SweetSpotSimilarity extends DefaultSimilarity (Code)
A similarity with a lengthNorm that provides for a "platuea" of equally good lengths, and tf helper functions.

For lengthNorm, A global min/max can be specified to define the platuea of lengths that should all have a norm of 1.0. Below the min, and above the max the lengthNorm drops off in a sqrt function.

A per field min/max can be specified if different fields have different sweet spots.

For tf, baselineTf and hyperbolicTf functions are provided, which subclasses can choose between.




Constructor Summary
public  SweetSpotSimilarity()
    

Method Summary
public  floatbaselineTf(float freq)
     Implemented as: (x <= min) ? base : sqrt(x+(base**2)-min) ...but with a special case check for 0.
public  floathyperbolicTf(float freq)
     Uses a hyperbolic tangent function that allows for a hard max...
public  floatlengthNorm(String fieldName, int numTerms)
     Implemented as: 1/sqrt( steepness * (abs(x-min) + abs(x-max) - (max-min)) + 1 ) .
public  voidsetBaselineTfFactors(float base, float min)
    
public  voidsetHyperbolicTfFactors(float min, float max, double base, float xoffset)
    
public  voidsetLengthNormFactors(int min, int max, float steepness)
     Sets the default function variables used by lengthNorm when no field specifc variables have been set.
public  voidsetLengthNormFactors(String field, int min, int max, float steepness)
    
public  floattf(int freq)
    


Constructor Detail
SweetSpotSimilarity
public SweetSpotSimilarity()(Code)




Method Detail
baselineTf
public float baselineTf(float freq)(Code)
Implemented as: (x <= min) ? base : sqrt(x+(base**2)-min) ...but with a special case check for 0.

This degrates to sqrt(x) when min and base are both 0


See Also:   SweetSpotSimilarity.setBaselineTfFactors



hyperbolicTf
public float hyperbolicTf(float freq)(Code)
Uses a hyperbolic tangent function that allows for a hard max... tf(x)=min+(max-min)/2*(((base**(x-xoffset)-base**-(x-xoffset))/(base**(x-xoffset)+base**-(x-xoffset)))+1)

This code is provided as a convincience for subclasses that want to use a hyperbolic tf function.


See Also:   SweetSpotSimilarity.setHyperbolicTfFactors



lengthNorm
public float lengthNorm(String fieldName, int numTerms)(Code)
Implemented as: 1/sqrt( steepness * (abs(x-min) + abs(x-max) - (max-min)) + 1 ) .

This degrades to 1/sqrt(x) when min and max are both 1 and steepness is 0.5

:TODO: potential optimiation is to just flat out return 1.0f if numTerms is between min and max.


See Also:   SweetSpotSimilarity.setLengthNormFactors



setBaselineTfFactors
public void setBaselineTfFactors(float base, float min)(Code)
Sets the baseline and minimum function variables for baselineTf
See Also:   SweetSpotSimilarity.baselineTf



setHyperbolicTfFactors
public void setHyperbolicTfFactors(float min, float max, double base, float xoffset)(Code)
Sets the function variables for the hyperbolicTf functions
Parameters:
  min - the minimum tf value to ever be returned (default: 0.0)
Parameters:
  max - the maximum tf value to ever be returned (default: 2.0)
Parameters:
  base - the base value to be used in the exponential for the hyperbolic function (default: e)
Parameters:
  xoffset - the midpoint of the hyperbolic function (default: 10.0)
See Also:   SweetSpotSimilarity.hyperbolicTf



setLengthNormFactors
public void setLengthNormFactors(int min, int max, float steepness)(Code)
Sets the default function variables used by lengthNorm when no field specifc variables have been set.
See Also:   SweetSpotSimilarity.lengthNorm



setLengthNormFactors
public void setLengthNormFactors(String field, int min, int max, float steepness)(Code)
Sets the function variables used by lengthNorm for a specific named field
See Also:   SweetSpotSimilarity.lengthNorm



tf
public float tf(int freq)(Code)
Delegates to baselineTf
See Also:   SweetSpotSimilarity.baselineTf



Methods inherited from org.apache.lucene.search.DefaultSimilarity
public float coord(int overlap, int maxOverlap)(Code)(Java Doc)
public float idf(int docFreq, int numDocs)(Code)(Java Doc)
public float lengthNorm(String fieldName, int numTerms)(Code)(Java Doc)
public float queryNorm(float sumOfSquaredWeights)(Code)(Java Doc)
public float sloppyFreq(int distance)(Code)(Java Doc)
public float tf(float freq)(Code)(Java Doc)

Methods inherited from org.apache.lucene.search.Similarity
abstract public float coord(int overlap, int maxOverlap)(Code)(Java Doc)
public static float decodeNorm(byte b)(Code)(Java Doc)
public static byte encodeNorm(float f)(Code)(Java Doc)
public static Similarity getDefault()(Code)(Java Doc)
public static float[] getNormDecoder()(Code)(Java Doc)
public float idf(Term term, Searcher searcher) throws IOException(Code)(Java Doc)
public float idf(Collection terms, Searcher searcher) throws IOException(Code)(Java Doc)
abstract public float idf(int docFreq, int numDocs)(Code)(Java Doc)
abstract public float lengthNorm(String fieldName, int numTokens)(Code)(Java Doc)
abstract public float queryNorm(float sumOfSquaredWeights)(Code)(Java Doc)
public float scorePayload(String fieldName, byte[] payload, int offset, int length)(Code)(Java Doc)
public static void setDefault(Similarity similarity)(Code)(Java Doc)
abstract public float sloppyFreq(int distance)(Code)(Java Doc)
public float tf(int freq)(Code)(Java Doc)
abstract public float tf(float freq)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.