Documentation of 'cc.mallet.types.StringKernel' Java class
StringKernel
cc.mallet.types

Class StringKernel

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map


    public class StringKernel
    extends java.util.LinkedHashMap
    Computes a similarity metric between two strings, based on counts of common subsequences of characters. See Lodhi et al "String kernels for text classification." Optionally caches previous kernel computations.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
    • Constructor Summary

      Constructors 
      Constructor and Description
      StringKernel() 
      StringKernel(boolean norm, double lam, int length) 
      StringKernel(boolean norm, double lam, int length, boolean cache) 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double K(java.lang.String s, java.lang.String t)
      Computes the normalized string kernel between two strings.
      static void main(java.lang.String[] args)
      Return string kernel between two strings
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
    • Constructor Detail

      • StringKernel

        public StringKernel(boolean norm,
                            double lam,
                            int length,
                            boolean cache)
        Parameters:
        norm - true if we lowercase all strings
        lam - 0-1 penalty for gaps between matches.
        length - max length of subsequences to compare
        cache - true if we should cache previous kernel computations. recommended!
      • StringKernel

        public StringKernel()
      • StringKernel

        public StringKernel(boolean norm,
                            double lam,
                            int length)
    • Method Detail

      • K

        public double K(java.lang.String s,
                        java.lang.String t)
        Computes the normalized string kernel between two strings.
        Parameters:
        s - string 1
        t - string 2
        Returns:
        0-1 value, where 1 is exact match.
      • main

        public static void main(java.lang.String[] args)
                         throws java.lang.Exception
        Return string kernel between two strings
        Throws:
        java.lang.Exception

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.