Commit 2b9194f4 authored by Andrea Cascallar Fuentes's avatar Andrea Cascallar Fuentes

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	pom.xml
#	src/main/java/simplenlg/aggregation/AggregationRule.java
#	src/main/java/simplenlg/aggregation/ClauseCoordinationRule.java
#	src/main/java/simplenlg/framework/CoordinatedPhraseElement.java
#	src/main/java/simplenlg/framework/NLGFactory.java
#	src/main/java/simplenlg/lexicon/Lexicon.java
#	src/main/java/simplenlg/realiser/Realiser.java
#	src/main/resources/default-galician-lexicon.xml
#	src/test/java/simplenlg/external/english/ExternalTest.java
#	src/test/java/simplenlg/external/galician/ExternalTest.java
#	src/test/java/simplenlg/realiser/english/RealiserTest.java
#	src/test/java/simplenlg/syntax/english/AdjectivePhraseTest.java
#	src/test/java/simplenlg/syntax/english/ClauseTest.java
#	src/test/java/simplenlg/syntax/english/FeatureTest.java
#	src/test/java/simplenlg/syntax/english/InterrogativeTest.java
#	src/test/java/simplenlg/syntax/english/NounPhraseTest.java
#	src/test/java/simplenlg/syntax/english/PremodifierTest.java
#	src/test/java/simplenlg/syntax/english/PrepositionalPhraseTest.java
#	src/test/java/simplenlg/syntax/english/StringElementTest.java
#	src/test/java/simplenlg/syntax/english/TutorialTest.java
#	src/test/java/simplenlg/syntax/galician/InterrogativeTest2.java
#	src/test/java/simplenlg/syntax/spanish/InterrogativeTest.java
parents 1de6ba8c caee5a64
*.zip filter=lfs diff=lfs merge=lfs -text
*.data filter=lfs diff=lfs merge=lfs -text
/target/*
/.idea/*
/.settings/*
/src/test/resources/NIHLexicon/*
*.class
*.log
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
hs_err_pid*
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version> <version>1.8</version>
<executions> <!--<executions>
<execution> <execution>
<id>unzip</id> <id>unzip</id>
<phase>process-test-resources</phase> <phase>process-test-resources</phase>
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
<goal>run</goal> <goal>run</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>-->
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
......
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="Maven: junit:junit:4.4">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/junit-4.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: gov.nih.nlm.nls.lexAccess.Api:LexAccess2011dist:0.0.1">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/lexAccess2011dist.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: org.apache.maven.plugins:maven-antrun-plugin:1.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-project:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-profile:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact-manager:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-6" level="project" />
<orderEntry type="library" name="Maven: backport-util-concurrent:backport-util-concurrent:3.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-registry:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.11" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1" level="project" />
<orderEntry type="library" name="Maven: classworlds:classworlds:1.1-alpha-2" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:3.0.20" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant:1.9.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant-launcher:1.9.4" level="project" />
</component>
</module>
\ No newline at end of file
...@@ -45,6 +45,13 @@ public abstract class AggregationRule { ...@@ -45,6 +45,13 @@ public abstract class AggregationRule {
this.factory = new NLGFactory(); this.factory = new NLGFactory();
} }
/**
* Creates a new instance of AggregationRule
*/
public AggregationRule(NLGFactory factory) {
this.factory = factory;
}
/** /**
* @return the factory being used by this rule to create phrases * @return the factory being used by this rule to create phrases
*/ */
......
...@@ -22,6 +22,7 @@ import simplenlg.features.Feature; ...@@ -22,6 +22,7 @@ import simplenlg.features.Feature;
import simplenlg.features.InternalFeature; import simplenlg.features.InternalFeature;
import simplenlg.framework.CoordinatedPhraseElement; import simplenlg.framework.CoordinatedPhraseElement;
import simplenlg.framework.NLGElement; import simplenlg.framework.NLGElement;
import simplenlg.framework.NLGFactory;
import simplenlg.framework.PhraseCategory; import simplenlg.framework.PhraseCategory;
import java.util.List; import java.util.List;
...@@ -62,6 +63,13 @@ public class ClauseCoordinationRule extends AggregationRule { ...@@ -62,6 +63,13 @@ public class ClauseCoordinationRule extends AggregationRule {
super(); super();
} }
/**
* Constructs an instance of the ClauseCoordinationRule
*/
public ClauseCoordinationRule(NLGFactory factory) {
super(factory);
}
/** /**
* Applies aggregation to two NLGElements e1 and e2, succeeding only if they * Applies aggregation to two NLGElements e1 and e2, succeeding only if they
* are clauses (that is, e1.getCategory() == e2.getCategory == * are clauses (that is, e1.getCategory() == e2.getCategory ==
......
...@@ -92,7 +92,7 @@ public class CoordinatedPhraseElement extends NLGElement { ...@@ -92,7 +92,7 @@ public class CoordinatedPhraseElement extends NLGElement {
* @param coordinate1 the first coordinate. * @param coordinate1 the first coordinate.
* @param coordinate2 the second coordinate. * @param coordinate2 the second coordinate.
*/ */
public CoordinatedPhraseElement(Object coordinate1, Object coordinate2) { public CoordinatedPhraseElement(Object coordinate1, Object coordinate2) {
this(coordinate1, coordinate2, new NLGFactory()); this(coordinate1, coordinate2, new NLGFactory());
} }
......
...@@ -19,9 +19,7 @@ ...@@ -19,9 +19,7 @@
package simplenlg.framework; package simplenlg.framework;
import simplenlg.features.InternalFeature; import simplenlg.features.InternalFeature;
import simplenlg.features.LexicalFeature;
import simplenlg.lexicon.Lexicon; import simplenlg.lexicon.Lexicon;
import simplenlg.lexicon.galician.XMLLexicon;
import simplenlg.phrasespec.*; import simplenlg.phrasespec.*;
import java.util.List; import java.util.List;
...@@ -86,8 +84,12 @@ public class NLGFactory { ...@@ -86,8 +84,12 @@ public class NLGFactory {
* Gets the lexicon used by this factory. * Gets the lexicon used by this factory.
*/ */
public Lexicon getLexicon() { public Lexicon getLexicon() {
if (lexicon == null)
this.lexicon = new XMLLexicon(); if (lexicon == null) {
//if lexicon == null, gets default lexicon
this.lexicon = Lexicon.getDefaultLexicon();
}
return this.lexicon; return this.lexicon;
} }
...@@ -168,7 +170,7 @@ public class NLGFactory { ...@@ -168,7 +170,7 @@ public class NLGFactory {
inflElement = new InflectedWordElement((WordElement) word); inflElement = new InflectedWordElement((WordElement) word);
} else if (word instanceof String) { } else if (word instanceof String) {
NLGElement baseword = createWord((String) word, category); NLGElement baseword = createWord(word, category);
if (baseword != null && baseword instanceof WordElement) { if (baseword != null && baseword instanceof WordElement) {
inflElement = new InflectedWordElement((WordElement) baseword); inflElement = new InflectedWordElement((WordElement) baseword);
...@@ -193,7 +195,7 @@ public class NLGFactory { ...@@ -193,7 +195,7 @@ public class NLGFactory {
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private void doLexiconLookUp(LexicalCategory category, String word, NLGElement wordElement) { private void doLexiconLookUp(LexicalCategory category, String word, NLGElement wordElement) {
WordElement baseWord = null; WordElement baseWord;
if (LexicalCategory.NOUN.equals(category) && this.lexicon.hasWord(word, LexicalCategory.PRONOUN)) { if (LexicalCategory.NOUN.equals(category) && this.lexicon.hasWord(word, LexicalCategory.PRONOUN)) {
baseWord = this.lexicon.lookupWord(word, LexicalCategory.PRONOUN); baseWord = this.lexicon.lookupWord(word, LexicalCategory.PRONOUN);
...@@ -371,13 +373,13 @@ public class NLGFactory { ...@@ -371,13 +373,13 @@ public class NLGFactory {
if (specifier != null) { if (specifier != null) {
//when possesive + noun add determiner -> determiner + possesive + noun //when possesive + noun add determiner -> determiner + possesive + noun
if(specifier.toString().equals("meu") || specifier.toString().equals("teu") || specifier.toString().equals("seu") || specifier.toString().equals("noso") || specifier.toString().equals("voso")) { if (specifier.toString().equals("meu") || specifier.toString().equals("teu") || specifier.toString().equals("seu") || specifier.toString().equals("noso") || specifier.toString().equals("voso")) {
phraseElement.setSpecifier("o"); phraseElement.setSpecifier("o");
phraseElement.addSpecifier(specifier); phraseElement.addSpecifier(specifier);
} else if (specifier.toString().equals("miña") || specifier.toString().equals("túa") || specifier.toString().equals("súa") || specifier.toString().equals("nosa") || specifier.toString().equals("vosa")) { } else if (specifier.toString().equals("miña") || specifier.toString().equals("túa") || specifier.toString().equals("súa") || specifier.toString().equals("nosa") || specifier.toString().equals("vosa")) {
phraseElement.setSpecifier("a"); phraseElement.setSpecifier("a");
phraseElement.addSpecifier(specifier); phraseElement.addSpecifier(specifier);
} else if(specifier.toString().equals("meus") || specifier.toString().equals("teus") || specifier.toString().equals("seus") || specifier.toString().equals("nosos") || specifier.toString().equals("vosos")) { } else if (specifier.toString().equals("meus") || specifier.toString().equals("teus") || specifier.toString().equals("seus") || specifier.toString().equals("nosos") || specifier.toString().equals("vosos")) {
phraseElement.setSpecifier("os"); phraseElement.setSpecifier("os");
phraseElement.addSpecifier(specifier); phraseElement.addSpecifier(specifier);
} else if (specifier.toString().equals("miñas") || specifier.toString().equals("túas") || specifier.toString().equals("súas") || specifier.toString().equals("nosas") || specifier.toString().equals("vosas")) { } else if (specifier.toString().equals("miñas") || specifier.toString().equals("túas") || specifier.toString().equals("súas") || specifier.toString().equals("nosas") || specifier.toString().equals("vosas")) {
......
...@@ -130,9 +130,36 @@ public abstract class Lexicon { ...@@ -130,9 +130,36 @@ public abstract class Lexicon {
* @return default lexicon * @return default lexicon
*/ */
public static Lexicon getDefaultLexicon() { public static Lexicon getDefaultLexicon() {
return new simplenlg.lexicon.galician.XMLLexicon();
}
/**
* returns the English built-in lexicon
*
* @return default lexicon
*/
public static Lexicon getEnglishLexicon() {
return new simplenlg.lexicon.english.XMLLexicon(); return new simplenlg.lexicon.english.XMLLexicon();
} }
/**
* returns the Spanish built-in lexicon
*
* @return default lexicon
*/
public static Lexicon getSpanishLexicon() {
return new simplenlg.lexicon.spanish.XMLLexicon();
}
/**
* returns the Galician built-in lexicon
*
* @return default lexicon
*/
public static Lexicon getGalicianLexicon() {
return new simplenlg.lexicon.galician.XMLLexicon();
}
/** /**
* Gets the language used by this factory. * Gets the language used by this factory.
*/ */
......
...@@ -139,72 +139,78 @@ public abstract class Realiser extends NLGModule { ...@@ -139,72 +139,78 @@ public abstract class Realiser extends NLGModule {
debug.append("<br/>POST-SYNTAX TREE<br/>"); debug.append("<br/>POST-SYNTAX TREE<br/>");
debug.append(postSyntax.printTree("&nbsp;&nbsp;").replaceAll("\n", "<br/>")); debug.append(postSyntax.printTree("&nbsp;&nbsp;").replaceAll("\n", "<br/>"));
} }
//////////////////////////////verb + pronoun colocation///////////////////////////////////////////////// //////////////////////////////Galician verb + pronoun colocation/////////////////////////////////////////////////
//negated and interrogative sentences: verb+pronoun //negated and interrogative sentences: verb+pronoun
if(postSyntax.getCategory() != null && postSyntax.getCategory().equals(DocumentCategory.SENTENCE)) { try {
if (postSyntax.getFeatureAsBoolean(Feature.NEGATED) == false && postSyntax.getFeatureAsBoolean(Feature.INTERROGATIVE_TYPE) == false) { if (this.syntax.getLexicon() != null && this.syntax.getLexicon().getLanguage().equals(Language.GALICIAN) /*&& postSyntax.getCategory() != null && postSyntax.getCategory().equals(DocumentCategory.SENTENCE)*/) {
pronoun_after = true; if (postSyntax.getFeatureAsBoolean(Feature.NEGATED) == false && postSyntax.getFeatureAsBoolean(Feature.INTERROGATIVE_TYPE) == false) {
} pronoun_after = true;
List<NLGElement> elements = new ArrayList<NLGElement>(); }
if (postSyntax instanceof ListElement || postSyntax instanceof DocumentElement) { List<NLGElement> elements = new ArrayList<NLGElement>();
elements.addAll(postSyntax.getChildren()); if (postSyntax instanceof ListElement || postSyntax instanceof DocumentElement) {
} else { elements.addAll(postSyntax.getChildren());
elements.add(postSyntax); } else {
} elements.add(postSyntax);
}
elements = checkElements(elements);
elements = checkElements(elements); int indexVerb = -1, indexSubordinate = -1, indexAdverb = -1, indexIndefinite = -1, indexInterrogative = -1, indexDesiderative = -1;
for (NLGElement e : elements) {
try {
if (e.getCategory().equals(LexicalCategory.VERB)) {
indexVerb = elements.indexOf(e);
}
} catch (Exception ex) {
int indexVerb = -1, indexSubordinate = -1, indexAdverb = -1, indexIndefinite = -1, indexInterrogative = -1, indexDesiderative = -1;
for (NLGElement e : elements) {
try {
if (e.getCategory().equals(LexicalCategory.VERB)) {
indexVerb = elements.indexOf(e);
} }
} catch (Exception ex) { try {
if (Arrays.asList(SUBORDINATES).contains(e.getRealisation())) {
indexSubordinate = elements.indexOf(e);
}
if (Arrays.asList(ADVERBS).contains(e.getRealisation()) || e.getCategory().equals(LexicalCategory.ADVERB)) {
indexAdverb = elements.indexOf(e);
}
if (Arrays.asList(INDEFINITES).contains(e.getRealisation())) {
indexIndefinite = elements.indexOf(e);
}
if (Arrays.asList(INTERROGATIVES).contains(e.getRealisation())) {
indexInterrogative = elements.indexOf(e);
}
if (Arrays.asList(DESIDERATIVES).contains(e.getRealisation())) {
indexDesiderative = elements.indexOf(e);
}
} catch (Exception ex) {
}
} }
try { if (indexVerb >= 0) {
if (Arrays.asList(SUBORDINATES).contains(e.getRealisation())) { //subordinates sentences: pronoun before
indexSubordinate = elements.indexOf(e); if (indexSubordinate >= 0 && indexSubordinate < indexVerb) {
pronoun_after = false;
} }
if (Arrays.asList(ADVERBS).contains(e.getRealisation()) || e.getCategory().equals(LexicalCategory.ADVERB)) { //with some adverbs: pronoun before
indexAdverb = elements.indexOf(e); if (indexAdverb >= 0 && indexAdverb < indexVerb) {
pronoun_after = false;
} }
if (Arrays.asList(INDEFINITES).contains(e.getRealisation())) { //with some indefinites: pronoun before
indexIndefinite = elements.indexOf(e); if (indexIndefinite >= 0 && indexIndefinite < indexVerb) {
pronoun_after = false;
} }
if (Arrays.asList(INTERROGATIVES).contains(e.getRealisation())) { //with interrogatives: pronoun before
indexInterrogative = elements.indexOf(e); if (indexInterrogative >= 0 && indexInterrogative < indexVerb) {
pronoun_after = false;
} }
if (Arrays.asList(DESIDERATIVES).contains(e.getRealisation())) { //in desideratives phrases: pronoun before
indexDesiderative = elements.indexOf(e); if (indexDesiderative >= 0 && indexDesiderative < indexVerb) {
pronoun_after = false;
} }
} catch (Exception ex) {
}
}
if (indexVerb >= 0) {
//subordinates sentences: pronoun before
if (indexSubordinate >= 0 && indexSubordinate < indexVerb) {
pronoun_after = false;
}
//with some adverbs: pronoun before
if (indexAdverb >= 0 && indexAdverb < indexVerb) {
pronoun_after = false;
}
//with some indefinites: pronoun before
if (indexIndefinite >= 0 && indexIndefinite < indexVerb) {
pronoun_after = false;
}
//with interrogatives: pronoun before
if (indexInterrogative >= 0 && indexInterrogative < indexVerb) {
pronoun_after = false;
}
//in desideratives phrases: pronoun before
if (indexDesiderative >= 0 && indexDesiderative < indexVerb) {
pronoun_after = false;
} }
} else {
pronoun_after = true;
} }
}catch (Exception e) {
} }
postSyntax.setFeature(Feature.PRONOUN_AFTER, pronoun_after); postSyntax.setFeature(Feature.PRONOUN_AFTER, pronoun_after);
......
...@@ -292316,7 +292316,7 @@ ...@@ -292316,7 +292316,7 @@
<base>quen</base> <base>quen</base>
<category>pronoun</category> <category>pronoun</category>
<gender>neuter</gender> <gender>neuter</gender>
<number>singular</number> <number>both</number>
<person>none</person> <person>none</person>
</word> </word>
<word> <word>
This diff is collapsed.
...@@ -47,7 +47,7 @@ public class ExternalTest { ...@@ -47,7 +47,7 @@ public class ExternalTest {
@Before @Before
public void setup() { public void setup() {
lexicon = Lexicon.getDefaultLexicon(); lexicon = Lexicon.getEnglishLexicon();
phraseFactory = new NLGFactory(lexicon); phraseFactory = new NLGFactory(lexicon);
realiser = new Realiser(lexicon); realiser = new Realiser(lexicon);
} }
...@@ -143,7 +143,7 @@ public class ExternalTest { ...@@ -143,7 +143,7 @@ public class ExternalTest {
verbPhrase1 = this.phraseFactory.createVerbPhrase("perform"); //$NON-NLS-1$ verbPhrase1 = this.phraseFactory.createVerbPhrase("perform"); //$NON-NLS-1$
CoordinatedPhraseElement coord1 = new CoordinatedPhraseElement(noun2, CoordinatedPhraseElement coord1 = new CoordinatedPhraseElement(noun2,
noun3); noun3, phraseFactory);
sentence1 = this.phraseFactory.createClause(noun1, verbPhrase1, coord1); sentence1 = this.phraseFactory.createClause(noun1, verbPhrase1, coord1);
sentence1.setFeature(Feature.TENSE,Tense.PAST); sentence1.setFeature(Feature.TENSE,Tense.PAST);
...@@ -418,7 +418,7 @@ public class ExternalTest { ...@@ -418,7 +418,7 @@ public class ExternalTest {
// aggregation // aggregation
SPhraseSpec s1 = this.phraseFactory.createClause("the man", "be", "hungry"); SPhraseSpec s1 = this.phraseFactory.createClause("the man", "be", "hungry");
SPhraseSpec s2 = this.phraseFactory.createClause("the man", "buy", "an apple"); SPhraseSpec s2 = this.phraseFactory.createClause("the man", "buy", "an apple");
NLGElement result = new ClauseCoordinationRule().apply(s1, s2); NLGElement result = new ClauseCoordinationRule(this.phraseFactory).apply(s1, s2);
Assert.assertEquals("The man is hungry and buys an apple.", realiser.realiseSentence(result)); Assert.assertEquals("The man is hungry and buys an apple.", realiser.realiseSentence(result));
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package simplenlg.external.galician; package simplenlg.external.galician;
import gov.nih.nlm.nls.lvg.Lib.Category;
import junit.framework.Assert; import junit.framework.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
...@@ -34,6 +35,7 @@ import simplenlg.realiser.galician.Realiser; ...@@ -34,6 +35,7 @@ import simplenlg.realiser.galician.Realiser;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
/** /**
* Tests from third parties * Tests from third parties
......
...@@ -55,7 +55,7 @@ public class RealiserTest { ...@@ -55,7 +55,7 @@ public class RealiserTest {
@Before @Before
public void setup() { public void setup() {
lexicon = Lexicon.getDefaultLexicon(); lexicon = Lexicon.getEnglishLexicon();
nlgFactory = new NLGFactory(lexicon); nlgFactory = new NLGFactory(lexicon);
realiser = new Realiser(lexicon); realiser = new Realiser(lexicon);
} }
......
...@@ -75,7 +75,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test { ...@@ -75,7 +75,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test {
// coordinate the two aps // coordinate the two aps
CoordinatedPhraseElement coordap = new CoordinatedPhraseElement( CoordinatedPhraseElement coordap = new CoordinatedPhraseElement(
this.salacious, this.beautiful); this.salacious, this.beautiful, this.phraseFactory);
Assert.assertEquals("incredibly salacious and amazingly beautiful", //$NON-NLS-1$ Assert.assertEquals("incredibly salacious and amazingly beautiful", //$NON-NLS-1$
this.realiser.realise(coordap).getRealisation()); this.realiser.realise(coordap).getRealisation());
...@@ -86,7 +86,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test { ...@@ -86,7 +86,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test {
// coordinate this with a new AdjPhraseSpec // coordinate this with a new AdjPhraseSpec
CoordinatedPhraseElement coord2 = new CoordinatedPhraseElement(coordap, CoordinatedPhraseElement coord2 = new CoordinatedPhraseElement(coordap,
this.stunning); this.stunning, this.phraseFactory);
Assert.assertEquals( Assert.assertEquals(
"incredibly salacious or amazingly beautiful and stunning", //$NON-NLS-1$ "incredibly salacious or amazingly beautiful and stunning", //$NON-NLS-1$
this.realiser.realise(coord2).getRealisation()); this.realiser.realise(coord2).getRealisation());
...@@ -95,7 +95,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test { ...@@ -95,7 +95,7 @@ public class AdjectivePhraseTest extends SimpleNLG4Test {
// "seriously and undeniably incredibly salacious or amazingly beautiful // "seriously and undeniably incredibly salacious or amazingly beautiful
// and stunning" // and stunning"
CoordinatedPhraseElement preMod = new CoordinatedPhraseElement( CoordinatedPhraseElement preMod = new CoordinatedPhraseElement(
new StringElement("seriously"), new StringElement("undeniably")); //$NON-NLS-1$//$NON-NLS-2$ new StringElement("seriously"), new StringElement("undeniably"), this.phraseFactory); //$NON-NLS-1$//$NON-NLS-2$
coord2.addPreModifier(preMod); coord2.addPreModifier(preMod);
Assert.assertEquals( Assert.assertEquals(
......
...@@ -427,7 +427,7 @@ public class ClauseTest extends SimpleNLG4Test { ...@@ -427,7 +427,7 @@ public class ClauseTest extends SimpleNLG4Test {
s5.setObject(this.phraseFactory.createNounPhrase("the", "cat")); //$NON-NLS-1$ //$NON-NLS-2$ s5.setObject(this.phraseFactory.createNounPhrase("the", "cat")); //$NON-NLS-1$ //$NON-NLS-2$
CoordinatedPhraseElement coord = new CoordinatedPhraseElement(this.s3, CoordinatedPhraseElement coord = new CoordinatedPhraseElement(this.s3,
s5); s5, this.phraseFactory);
complexS = this.phraseFactory.createClause(); complexS = this.phraseFactory.createClause();
complexS.setVerbPhrase(this.phraseFactory.createVerbPhrase("upset")); //$NON-NLS-1$ complexS.setVerbPhrase(this.phraseFactory.createVerbPhrase("upset")); //$NON-NLS-1$
complexS.setFeature(Feature.TENSE, Tense.PAST); complexS.setFeature(Feature.TENSE, Tense.PAST);
...@@ -455,7 +455,7 @@ public class ClauseTest extends SimpleNLG4Test { ...@@ -455,7 +455,7 @@ public class ClauseTest extends SimpleNLG4Test {
complexS.setFeature(Feature.TENSE, Tense.PAST); complexS.setFeature(Feature.TENSE, Tense.PAST);
complexS.setObject(this.phraseFactory.createNounPhrase("Peter")); //$NON-NLS-1$ complexS.setObject(this.phraseFactory.createNounPhrase("Peter")); //$NON-NLS-1$
s6.setObject(complexS); s6.setObject(complexS);
coord = new CoordinatedPhraseElement(this.s3, s5); coord = new CoordinatedPhraseElement(this.s3, s5, this.phraseFactory);
complexS.setSubject(coord); complexS.setSubject(coord);
this.s3.setFeature(Feature.PERFECT, true);