Examples of Arc


Examples of edu.cmu.sphinx.fst.Arc

        State s1 = new State(syms.length);
        s1.setFinalWeight(semiring.one());
        State s2 = new State(syms.length);
        s2.setFinalWeight(semiring.one());
        filter.addState(s0);
        s0.addArc(new Arc(e2index, e1index, semiring.one(), s0));
        s0.addArc(new Arc(e1index, e1index, semiring.one(), s1));
        s0.addArc(new Arc(e2index, e2index, semiring.one(), s2));
        for (int i = 1; i < syms.length; i++) {
            s0.addArc(new Arc(i, i, semiring.one(), s0));
        }
        filter.setStart(s0);

        // State 1
        filter.addState(s1);
        s1.addArc(new Arc(e1index, e1index, semiring.one(), s1));
        for (int i = 1; i < syms.length; i++) {
            s1.addArc(new Arc(i, i, semiring.one(), s0));
        }

        // State 2
        filter.addState(s2);
        s2.addArc(new Arc(e2index, e2index, semiring.one(), s2));
        for (int i = 1; i < syms.length; i++) {
            s2.addArc(new Arc(i, i, semiring.one(), s0));
        }

        return filter;
    }
View Full Code Here

Examples of edu.cmu.sphinx.fst.Arc

            State s = fst.getState(i);
            // Immutable fsts hold an additional (null) arc for augmention
            int numArcs = (fst instanceof ImmutableFst) ? s.getNumArcs() - 1
                    : s.getNumArcs();
            for (int j = 0; j < numArcs; j++) {
                Arc a = s.getArc(j);
                if ((label == 1) && (a.getOlabel() == 0)) {
                    a.setOlabel(e2outputIndex);
                } else if ((label == 0) && (a.getIlabel() == 0)) {
                    a.setIlabel(e1inputIndex);
                }
            }
            if (label == 0) {
                if (fst instanceof ImmutableFst) {
                    s.setArc(numArcs, new Arc(e2inputIndex, 0, semiring.one(),
                            s));
                } else {
                    s.addArc(new Arc(e2inputIndex, 0, semiring.one(), s));
                }
            } else if (label == 1) {
                if (fst instanceof ImmutableFst) {
                    s.setArc(numArcs, new Arc(0, e1outputIndex, semiring.one(),
                            s));
                } else {
                    s.addArc(new Arc(0, e1outputIndex, semiring.one(), s));
                }
            }
        }
    }
View Full Code Here

Examples of edu.cmu.sphinx.fst.Arc

        // Add a new single final
        State newFinal = new State(semiring.one());
        fst.addState(newFinal);
        for (State s : fStates) {
            // add epsilon transition from the old final to the new one
            s.addArc(new Arc(0, 0, s.getFinalWeight(), newFinal));
            // set old state's weight to zero
            s.setFinalWeight(semiring.zero());
        }
    }
View Full Code Here

Examples of edu.cmu.sphinx.fst.Arc

            return;
        }
        for (int i = 0; i < numStates; i++) {
            State s = fst.getState(i);
            for (int j = 0; j < s.getNumArcs(); j++) {
                Arc a = s.getArc(j);
                if (a.getIlabel() == 0 && a.getOlabel() == 0
                        && a.getNextState().getId() == f.getId()) {
                    s.setFinalWeight(a.getWeight());
                }
            }
        }
        fst.deleteState(f);
    }
View Full Code Here

Examples of edu.cmu.sphinx.fst.Arc

            float rnew = r[q.getId()];
            r[q.getId()] = semiring.zero();

            for (int i = 0; i < q.getNumArcs(); i++) {
                Arc a = q.getArc(i);
                State nextState = a.getNextState();
                float dnext = d[a.getNextState().getId()];
                float dnextnew = semiring.plus(dnext,
                        semiring.times(rnew, a.getWeight()));
                if (dnext != dnextnew) {
                    d[a.getNextState().getId()] = dnextnew;
                    r[a.getNextState().getId()] = semiring.plus(r[a
                            .getNextState().getId()], semiring.times(rnew,
                            a.getWeight()));
                    if (!queue.contains(nextState.getId())) {
                        queue.add(nextState);
                    }
                }
            }
