1
package fr.upemlv.lgtools.wfst;
3
import java.util.ArrayList;
6
import fr.upemlv.lgtools.tagging.impl.Utils;
9
final private String word;
10
final private String tag;
11
final private double cost;
12
private double alpha = 0.0;
13
final private int position;
14
private double bestCost;
15
private Node bestPrev;
16
private final List<Arc> arcs = new ArrayList<Arc>();
17
private final List<Arc> rarcs = new ArrayList<Arc>();
19
public Node(String tag,String word,int position,double cost) {
23
this.position = position;
24
this.bestCost = Double.MIN_VALUE;
28
public void addArc(Arc a){
30
a.getDest().rarcs.add(new Arc(a.getDest(),a.getSrc(),a.getCost()));
34
public List<Arc> getArcs() {
38
public List<Arc> getReverseArcs() {
42
public double getBestCost() {
46
public void setBestCost(double bestCost) {
47
this.bestCost = bestCost;
50
public Node getBestPrev() {
54
public void setBestPrev(Node bestPrev) {
55
this.bestPrev = bestPrev;
58
public String getWord() {
62
public String getTag() {
66
public double getCost() {
70
public int getPosition() {
74
public double getAlpha(){
78
public void calcAlpha(){
83
alpha = Utils.logsumexp(alpha,
84
n.getCost() +n.getAlpha(),