Codota Logo
DetectorFactory.setSeed
Code IndexAdd Codota to your IDE (free)

How to use
setSeed
method
in
com.cybozu.labs.langdetect.DetectorFactory

Best Java code snippets using com.cybozu.labs.langdetect.DetectorFactory.setSeed (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: pl.edu.icm.synat/synat-process-common

public static synchronized void loadData() {
  if (loaded) {
    return;
  }
  loaded = true;
  List<String> profileData = new ArrayList<String>();
  try {
    Charset encoding = Charset.forName("UTF-8");
    for (YLanguage language : detectableLanguages) {
      try (InputStream stream = new ClassPathResource("langdetect-profiles/" + language.getShortCode()).getInputStream();
          BufferedReader reader = new BufferedReader(new InputStreamReader(stream, encoding));) {
        profileData.add(new String(IOUtils.toCharArray(reader)));
      }
    }
    DetectorFactory.loadProfile(profileData);
    DetectorFactory.setSeed(System.currentTimeMillis());
  } catch (IOException | LangDetectException e) {
    throw new GeneralBusinessException(e);
  }
}
origin: com.norconex.language/langdetect

/**
 * load profiles
 * @return false if load success
 */
private boolean loadProfile() {
  String profileDirectory = get("directory") + "/"; 
  try {
    DetectorFactory.loadProfile(profileDirectory);
    Long seed = getLong("seed");
    if (seed != null) DetectorFactory.setSeed(seed);
    return false;
  } catch (LangDetectException e) {
    System.err.println("ERROR: " + e.getMessage());
    return true;
  }
}
 
origin: org.opencms/opencms-core

/**
 * Initializes the language detection.<p>
 */
private void initLanguageDetection() {
  try {
    // use a seed for initializing the language detection for making sure the
    // same probabilities are detected for the same document contents
    DetectorFactory.clear();
    DetectorFactory.setSeed(42L);
    DetectorFactory.loadProfile(loadProfiles(getAvailableLocales()));
  } catch (Exception e) {
    LOG.error(Messages.get().getBundle().key(Messages.INIT_I18N_LANG_DETECT_FAILED_0), e);
  }
}
com.cybozu.labs.langdetectDetectorFactorysetSeed

Popular methods of DetectorFactory

  • create
    Construct Detector instance with smoothing parameter
  • loadProfile
    Load profiles from specified directory. This method must be called once before language detection.
  • clear
    Clear loaded language profiles (reinitialization to be available)
  • addProfile
  • createDetector

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • startActivity (Activity)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • LinkedHashMap (java.util)
    Hash table and linked list implementation of the Map interface, with predictable iteration order. Th
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now