Package opennlp.tools.util.jvm

# Class CHMStringDeduplicator

java.lang.Object
opennlp.tools.util.jvm.CHMStringDeduplicator

All Implemented Interfaces:
  `opennlp.tools.util.jvm.StringInterner`

@Internal @ThreadSafe public class CHMStringDeduplicator extends Object implements opennlp.tools.util.jvm.StringInterner
A `StringInterner` implementation by Aleksey Shipilëv with relaxed canonical requirements. It is a probabilistic deduplication implementation with a default probability of `0.5`. Users may implement a custom class with a different probability value.

Origin: https://shipilev.net/talks/joker-Oct2014-string-catechism.pdf

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CHMStringDeduplicator()`
  Creates a `CHMStringDeduplicator` with a probability of `0.5`.
  `CHMStringDeduplicator(double prob)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `intern(String sample)`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CHMStringDeduplicator

    public CHMStringDeduplicator()
    Creates a `CHMStringDeduplicator` with a probability of `0.5`.

  - ### CHMStringDeduplicator

    public CHMStringDeduplicator(double prob)
    Parameters:
      `prob` - represents the probability, that a given String will be interned

- ## Method Details

  - ### intern

    public String intern(String sample)
    Specified by:
      `intern` in interface `opennlp.tools.util.jvm.StringInterner`