Debian Codegraph @

bindings/java/org/linkgrammar/Linkage.java

raw
1 /*************************************************************************/
2 /* */
3 /* Use of the link grammar parsing system is subject to the terms of the */
4 /* license set forth in the LICENSE file included with this software. */
5 /* This license allows free redistribution and use in source and binary */
6 /* forms, with or without modification, subject to certain conditions. */
7 /* */
8 /*************************************************************************/
9
10 package org.linkgrammar;
11
12 import java.util.ArrayList;
13 import java.util.Iterator;
14 import java.util.List;
15
16 /**
17 * A <code>Linkage</code> represents one of possibly many parses
18 * returned by the Link Grammar parser. Each <code>Linkage</code>
19 * is defined by a list of <code>Link</code>s between the tokens
20 * in a sentence. A <code>Linkage</code> also has some metadata
21 * associated with it, e.g. for various cost measures.
22 *
23 * @author Borislav Iordanov
24 */
25 public class Linkage implements Iterable<Link>
26 {
27 private List<Link> links = new ArrayList<Link>();
28 private String [] disjuncts;
29 private String [] words;
30 private String constituentString;
31 private String diagramString;
32 private int linkedWordCount;
33 private double disjunctCost;
34 private double linkCost;
35 private int numViolations;
36
37 public List<Link> getLinks()
38 {
39 return links;
40 }
41
42 public Iterator<Link> iterator()
43 {
44 return links.iterator();
45 }
46
47 public String disjunctAt(int i)
48 {
49 return disjuncts[i];
50 }
51
52 public String[] getDisjuncts()
53 {
54 return disjuncts;
55 }
56
57 public void setDisjuncts(String[] disjuncts)
58 {
59 this.disjuncts = disjuncts;
60 }
61
62 public String wordAt(int i)
63 {
64 return words[i];
65 }
66
67 public String[] getWords()
68 {
69 return words;
70 }
71
72 public void setWords(String[] words)
73 {
74 this.words = words;
75 }
76
77 public double getDisjunctCost()
78 {
79 return disjunctCost;
80 }
81
82 public void setDisjunctCost(double disjunctCost)
83 {
84 this.disjunctCost = disjunctCost;
85 }
86
87 public double getLinkCost()
88 {
89 return linkCost;
90 }
91
92 public void setLinkCost(double linkCost)
93 {
94 this.linkCost = linkCost;
95 }
96
97 public int getNumViolations()
98 {
99 return numViolations;
100 }
101
102 public void setNumViolations(int numViolations)
103 {
104 this.numViolations = numViolations;
105 }
106
107 public int getLinkedWordCount()
108 {
109 return linkedWordCount;
110 }
111
112 public void setLinkedWordCount(int linkedWordCount)
113 {
114 this.linkedWordCount = linkedWordCount;
115 }
116
117 public String getConstituentString()
118 {
119 return constituentString;
120 }
121
122 public void setConstituentString(String constituentString)
123 {
124 this.constituentString = constituentString;
125 }
126
127 public String getDiagramString()
128 {
129 return diagramString;
130 }
131
132 public void setDiagramString(String diagramString)
133 {
134 this.diagramString = diagramString;
135 }
136 }