View Full Code Here

Examples of edu.cmu.sphinx.fst.Arc

            } else {
                // add the incoming arc from previous to current
                State previouState = stateMap.get(previous.get(pair));
                State previousOldState = previous.get(pair).getLeft();
                for (int j = 0; j < previousOldState.getNumArcs(); j++) {
                    Arc a = previousOldState.getArc(j);
                    if (a.getNextState().equals(p)) {
                        previouState.addArc(new Arc(a.getIlabel(), a
                                .getOlabel(), a.getWeight(), s));
                    }
                }
            }

            Integer stateIndex = p.getId();
            r[stateIndex]++;

            if ((r[stateIndex] == n) && (p.getFinalWeight() != semiring.zero())) {
                break;
            }

            if (r[stateIndex] <= n) {
                for (int j = 0; j < p.getNumArcs(); j++) {
                    Arc a = p.getArc(j);
                    float cnew = semiring.times(c, a.getWeight());
                    Pair<State, Float> next = new Pair<State, Float>(
                            a.getNextState(), cnew);
                    previous.put(next, pair);
                    queue.add(next);
                }
            }
        }
View Full Code Here

Examples of edu.cmu.sphinx.fst.Arc

        for (Pair<State, Float> p : pa) {
            State s = p.getLeft();

            int numArcs = s.getNumArcs();
            for (int j = 0; j < numArcs; j++) {
                Arc arc = s.getArc(j);
                if (!res.contains(arc.getIlabel())) {
                    res.add(arc.getIlabel());
                }
            }
        }
        return res;
    }
View Full Code Here

Examples of edu.stanford.nlp.fsm.TransducerGraph.Arc

      if (member != SINK_NODE) {
        memberToBlock.put(member, block);
      }
    }
    for (Iterator symbolI = getSymbols().iterator(); symbolI.hasNext();) {
      Arc symbol = (Arc) symbolI.next();
      addActivePair(new Pair<ExactBlock<Arc>, Arc>(block, symbol));
    }
  }
View Full Code Here

Examples of javafx.scene.shape.Arc

      ccg.setEffect(effect);
      addRimStroke(ccg, rimStrokeFillProperty);
      Bindings.bindBidirectional(ccg.fillProperty(), centerGaugeFillProperty);
      return ccg;
    } else {
      final Arc acg = new Arc(centerX, centerY, radius, radius,
          angleStart, angleLength);
      acg.setType(ArcType.ROUND);
      acg.setCache(true);
      acg.setCacheHint(CacheHint.QUALITY);
      final Shape acf = new Circle(centerX, centerY, dialCenterBackgroundRadius);
      acf.setCache(true);
      final Shape cg = Shape.union(acg, acf);
      cg.setCache(true);
      cg.setEffect(effect);
View Full Code Here

Examples of javafx.scene.shape.Arc

    final double radiusY = centerY + adjAngleLength / 2d;
    final double cx = (radiusX + innerRadius / 2.5d) * Math.cos(Math.toRadians(highlightAngle));
    final double cy = (radiusY + innerRadius / 2.5d) * Math.sin(Math.toRadians(highlightAngle));
    final Ellipse shape1 = new Ellipse(cx, cy, radiusX, radiusY);
    shape1.setFill(Color.GREEN);
    final Arc shape2 = new Arc(centerX, centerY, arcRadius, arcRadius, angleStart, adjAngleLength);
    shape2.setType(ArcType.ROUND);
    shape2.setFill(Color.WHITE);
   
    final Shape highlight = Shape.intersect(shape1, shape2);
   
    highlight.setCache(true);
    highlight.setCacheHint(CacheHint.SPEED);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.