Permalink
Browse files

Relatively minor updates -- see ChangeLog.md

  • Loading branch information...
yoavartzi committed Dec 24, 2016
1 parent 4626f63 commit 6dba2cbbece0d7240c4ddbaad612497052a05a09
Showing with 348 additions and 335 deletions.
  1. +5 −0 ChangeLog.md
  2. +7 −5 README.md
  3. +1 −1 VERSION
  4. +0 −6 az-arxiv.2013.bib
  5. BIN az-arxiv.2013.pdf
  6. +5 −4 data.situated.labeled/src/edu/cornell/cs/nlp/spf/data/situated/labeled/LabeledSituatedSentence.java
  7. +49 −48 parser.ccg.cky/src/edu/cornell/cs/nlp/spf/parser/ccg/cky/chart/Cell.java
  8. +50 −61 parser.ccg.cky/src/edu/cornell/cs/nlp/spf/parser/ccg/cky/chart/Chart.java
  9. +5 −3 parser.ccg.cky/src/edu/cornell/cs/nlp/spf/parser/ccg/cky/steps/IWeightedCKYStep.java
  10. +6 −7 parser.ccg.joint.cky/src/edu/cornell/cs/nlp/spf/parser/ccg/joint/cky/JointInferenceChartLogger.java
  11. +26 −32 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/AbstractJointDerivation.java
  12. +9 −33 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/AbstractJointOutput.java
  13. +7 −0 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/IJointDerivation.java
  14. +30 −0 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/InferencePair.java
  15. +21 −15 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/JointDerivation.java
  16. +17 −23 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/JointOutput.java
  17. +5 −5 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/exec/AbstractJointExecution.java
  18. +31 −19 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/graph/JointGraphDerivation.java
  19. +32 −41 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/graph/JointGraphOutput.java
  20. +11 −29 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/injective/AbstractInjectiveJointOutput.java
  21. +7 −2 parser.ccg.joint/src/edu/cornell/cs/nlp/spf/parser/joint/injective/InjectiveJointDerivation.java
  22. +1 −1 spfdist/src/edu/cornell/cs/nlp/spf/reliabledist/ReliableManager.java
  23. +23 −0 ...nell/cs/nlp/spf/parser/ccg/rules/primitivebinary/composition/BackwardCrossingCompositionTest.java
