Package it.unimi.dsi.fastutil.chars

Examples of it.unimi.dsi.fastutil.chars.Char2ObjectOpenHashMap


   */
  private double computeWordValue(Char2ObjectOpenHashMap node, String word, boolean forward, int index, double percentile, double total) {

    char chr = word.charAt(index);

    Char2ObjectOpenHashMap next = (Char2ObjectOpenHashMap)node.get(chr);

    if(next != null) {

      total += percentile;

View Full Code Here


   * Loops through the list of tokens and builds a character tree
   *
   */
  private void buildTrees() {
    // First, create a root node
    forwardTree = new Char2ObjectOpenHashMap();
    reverseTree = new Char2ObjectOpenHashMap();

    String token = null;
    char chr;

    Char2ObjectOpenHashMap currentNode = null;
    Char2ObjectOpenHashMap targetNode = null;


    for (int i = 0; i < tokens.length; i++) {
      token = tokens[i];

      if(token != null) {

        // Build the forward tree
        currentNode = forwardTree;

        for (int j = 0; j < token.length(); j++) {
          chr = token.charAt(j);

          // Attempt to locate the node from the current node
          targetNode = (Char2ObjectOpenHashMap)currentNode.get(chr);

          if(targetNode == null) {
            targetNode = new Char2ObjectOpenHashMap(1);
            //targetNode.setCharacter(chr);
            currentNode.put(chr, targetNode);
          }
          currentNode = targetNode;
        }

        // Build the reverse tree
        currentNode = reverseTree;

        for (int j = token.length() - 1; j >= 0; j--) {
          chr = token.charAt(j);

          // Attempt to locate the node from the current node
          targetNode =(Char2ObjectOpenHashMap)currentNode.get(chr);

          if(targetNode == null) {
            targetNode = new Char2ObjectOpenHashMap(1);
            //targetNode.setCharacter(chr);
            currentNode.put(chr, targetNode);
          }

          currentNode = targetNode;
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.chars.Char2ObjectOpenHashMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.