/** * For testing only. All paths will be added to pathList as Lists. * // generate a bunch of paths through the graph with the input alphabet * // and create new nodes for each one. */ public static TransducerGraph createRandomGraph(int numPaths, int pathLengthMean, double pathLengthVariance, int numInputs, List pathList) { // compute the path length. Draw from a normal distribution int pathLength = (int) (r.nextGaussian() * pathLengthVariance + pathLengthMean); for (int i = 0; i < numPaths; i++) { // make a path List path = new ArrayList(); for (int j = 0; j < pathLength; j++) { String input = Integer.toString(r.nextInt(numInputs)); path.add(input); } // TODO: createRandomPaths had the following difference: // we're done, add one more arc to get to the endNode. //input = TransducerGraph.EPSILON_INPUT; //path.add(input); pathList.add(path); } return createGraphFromPaths(pathList, -1); }
/** * If markovOrder is zero, we always transition back to the start state * If markovOrder is negative, we assume that it is infinite */ public static TransducerGraph createGraphFromPaths(List paths, int markovOrder) { ClassicCounter pathCounter = new ClassicCounter(); for (Object o : paths) { pathCounter.incrementCount(o); } return createGraphFromPaths(pathCounter, markovOrder); }
TransducerGraph result = TransducerGraph.createGraphFromPaths(newPathCounter, 1000);
/** * For testing only. All paths will be added to pathList as Lists. * // generate a bunch of paths through the graph with the input alphabet * // and create new nodes for each one. */ public static TransducerGraph createRandomGraph(int numPaths, int pathLengthMean, double pathLengthVariance, int numInputs, List pathList) { // compute the path length. Draw from a normal distribution int pathLength = (int) (r.nextGaussian() * pathLengthVariance + pathLengthMean); Object input; List path; for (int i = 0; i < numPaths; i++) { // make a path path = new ArrayList(); for (int j = 0; j < pathLength; j++) { input = Integer.valueOf(r.nextInt(numInputs)); path.add(input); } pathList.add(path); } return createGraphFromPaths(pathList, -1); }
/** * For testing only. All paths will be added to pathList as Lists. * // generate a bunch of paths through the graph with the input alphabet * // and create new nodes for each one. */ public static TransducerGraph createRandomGraph(int numPaths, int pathLengthMean, double pathLengthVariance, int numInputs, List pathList) { // compute the path length. Draw from a normal distribution int pathLength = (int) (r.nextGaussian() * pathLengthVariance + pathLengthMean); for (int i = 0; i < numPaths; i++) { // make a path List path = new ArrayList(); for (int j = 0; j < pathLength; j++) { String input = Integer.toString(r.nextInt(numInputs)); path.add(input); } // TODO: createRandomPaths had the following difference: // we're done, add one more arc to get to the endNode. //input = TransducerGraph.EPSILON_INPUT; //path.add(input); pathList.add(path); } return createGraphFromPaths(pathList, -1); }
/** * For testing only. All paths will be added to pathList as Lists. * // generate a bunch of paths through the graph with the input alphabet * // and create new nodes for each one. */ public static TransducerGraph createRandomGraph(int numPaths, int pathLengthMean, double pathLengthVariance, int numInputs, List pathList) { // compute the path length. Draw from a normal distribution int pathLength = (int) (r.nextGaussian() * pathLengthVariance + pathLengthMean); for (int i = 0; i < numPaths; i++) { // make a path List path = new ArrayList(); for (int j = 0; j < pathLength; j++) { String input = Integer.toString(r.nextInt(numInputs)); path.add(input); } // TODO: createRandomPaths had the following difference: // we're done, add one more arc to get to the endNode. //input = TransducerGraph.EPSILON_INPUT; //path.add(input); pathList.add(path); } return createGraphFromPaths(pathList, -1); }
/** * For testing only. All paths will be added to pathList as Lists. * // generate a bunch of paths through the graph with the input alphabet * // and create new nodes for each one. */ public static TransducerGraph createRandomGraph(int numPaths, int pathLengthMean, double pathLengthVariance, int numInputs, List pathList) { // compute the path length. Draw from a normal distribution int pathLength = (int) (r.nextGaussian() * pathLengthVariance + pathLengthMean); for (int i = 0; i < numPaths; i++) { // make a path List path = new ArrayList(); for (int j = 0; j < pathLength; j++) { String input = Integer.toString(r.nextInt(numInputs)); path.add(input); } // TODO: createRandomPaths had the following difference: // we're done, add one more arc to get to the endNode. //input = TransducerGraph.EPSILON_INPUT; //path.add(input); pathList.add(path); } return createGraphFromPaths(pathList, -1); }
/** * If markovOrder is zero, we always transition back to the start state * If markovOrder is negative, we assume that it is infinite */ public static TransducerGraph createGraphFromPaths(List paths, int markovOrder) { ClassicCounter pathCounter = new ClassicCounter(); for (Object o : paths) { pathCounter.incrementCount(o); } return createGraphFromPaths(pathCounter, markovOrder); }
/** * If markovOrder is zero, we always transition back to the start state * If markovOrder is negative, we assume that it is infinite */ public static TransducerGraph createGraphFromPaths(List paths, int markovOrder) { ClassicCounter pathCounter = new ClassicCounter(); for (Object o : paths) { pathCounter.incrementCount(o); } return createGraphFromPaths(pathCounter, markovOrder); }
/** * If markovOrder is zero, we always transition back to the start state * If markovOrder is negative, we assume that it is infinite */ public static TransducerGraph createGraphFromPaths(List paths, int markovOrder) { ClassicCounter pathCounter = new ClassicCounter(); for (Object o : paths) { pathCounter.incrementCount(o); } return createGraphFromPaths(pathCounter, markovOrder); }
/** * If markovOrder is zero, we always transition back to the start state * If markovOrder is negative, we assume that it is infinite */ public static TransducerGraph createGraphFromPaths(List paths, int markovOrder) { ClassicCounter pathCounter = new ClassicCounter(); for (Object o : paths) { pathCounter.incrementCount(o); } return createGraphFromPaths(pathCounter, markovOrder); }