View
@@ -1,3 +1,8 @@
# v2.1
- Update README and bib file
- Various cosmetic changes to simplify use of generics
- Fix Eclipse build issues -- follow README to work with Eclipse
# v2.0
- Support for crossing and high order composition.
- Proper implementation of normal form parsing with Eisner (1996) NF.
View
@@ -24,17 +24,18 @@ Please post all technical questions and inquiries in our the [https://groups.goo
When using Cornell SPF, please acknowledge it by citing:
Artzi, Y., & Zettlemoyer, L. (2013). UW SPF: The University of Washington Semantic Parsing Framework.
[Artzi, Yoav (2016). Cornell SPF: Cornell Semantic Parsing Framework.](https://arxiv.org/abs/1311.3011)
[**Bibtex:**](http://yoavartzi.com/pub/az-arxiv.2013.bib)
@misc{Artzi:13spf,
Author = {Yoav Artzi and Luke Zettlemoyer},
Title = {{UW SPF: The University of Washington Semantic Parsing Framework}},
Year = {2013},
@misc{Artzi:16spf,
Author = {Yoav Artzi},
Title = {{Cornell SPF: Cornell Semantic Parsing Framework}},
Year = {2016},
Eprint = {arXiv:1311.3011},
}
The article and bib file are both attached to the source code. When using specific algorithms please cite the appropriate work (see below).
### Validation-based learning, joint inference and coarse-to-fine lexical generation
@@ -164,6 +165,7 @@ Eunsol Choi, The University of Washington
Nicholas FitzGerald, The University of Washington
Jun Ki Lee, Brown University
Kenton Lee, The University of Washington
Dipendra Misra, Cornell University
Gabriel Schubiner, The University of Washington
Adrienne Wang, The University of Washington
View
@@ -1 +1 @@
2.0
2.1
View
@@ -1,6 +0,0 @@
@misc{Artzi:13spf,
Author = {Yoav Artzi and Luke Zettlemoyer},
Title = {{UW SPF: The University of Washington Semantic Parsing Framework}},
Year = {2013},
Eprint = {arXiv:1311.3011},
}
View
Binary file not shown.
@@ -31,15 +31,16 @@
* @param <LABEL>
* Final label for testing.
*/
public class LabeledSituatedSentence<STATE, LABEL> implements
ILabeledDataItem<SituatedSentence<STATE>, LABEL> {
public class LabeledSituatedSentence<STATE, LABEL>
implements ILabeledDataItem<SituatedSentence<STATE>, LABEL> {
private static final long serialVersionUID = -4413253762974669632L;
private final LABEL label;
private final Map<String, String> properties;
private final SituatedSentence<STATE> sentence;
public LabeledSituatedSentence(SituatedSentence<STATE> sentence, LABEL label) {
public LabeledSituatedSentence(SituatedSentence<STATE> sentence,
LABEL label) {
this(sentence, label, Collections.<String, String> emptyMap());
}
@@ -66,7 +67,7 @@ public LABEL getLabel() {
@Override
public boolean isCorrect(LABEL candidate) {
return label.equals(label);
return label.equals(candidate);
}
@Override
@@ -20,6 +20,7 @@
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -56,7 +57,7 @@
*/
public class Cell<MR> implements IArrayRuleNameSet {
public static final ILogger LOG = LoggerFactory
.create(Cell.class);
.create(Cell.class);
private final Category<MR> category;
@@ -98,7 +99,9 @@
private int numViterbiSteps = 0;
/** The starting index of the span of the input string covered by this cell. */
/**
* The starting index of the span of the input string covered by this cell.
*/
private final int start;
/**
@@ -150,28 +153,16 @@ protected Cell(IWeightedCKYStep<MR> parseStep, boolean isCompleteSpan) {
* @return 'true' iff max children lists changed
*/
public boolean addCell(Cell<MR> other) {
// Iterate over the added children and add them to steps list and inside
// score
boolean addedToMaxChildren = false;
for (final IWeightedCKYStep<MR> derivationStep : other.steps) {
assert derivationStep.getStart() == start
&& derivationStep.getEnd() == end;
if (steps.add(derivationStep)) {
// Reset the cached set of generating rules and viterbi steps.
viterbiSteps = null;
generatingRules = null;
addedToMaxChildren = updateScores(derivationStep)
|| addedToMaxChildren;
}
}
return addedToMaxChildren;
// Try to add all the steps from the other cell.
return addSteps(other.steps);
}
/**
* Recursively compute the mean (linear) viterbi feature vector.
*/
public IHashVector computeMaxAvgFeaturesRecursively() {
return computeMaxAvgFeaturesRecursively(new HashMap<Cell<MR>, IHashVector>());
return computeMaxAvgFeaturesRecursively(
new HashMap<Cell<MR>, IHashVector>());
}
@Override
@@ -383,23 +374,19 @@ public String toString(boolean recursive, String tokens, boolean viterbi,
IHashVectorImmutable theta) {
final StringBuffer result = new StringBuffer();
result.append("[");
result.append(start)
.append("-")
.append(end)
.append(" : ")
result.append(start).append("-").append(end).append(" : ")
.append(tokens == null ? "" : tokens)
.append(tokens == null ? "" : " :- ")
.append(category)
.append(" : ")
.append("prune=")
.append(getPruneScore() == getSecondPruneScore() ? getPruneScore()
.append(tokens == null ? "" : " :- ").append(category)
.append(" : ").append("prune=")
.append(getPruneScore() == getSecondPruneScore()
? getPruneScore()
: String.format("(%f,%f)", getPruneScore(),
getSecondPruneScore())).append(" : ")
.append("numParses=").append(numParses).append(" : ")
.append("numViterbiParses=").append(numViterbiParses)
.append(" : ").append("hash=").append(hashCode()).append(" : ")
.append(steps.size()).append(" : ").append(viterbiScore)
.append(" : ");
getSecondPruneScore()))
.append(" : ").append("numParses=").append(numParses)
.append(" : ").append("numViterbiParses=")
.append(numViterbiParses).append(" : ").append("hash=")
.append(hashCode()).append(" : ").append(steps.size())
.append(" : ").append(viterbiScore).append(" : ");
// Print the steps that created this cell.
result.append("[");
@@ -434,6 +421,22 @@ public String toString(boolean recursive, String tokens, boolean viterbi,
return result.toString();
}
private boolean addSteps(Collection<IWeightedCKYStep<MR>> stepsToAdd) {
boolean addedToMaxChildren = false;
for (final IWeightedCKYStep<MR> derivationStep : stepsToAdd) {
assert derivationStep.getStart() == start
&& derivationStep.getEnd() == end;
if (steps.add(derivationStep)) {
// Reset the cached set of generating rules and viterbi steps.
viterbiSteps = null;
generatingRules = null;
addedToMaxChildren = updateScores(derivationStep)
|| addedToMaxChildren;
}
}
return addedToMaxChildren;
}
private int calcHashCode() {
final int prime = 31;
int result = 1;
@@ -521,8 +524,8 @@ private void recursiveGetLexicalEntries(
// previous recursive call
return;
} else {
for (final IWeightedCKYStep<MR> derivationStep : viterbiOnly ? getViterbiSteps()
: steps) {
for (final IWeightedCKYStep<MR> derivationStep : viterbiOnly
? getViterbiSteps() : steps) {
if (derivationStep instanceof ILexicalParseStep) {
result.add(((ILexicalParseStep<MR>) derivationStep)
.getLexicalEntry());
@@ -572,8 +575,8 @@ private void recursiveGetParseSteps(
// previous recursive call
return;
} else {
for (final IWeightedCKYStep<MR> derivationStep : viterbiOnly ? getViterbiSteps()
: steps) {
for (final IWeightedCKYStep<MR> derivationStep : viterbiOnly
? getViterbiSteps() : steps) {
for (final Cell<MR> child : derivationStep) {
child.recursiveGetParseSteps(result, visited, viterbiOnly);
}
@@ -699,14 +702,12 @@ void updateBinaryChildrenLogOutsideScore() {
final double logScore = derivationStep.getStepScore();
final Cell<MR> child1 = derivationStep.getChildCell(0);
final Cell<MR> child2 = derivationStep.getChildCell(1);
child1.logOutsideScore = LogSumExp.of(
child1.logOutsideScore,
logOutsideScore + child2.getLogInsideScore()
+ logScore);
child2.logOutsideScore = LogSumExp.of(
child2.logOutsideScore,
logOutsideScore + child1.getLogInsideScore()
+ logScore);
child1.logOutsideScore = LogSumExp
.of(child1.logOutsideScore, logOutsideScore
+ child2.getLogInsideScore() + logScore);
child2.logOutsideScore = LogSumExp
.of(child2.logOutsideScore, logOutsideScore
+ child1.getLogInsideScore() + logScore);
}
}
}
@@ -734,10 +735,10 @@ void updateUnaryChildrenLogOutsideScore() {
}
}
public static class ScoreComparator<MR> implements Comparator<Cell<MR>>,
Serializable {
public static class ScoreComparator<MR>
implements Comparator<Cell<MR>>, Serializable {
private static final long serialVersionUID = 5348011347391634770L;
private static final long serialVersionUID = 5348011347391634770L;
@Override
public int compare(Cell<MR> o1, Cell<MR> o2) {
Oops, something went wrong.

0 comments on commit 6dba2cb

Please sign in to comment.